[SCSB-54] `stregion` fails to build under Python 3.11
Closed this issue · 2 comments
zacharyburnett commented
When building stenv
under Python 3.11, the build fails upon building stregion
.
https://github.com/spacetelescope/stenv/actions/runs/3339612994/jobs/5529373159#step:9:1090
Steps that can reproduce the error:
sed -i "s/python==3.9/python==3.11.*/g" stenv-latest.yml
conda create -n stenv -f stenv_latest.yml
- the following error happens:
Building wheel for stregion (pyproject.toml): finished with status 'error'
Successfully built calcos costools drizzlepac ginga jwst pysynphot reftools stistools synphot wfc3tools astroscrappy stsci.tools
Failed to build h5py reproject stregion
Pip subprocess error:
error: subprocess-exited-with-error
× Building wheel for h5py (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [71 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-cpython-311
creating build/lib.macosx-10.9-x86_64-cpython-311/h5py
copying h5py/h5py_warnings.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py
copying h5py/version.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py
copying h5py/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py
copying h5py/ipy_completer.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py
creating build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/files.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/compat.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/selections.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/dataset.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/vds.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/selections2.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/group.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/datatype.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/attrs.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/dims.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/base.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
copying h5py/_hl/filters.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/_hl
creating build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_dimension_scales.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_attribute_create.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_file_image.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/conftest.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_h5d_direct_chunk.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_h5f.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_dataset_getitem.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_group.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_errors.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_dataset_swmr.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_slicing.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_h5pl.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_attrs.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_attrs_data.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_h5t.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_big_endian_file.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_h5p.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_dims_dimensionproxy.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_h5o.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_datatype.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/common.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_dataset.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_file.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_selections.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_dtype.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_h5.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_file2.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_completions.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_filters.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_base.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_objects.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
copying h5py/tests/test_file_alignment.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests
creating build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/data_files
copying h5py/tests/data_files/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/data_files
creating build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/test_vds
copying h5py/tests/test_vds/test_highlevel_vds.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/test_vds
copying h5py/tests/test_vds/test_virtual_source.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/test_vds
copying h5py/tests/test_vds/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/test_vds
copying h5py/tests/test_vds/test_lowlevel_vds.py -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/test_vds
copying h5py/tests/data_files/vlen_string_s390x.h5 -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/data_files
copying h5py/tests/data_files/vlen_string_dset_utc.h5 -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/data_files
copying h5py/tests/data_files/vlen_string_dset.h5 -> build/lib.macosx-10.9-x86_64-cpython-311/h5py/tests/data_files
running build_ext
Building h5py requires pkg-config unless the HDF5 path is explicitly specified using the environment variable HDF5_DIR. For more information and details, see https://docs.h5py.org/en/stable/build.html#custom-installation
error: pkg-config probably not installed: FileNotFoundError(2, 'No such file or directory')
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for h5py
error: subprocess-exited-with-error
× Building wheel for stregion (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [100 lines of output]
/private/var/folders/bv/nnh6jr1553jcv2pxbt8hyw6c00053_/T/pip-build-env-f7m_y55q/overlay/lib/python3.11/site-packages/setuptools/dist.py:317: DistDeprecationWarning: use_2to3 is ignored.
warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-cpython-311
creating build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/version.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/region_numbers.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/region_to_filter.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/__init__.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/ds9_region_parser.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/parser_helper.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/kapteyn_celestial.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/wcs_helper.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/mpl_helper.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/ds9_attr_parser.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/physical_coordinate.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
copying stregion/wcs_converter.py -> build/lib.macosx-10.9-x86_64-cpython-311/stregion
running build_ext
building 'stregion._region_filter' extension
creating build/temp.macosx-10.9-x86_64-cpython-311
creating build/temp.macosx-10.9-x86_64-cpython-311/src
clang -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/miniconda3/envs/stenv_311/include -fPIC -O2 -isystem /opt/miniconda3/envs/stenv_311/include -I./src -I/private/var/folders/bv/nnh6jr1553jcv2pxbt8hyw6c00053_/T/pip-build-env-f7m_y55q/overlay/lib/python3.11/site-packages/numpy/core/include -I/opt/miniconda3/envs/stenv_311/include/python3.11 -c src/_region_filter.c -o build/temp.macosx-10.9-x86_64-cpython-311/src/_region_filter.o
In file included from src/_region_filter.c:225:
In file included from /private/var/folders/bv/nnh6jr1553jcv2pxbt8hyw6c00053_/T/pip-build-env-f7m_y55q/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/arrayobject.h:5:
In file included from /private/var/folders/bv/nnh6jr1553jcv2pxbt8hyw6c00053_/T/pip-build-env-f7m_y55q/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/ndarrayobject.h:12:
In file included from /private/var/folders/bv/nnh6jr1553jcv2pxbt8hyw6c00053_/T/pip-build-env-f7m_y55q/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/ndarraytypes.h:1948:
/private/var/folders/bv/nnh6jr1553jcv2pxbt8hyw6c00053_/T/pip-build-env-f7m_y55q/overlay/lib/python3.11/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it with " \
^
src/_region_filter.c:3565:14: warning: explicitly assigning value of variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
__pyx_self = __pyx_self;
~~~~~~~~~~ ^ ~~~~~~~~~~
src/_region_filter.c:3762:14: warning: explicitly assigning value of variable of type 'PyObject *' (aka 'struct _object *') to itself [-Wself-assign]
__pyx_self = __pyx_self;
~~~~~~~~~~ ^ ~~~~~~~~~~
src/_region_filter.c:9486:25: warning: 'PyUnicode_GET_SIZE' is deprecated [-Wdeprecated-declarations]
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/unicodeobject.h:664:34: note: expanded from macro 'PyUnicode_GET_SIZE'
# define PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(_PyObject_CAST(op))
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/unicodeobject.h:651:1: note: 'PyUnicode_GET_SIZE' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/opt/miniconda3/envs/stenv_311/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
src/_region_filter.c:9486:55: warning: 'PyUnicode_GET_SIZE' is deprecated [-Wdeprecated-declarations]
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/unicodeobject.h:664:34: note: expanded from macro 'PyUnicode_GET_SIZE'
# define PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(_PyObject_CAST(op))
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/unicodeobject.h:651:1: note: 'PyUnicode_GET_SIZE' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/opt/miniconda3/envs/stenv_311/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
src/_region_filter.c:9500:29: warning: 'PyUnicode_GET_SIZE' is deprecated [-Wdeprecated-declarations]
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/unicodeobject.h:664:34: note: expanded from macro 'PyUnicode_GET_SIZE'
# define PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(_PyObject_CAST(op))
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/unicodeobject.h:651:1: note: 'PyUnicode_GET_SIZE' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/opt/miniconda3/envs/stenv_311/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
src/_region_filter.c:9500:59: warning: 'PyUnicode_GET_SIZE' is deprecated [-Wdeprecated-declarations]
if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/unicodeobject.h:664:34: note: expanded from macro 'PyUnicode_GET_SIZE'
# define PyUnicode_GET_SIZE(op) PyUnicode_GET_SIZE(_PyObject_CAST(op))
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/unicodeobject.h:651:1: note: 'PyUnicode_GET_SIZE' has been explicitly marked deprecated here
Py_DEPRECATED(3.3)
^
/opt/miniconda3/envs/stenv_311/include/python3.11/pyport.h:336:54: note: expanded from macro 'Py_DEPRECATED'
#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))
^
src/_region_filter.c:10177:5: error: too few arguments to function call, expected 17, have 15
);
^
/opt/miniconda3/envs/stenv_311/include/python3.11/cpython/code.h:148:28: note: 'PyCode_New' declared here
PyAPI_FUNC(PyCodeObject *) PyCode_New(
^
src/_region_filter.c:10186:13: error: incomplete definition of type 'struct _frame'
py_frame->f_lineno = __pyx_lineno;
~~~~~~~~^
/opt/miniconda3/envs/stenv_311/include/python3.11/pytypedefs.h:22:16: note: forward declaration of 'struct _frame'
typedef struct _frame PyFrameObject;
^
7 warnings and 2 errors generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for stregion
ERROR: Could not build wheels for h5py, reproject, stregion, which is required to install pyproject.toml-based projects
zacharyburnett commented
these changes fix the build, at least:
https://github.com/spacetelescope/stregion/compare/master...zacharyburnett:stregion:master?diff=unified#diff-9d76f4e68c29caee578cb947a0aac91471fabab63f6905e133d019f04b78c98d
py_srcfile, /*PyObject *filename,*/
py_funcname, /*PyObject *name,*/
__pyx_lineno, /*int firstlineno,*/
+ #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11
__pyx_empty_bytes, /*PyObject *lnotab*/
__pyx_empty_bytes, /* PyObject *exceptiontable */
__pyx_empty_bytes
+ #else
__pyx_empty_bytes /*PyObject *lnotab*/
+ #endif
);
+ #if !(PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 11)
if (!py_code) goto bad;
py_frame = PyFrame_New(
PyThreadState_GET(), /*PyThreadState *tstate,*/
@@ -10185,6 +10192,7 @@ static void __Pyx_AddTraceback(const char *funcname) {
if (!py_frame) goto bad;
py_frame->f_lineno = __pyx_lineno;
PyTraceBack_Here(py_frame);
+ #endif
bad:
Py_XDECREF(py_srcfile);
Py_XDECREF(py_funcname);
mcara commented
Looks good to me. Don't know what to do about archival status of stregion
though. Maybe the person who archived it might know, @jhunkeler