numpy fails to build with Python 3.11.0a4. numpy/random/_mt19937.c: In function ‘__Pyx_PyErr_GetTopmostException’: numpy/random/_mt19937.c:6824:21: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’ 6824 | while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && | ^~ numpy/random/_mt19937.c:6824:51: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’ 6824 | while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) && | ^~ numpy/random/_mt19937.c: In function ‘__Pyx__ExceptionSave’: numpy/random/_mt19937.c:6838:21: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’ 6838 | *type = exc_info->exc_type; | ^~ numpy/random/_mt19937.c:6840:19: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’ 6840 | *tb = exc_info->exc_traceback; | ^~ numpy/random/_mt19937.c: In function ‘__Pyx__ExceptionReset’: numpy/random/_mt19937.c:6854:24: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’ 6854 | tmp_type = exc_info->exc_type; | ^~ numpy/random/_mt19937.c:6856:22: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’ 6856 | tmp_tb = exc_info->exc_traceback; | ^~ numpy/random/_mt19937.c:6857:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’ 6857 | exc_info->exc_type = type; | ^~ numpy/random/_mt19937.c:6859:13: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’ 6859 | exc_info->exc_traceback = tb; | ^~ numpy/random/_mt19937.c: In function ‘__Pyx__GetException’: numpy/random/_mt19937.c:6941:28: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’ 6941 | tmp_type = exc_info->exc_type; | ^~ numpy/random/_mt19937.c:6943:26: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’ 6943 | tmp_tb = exc_info->exc_traceback; | ^~ numpy/random/_mt19937.c:6944:17: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_type’ 6944 | exc_info->exc_type = local_type; | ^~ numpy/random/_mt19937.c:6946:17: error: ‘_PyErr_StackItem’ {aka ‘struct _err_stackitem’} has no member named ‘exc_traceback’ 6946 | exc_info->exc_traceback = local_tb; | ^~ The interpreter state’s representation of handled exceptions (a.k.a exc_info, or _PyErr_StackItem) now has only the exc_value field, exc_type and exc_traceback have been removed as their values can be derived from exc_value. (Contributed by Irit Katriel in bpo-45711.) https://bugs.python.org/issue45711 https://docs.python.org/3.11/whatsnew/3.11.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03210122-numpy/ For all our attempts to build numpy with Python 3.11, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/numpy/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11: https://copr.fedorainfracloud.org/coprs/g/python/python3.11/ Let us know here if you have any questions. Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
I proposed to revert the change upstream until Cython and numpy are updated for this incompatible C API change: https://bugs.python.org/issue45711#msg412264
I also opened a discussion on python-dev: "Please update Cython before introcuding C API incompatible changes in Python". https://mail.python.org/archives/list/python-dev@python.org/thread/RS2C53LDZPXHRR2VCY2G2YSPDVA4LNQU/
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle. Changing version to 36.
=================================== FAILURES =================================== ______________________ TestConversion.test_to_int_scalar _______________________ self = <numpy.core.tests.test_multiarray.TestConversion object at 0x7f4fda4d6790> def test_to_int_scalar(self): # gh-9972 means that these aren't always the same int_funcs = (int, lambda x: x.__int__()) for int_func in int_funcs: assert_equal(int_func(np.array(0)), 0) assert_equal(int_func(np.array([1])), 1) assert_equal(int_func(np.array([[42]])), 42) assert_raises(TypeError, int_func, np.array([1, 2])) # gh-9972 assert_equal(4, int_func(np.array('4'))) assert_equal(5, int_func(np.bytes_(b'5'))) assert_equal(6, int_func(np.unicode_(u'6'))) class HasTrunc: def __trunc__(self): return 3 > assert_equal(3, int_func(np.array(HasTrunc()))) E DeprecationWarning: The delegation of int() to __trunc__ is deprecated. HasTrunc = <class 'numpy.core.tests.test_multiarray.TestConversion.test_to_int_scalar.<locals>.HasTrunc'> int_func = <class 'int'> int_funcs = (<class 'int'>, <function TestConversion.test_to_int_scalar.<locals>.<lambda> at 0x7f4fda4ee020>) self = <numpy.core.tests.test_multiarray.TestConversion object at 0x7f4fda4d6790> ../../../../BUILDROOT/numpy-1.22.0-3.fc37.x86_64/usr/lib64/python3.11/site-packages/numpy/core/tests/test_multiarray.py:8324: DeprecationWarning ____________________ TestUfunc.test_pickle_name_is_qualname ____________________ self = <numpy.core.tests.test_ufunc.TestUfunc object at 0x7f4fdbe53110> def test_pickle_name_is_qualname(self): # This tests that a simplification of our ufunc pickle code will # lead to allowing qualnames as names. Future ufuncs should # possible add a specific qualname, or a hook into pickling instead # (dask+numba may benefit). _pickleable_module_global.ufunc = umt._pickleable_module_global_ufunc > obj = pickle.loads(pickle.dumps(_pickleable_module_global.ufunc)) self = <numpy.core.tests.test_ufunc.TestUfunc object at 0x7f4fdbe53110> ../../../../BUILDROOT/numpy-1.22.0-3.fc37.x86_64/usr/lib64/python3.11/site-packages/numpy/core/tests/test_ufunc.py:209: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <Cython.Shadow.CythonCImports object at 0x7f4ff1ed4ed0> item = '_pickleable_module_global' def __getattr__(self, item): if item.startswith('__') and item.endswith('__'): raise AttributeError(item) > return __import__(item) E ModuleNotFoundError: No module named '_pickleable_module_global' item = '_pickleable_module_global' self = <Cython.Shadow.CythonCImports object at 0x7f4ff1ed4ed0> /usr/lib64/python3.11/site-packages/Cython/Shadow.py:542: ModuleNotFoundError =========================== short test summary info ============================
With python 3.11.0b1 there is an error during collecting the tests.Also TestConversion.test_to_int_scalar mentioned above is still broken. ==================================== ERRORS ==================================== _____________ ERROR collecting typing/tests/test_generic_alias.py ______________ ../../../../BUILDROOT/numpy-1.22.3-1.fc37.x86_64/usr/lib64/python3.11/site-packages/numpy/typing/tests/test_generic_alias.py:23: in <module> FuncType = Callable[[Union[_GenericAlias, types.GenericAlias]], Any] Any = typing.Any Callable = typing.Callable DType = numpy.dtype[+ScalarType] DType_ref = numpy.dtype[+ScalarType] NDArray = numpy.ndarray[typing.Any, numpy.dtype[+ScalarType]] NDArray_ref = numpy.ndarray[typing.Any, numpy.dtype[+ScalarType]] ScalarType = +ScalarType T1 = ~T1 T2 = ~T2 Tuple = typing.Tuple Type = typing.Type TypeVar = <class 'typing.TypeVar'> Union = typing.Union _GenericAlias = <class 'numpy.typing._generic_alias._GenericAlias'> __builtins__ = <builtins> __cached__ = '/builddir/build/BUILDROOT/numpy-1.22.3-1.fc37.x86_64/usr/lib64/python3.11/site-packages/numpy/typing/tests/__pycache__/test_generic_alias.cpython-311.pyc' __doc__ = None __file__ = '/builddir/build/BUILDROOT/numpy-1.22.3-1.fc37.x86_64/usr/lib64/python3.11/site-packages/numpy/typing/tests/test_generic_alias.py' __loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x7f6280b124d0> __name__ = 'numpy.typing.tests.test_generic_alias' __package__ = 'numpy.typing.tests' __spec__ = ModuleSpec(name='numpy.typing.tests.test_generic_alias', loader=<_pytest.assertion.rewrite.AssertionRewritingHook obje...uild/BUILDROOT/numpy-1.22.3-1.fc37.x86_64/usr/lib64/python3.11/site-packages/numpy/typing/tests/test_generic_alias.py') annotations = _Feature((3, 7, 0, 'beta', 1), (3, 11, 0, 'alpha', 0), 16777216) copy = <module 'copy' from '/usr/lib64/python3.11/copy.py'> np = <module 'numpy' from '/builddir/build/BUILDROOT/numpy-1.22.3-1.fc37.x86_64/usr/lib64/python3.11/site-packages/numpy/__init__.py'> pickle = <module 'pickle' from '/usr/lib64/python3.11/pickle.py'> pytest = <module 'pytest' from '/usr/lib/python3.11/site-packages/pytest/__init__.py'> sys = <module 'sys' (built-in)> types = <module 'types' from '/usr/lib64/python3.11/types.py'> weakref = <module 'weakref' from '/usr/lib64/python3.11/weakref.py'> /usr/lib64/python3.11/typing.py:350: in inner return func(*args, **kwds) args = (typing.Union, (<class 'numpy.typing._generic_alias._GenericAlias'>, <class 'types.GenericAlias'>)) cached = <functools._lru_cache_wrapper object at 0x7f62815f5380> func = <function _SpecialForm.__getitem__ at 0x7f62815fc7c0> kwds = {} /usr/lib64/python3.11/typing.py:450: in __getitem__ return self._getitem(self, parameters) parameters = (<class 'numpy.typing._generic_alias._GenericAlias'>, <class 'types.GenericAlias'>) self = typing.Union /usr/lib64/python3.11/typing.py:661: in Union return _UnionGenericAlias(self, parameters) msg = 'Union[arg, ...]: each arg must be a type.' parameters = (<class 'numpy.typing._generic_alias._GenericAlias'>, <class 'types.GenericAlias'>) self = typing.Union /usr/lib64/python3.11/typing.py:1317: in __init__ self.__parameters__ = _collect_parameters(args) __class__ = <class 'typing._GenericAlias'> _paramspec_tvars = False args = (<class 'numpy.typing._generic_alias._GenericAlias'>, <class 'types.GenericAlias'>) inst = True name = None origin = typing.Union self = typing.Union[numpy.typing._generic_alias._GenericAlias, types.GenericAlias] /usr/lib64/python3.11/typing.py:257: in _collect_parameters for x in getattr(t, '__parameters__', ()): E TypeError: 'property' object is not iterable args = (<class 'numpy.typing._generic_alias._GenericAlias'>, <class 'types.GenericAlias'>) parameters = [] t = <class 'numpy.typing._generic_alias._GenericAlias'> =========================== short test summary info ============================ ERROR ../../typing/tests/test_generic_alias.py - TypeError: 'property' object... !!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!! 1296 deselected, 1 error in 8.48s