Reporting a bug
My library uses Numpy and Numba. All works as expected when using a compatible Numpy version.
I rely on ImportError being raised when importing Numba while an incompatible Numpy version is installed. Then, I can disable Numba and warn the user (recommending to downgrade Numpy, for example).
I recently upgraded my library and found that ImportError is no longer raised when an incompatible Numpy version is installed. Instead, a SystemError is raised while importing _internal from numba/__init__.py, so _ensure_critical_deps() doesn't get called:
$ python
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numba
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jotaele/Devel/pygeomy/venv_nb/lib/python3.8/site-packages/numba/__init__.py", line 42, in <module>
from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
File "/home/jotaele/Devel/pygeomy/venv_nb/lib/python3.8/site-packages/numba/np/ufunc/__init__.py", line 3, in <module>
from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
File "/home/jotaele/Devel/pygeomy/venv_nb/lib/python3.8/site-packages/numba/np/ufunc/decorators.py", line 3, in <module>
from numba.np.ufunc import _internal
SystemError: initialization of _internal failed without raising an exception
I used the following minimal environment to reproduce the problem:
Ubuntu 20.04 LTS
Python 3.8.10
Package Version
------------------ -------
importlib-metadata 6.1.0
llvmlite 0.39.1
numba 0.56.4
numpy 1.24.2
pip 23.0.1
setuptools 67.6.0
wheel 0.40.0
zipp 3.15.0
As a workaround I'm solving the problem by catching also SystemError while attempting to import Numba. But it doesn't provide the root cause (as _ensure_critical_deps() did) so I can't advice the user on how to solve the problem.
Reporting a bug
My library uses Numpy and Numba. All works as expected when using a compatible Numpy version.
I rely on
ImportErrorbeing raised when importing Numba while an incompatible Numpy version is installed. Then, I can disable Numba and warn the user (recommending to downgrade Numpy, for example).I recently upgraded my library and found that
ImportErroris no longer raised when an incompatible Numpy version is installed. Instead, aSystemErroris raised while importing_internalfromnumba/__init__.py, so_ensure_critical_deps()doesn't get called:I used the following minimal environment to reproduce the problem:
As a workaround I'm solving the problem by catching also
SystemErrorwhile attempting to import Numba. But it doesn't provide the root cause (as_ensure_critical_deps()did) so I can't advice the user on how to solve the problem.