You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have included a self contained code sample to reproduce the problem.
i.e. it's possible to run as 'python bug.py'.
This will be a somewhat sparse bug report, but putting here early in case anyone recognizes this. We can do more work to replicate the environment if not.
In our upstream tests, xarray tests nightly against unreleased versions of our dependencies to get ahead of any incompatible code. Occasionally it also catches bugs in upstream libraries.
Here, we're getting an error importing some items from numba.np.ufunc, including the somewhat confusing SystemError: initialization of _internal failed without raising an exception at the bottom of the stack trace.
Reacted by Spencer Hallyburton, Ze Engida, Marco Edward Gorelli, Stanislas du Ché, arturdaraujo, Ievgenii Krevenets, Ray Bell, theimagelab, Aitor Duo Zubiaurre, Hanif Izzudin Rahman and 8 more
I had to cancel my test run as I was working on other things, but it looked like things were generally working with those small changes: https://github.com/gmarkall/numba/tree/np-124 (YMMV, etc!)
Thanks @stuartarchibald — that makes sense. I think we'll explore excluding anything that runs numba in these tests if this crops up again
2. There are simply not the resources (human, packages, or compute) for Numba to track NumPy HEAD.
Totally empathize! FWIW, we've found that the upstream HEAD tests reduce the maintainer burden, since we can solve problems at a slower pace — no need to rush when there's an upstream release that breaks something — and we can provide feedback on breakages where there's a mistaken breaking change. But numba is a more technically complex project than Xarray, so possibly the learning is not transferable.
There are simply not the resources (human, packages, or compute) for Numba to track NumPy HEAD.
Totally empathize! FWIW, we've found that the upstream HEAD tests reduce the maintainer burden, since we can solve problems at a slower pace — no need to rush when there's an upstream release that breaks something — and we can provide feedback on breakages where there's a mistaken breaking change. But numba is a more technically complex project than Xarray, so possibly the learning is not transferable.
Thanks for sharing this. I can see that for some projects, aspects of the described approach would certainly be beneficial in terms of maintenance burden.
The Numba maintainers do track changes to dependencies and work with other projects if issues are anticipated, they also often "try out" the code base against newer versions of projects that impact Numba (cPython, LLVM, NumPy) etc to assess the level of effort needed to do the necessary updates. I think the learning from the Numba side is probably, that in developing a compiler, having a stable and predictable environment in which to develop makes it easier to isolate problems. This is in part due to problems often being very niche e.g. one single Python+NumPy+OS+CPU combination might exhibit a particular issue!
Reacted by Spencer Hallyburton, Daniel Tsiang, Marco Edward Gorelli, Carlos Ramos Carreño, Catherine Zhang, Zachary Moon, Maarten-vd-Sande, Ben Pedigo, Kim Tang, A Vaz and 6 more
________________________ ERROR collecting test session _________________________
../../../micromamba/envs/test/lib/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
???
<frozen importlib._bootstrap>:991: in _find_and_load
???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:671: in _load_unlocked
???
../../../micromamba/envs/test/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:168: in exec_module
exec(co, module.__dict__)
pandas/tests/window/conftest.py:93: in <module>
@pytest.fixture(params=[pytest.param("numba", marks=td.skip_if_no("numba")), "cython"])
pandas/util/_test_decorators.py:192: in skip_if_no
not safe_import(package, min_version=min_version), reason=msg
pandas/util/_test_decorators.py:95: in safe_import
mod = __import__(mod_name)
../../../micromamba/envs/test/lib/python3.8/site-packages/numba/__init__.py:43: in <module>
from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
../../../micromamba/envs/test/lib/python3.8/site-packages/numba/np/ufunc/__init__.py:3: in <module>
from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
../../../micromamba/envs/test/lib/python3.8/site-packages/numba/np/ufunc/decorators.py:3: in <module>
from numba.np.ufunc import _internal
E SystemError: initialization of _internal failed without raising an exception
For devs who are trying to fix their environments
The problem occurs in the latest version of numpy. Installing a lower version of numpy (<1.24) fixed the problem for us.
Reacted by Drew Ripberger, Aaron Spring, Raphael Quast, Christian Chwala, azul, arturdaraujo, Jolando Kisse, Takuma Yoneda, James Gaboardi, James Adams and 20 more
I was having the same problem with the librosa library (The reason was that librosa was working with different versions of scipy and matplotlib), so I uninstalled numpy, matplotlib, and scipy, installed librosa first which installed its own compatible versions of libraries above and then I installed the necessary libraries. That seems to work for me.
Thank you all for your comments/feedback on this issue. This issue seems to have diverged a little from the originally reported problem and so I'm closing this issue as resolved with some specific follow up issues to subscribe to if they are important to you:
With respect to the originally posted issue, this comment Error on import with numpy HEAD #8615 (comment) (and some discussion immediately after) explains the decisions surrounding Numba not tracking NumPy HEAD.
With respect to the originally posted issue, NumPy 1.24 #8691 is the patch for making Numba compatible with NumPy 1.24.
The NumPy 1.24 related problem that manifests as the error:
SystemError: initialization of _internal failed without raising an exception
for me numba=0.56.4 from conda-forge fails locally with numpy=1.24.0.dev0+1120.gf30af6acd, so not sure what I'm doing wrong? @max-sixty, was that with the numba head?
and pip does indeed complain that numba requires numpy<1.24 but installs it anyways (as intended in this case, because we do actually want to test with the most recent version, even if that breaks something). So while point 2 from #8615 (comment) does not apply, point 3 may very well be the cause of the problem.
Thanks. This help a lot. I reinstall numpy by "pip install numpy==1.23.0". Then, the error when "import numba" was solved.
Reacted by Gabriel Gilbreath, Elliot Tower and Lydon Chandra
Hello everyone, the solutions posted here did not fix the problem for me. I tried numba v0.56.4 and v0.56.3 and both of these versions did not work with either numpy 1.23.0 or 1.24.0. I installed everything with conda-forge and I am using WSL. Any help would be greatly appreciated. Thank you!
Reacted by Isha Pathania, Nils Wildt, Nitin Madnani, GRISHANIN Vasiliy, Dmitry, Fred Frey, Julian Nubert, Somshubra Majumdar, bilzard, Jelmer Kuperus and 2 more
Hello everyone, the solutions posted here did not fix the problem for me. I tried numba v0.56.4 and v0.56.3 and both of these versions did not work with either numpy 1.23.0 or 1.24.0. I installed everything with conda-forge and I am using WSL. Any help would be greatly appreciated. Thank you!
I fixed with conda install cudatoolkit on a cpu only machine
Activity
gmarkall commentedon Nov 23, 2022
The following is also needed because the deprecated
MachAris now removed:with this I'm able to start running the test suite - as things pass by, everything appears OK so far, but will update here if the test run completes.
gmarkall commentedon Nov 23, 2022
I had to cancel my test run as I was working on other things, but it looked like things were generally working with those small changes: https://github.com/gmarkall/numba/tree/np-124 (YMMV, etc!)
max-sixty commentedon Nov 24, 2022
Thanks @stuartarchibald — that makes sense. I think we'll explore excluding anything that runs numba in these tests if this crops up again
Totally empathize! FWIW, we've found that the upstream
HEADtests reduce the maintainer burden, since we can solve problems at a slower pace — no need to rush when there's an upstream release that breaks something — and we can provide feedback on breakages where there's a mistaken breaking change. But numba is a more technically complex project than Xarray, so possibly the learning is not transferable.stuartarchibald commentedon Nov 24, 2022
@max-sixty no problem, glad it was helpful.
Thanks for sharing this. I can see that for some projects, aspects of the described approach would certainly be beneficial in terms of maintenance burden.
The Numba maintainers do track changes to dependencies and work with other projects if issues are anticipated, they also often "try out" the code base against newer versions of projects that impact Numba (cPython, LLVM, NumPy) etc to assess the level of effort needed to do the necessary updates. I think the learning from the Numba side is probably, that in developing a compiler, having a stable and predictable environment in which to develop makes it easier to isolate problems. This is in part due to problems often being very niche e.g. one single Python+NumPy+OS+CPU combination might exhibit a particular issue!
larsoner commentedon Dec 19, 2022
Just a heads up that I think I'm hitting this error in CIs now that NumPy 1.24 has been released:
https://github.com/mne-tools/mne-python/actions/runs/3732610574/jobs/6332287508#step:9:56
I expect others might hit it soon, too.
MarcoGorelli commentedon Dec 20, 2022
Yup, same story in pandas https://github.com/pandas-dev/pandas/actions/runs/3737292562/jobs/6342364883
We can pin numpy to 1.23.5 for now, no issue
zarifaziz commentedon Dec 21, 2022
For devs who are trying to fix their environments
The problem occurs in the latest version of numpy. Installing a lower version of numpy (<1.24) fixed the problem for us.
fix: pin numpy version
gmarkall commentedon Dec 21, 2022
Looks like I forgot to mention in this issue, the PR / branch for NumPy 1.24 support is #8620
[FIX] Matplotlib and numba errors (#142)
Workaround for numba/numba#8615
Less restrictive workaround for numba/numba#8615
Less restrictive workaround for numba/numba#8615
requiremens: Pin numpy < 1.24
dev-python/numba: fix Numpy dep
init_ufunc_dispatch: Handle unexpected ufunc methods gracefully
gmarkall commentedon Jan 3, 2023
The PR for review for NumPy 1.24 support is: #8691
fmPeretti commentedon Jan 4, 2023
Having the same issue over here with an old numpy version 😕 rolling back to an old version dindt work for me

Fix numpy version to avoid numba conflict
Pin numpy to avoid numba/numba#8615
pin numpy to avoid numba/numba#8615
Temporarily pin numpy
Temporarily pin numpy to 1.23.5
Veda-73 commentedon Jan 16, 2023
I was having the same problem with the librosa library (The reason was that librosa was working with different versions of scipy and matplotlib), so I uninstalled numpy, matplotlib, and scipy, installed librosa first which installed its own compatible versions of libraries above and then I installed the necessary libraries. That seems to work for me.
ssvenoe commentedon Jan 18, 2023
Having this issue with
python=3.8.15, build: h4de0772_0_cpython, Channel: conda-forge
numba=0.56.4, build: pypi_0, channel: pypi
numpy=1.23.5, build: pypi_0, channel: pypi
stuartarchibald commentedon Jan 18, 2023
Thank you all for your comments/feedback on this issue. This issue seems to have diverged a little from the originally reported problem and so I'm closing this issue as resolved with some specific follow up issues to subscribe to if they are important to you:
HEAD.__init__.pynot catching incompatible NumPy version early enough #8718.inikishev commentedon Feb 11, 2023
what version of numpy should i install?
gmarkall commentedon Feb 14, 2023
If you're using the last released version of Numba (0.56.4 at time of writing), NumPy 1.18 - 1.23 are supported.
arijin commentedon Feb 17, 2023
Thanks. This help a lot. I reinstall numpy by "pip install numpy==1.23.0". Then, the error when "import numba" was solved.
pimiento commentedon Mar 25, 2023
Is it fixed in any version?
Limit version of numpy to <1.24
Add sourcepredict recipe (#40456)
chiiingky commentedon Apr 27, 2023
Hello everyone, the solutions posted here did not fix the problem for me. I tried numba v0.56.4 and v0.56.3 and both of these versions did not work with either numpy 1.23.0 or 1.24.0. I installed everything with conda-forge and I am using WSL. Any help would be greatly appreciated. Thank you!
Add sourcepredict recipe (bioconda#40456)
bugfix: update py-numba to 0.57.1
fyenne commentedon Aug 23, 2023
I fixed with
conda install cudatoolkiton a cpu only machine