FS#77269 - [python-numba] SystemError: initialization of _internal failed without raising an exception

Attached to Project: Community Packages
Opened by Carlos Aznarán (carlosal1015) - Thursday, 26 January 2023, 17:14 GMT
Last edited by Toolybird (Toolybird) - Saturday, 29 April 2023, 22:15 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Bruno Pagani (ArchangeGabriel)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 7
Private No


Description: With the recent python-numpy upgrade, the python-numba package initialization throws an error.

Additional info:
* python-numba 0.56.4-2

Steps to reproduce:

$ sudo pacman -Syu
$ sudo pacman -S python-numba
$ python
Python 3.10.9 (main, Dec 19 2022, 17:35:49) [GCC 12.2.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 "/usr/lib/python3.10/site-packages/numba/__init__.py", line 42, in <module>
from numba.np.ufunc import (vectorize, guvectorize, threading_layer,
File "/usr/lib/python3.10/site-packages/numba/np/ufunc/__init__.py", line 3, in <module>
from numba.np.ufunc.decorators import Vectorize, GUVectorize, vectorize, guvectorize
File "/usr/lib/python3.10/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
This task depends upon

Closed by  Toolybird (Toolybird)
Saturday, 29 April 2023, 22:15 GMT
Reason for closing:  Fixed
Additional comments about closing:  python-numba 0.57.0rc1-1
Comment by Martin Diehl (MartinDiehl) - Thursday, 26 January 2023, 21:37 GMT
same here
Comment by loqs (loqs) - Thursday, 26 January 2023, 21:51 GMT
python-numba does not support python-numpy 1.24 yet [1], the open PR is [2].

[1] https://github.com/numba/numba/issues/8615
[2] https://github.com/numba/numba/pull/8691
Comment by Blair Bonnett (bcb) - Friday, 27 January 2023, 09:20 GMT
I have modified the PKGBUILD of python-numba-git in the AUR to apply the pull request and it seems to be working.

If the patch [1] can be applied to the last release, would it be possible to rebuild python-numba with it?

[1] https://patch-diff.githubusercontent.com/raw/numba/numba/pull/8691.patch
Comment by Iyan (iyanmv) - Friday, 03 February 2023, 10:55 GMT
+1 to apply the patch to stable release if possible.
Comment by Toolybird (Toolybird) - Friday, 03 February 2023, 22:35 GMT
Dupe  FS#77369 
Comment by Iyan (iyanmv) - Thursday, 23 February 2023, 09:10 GMT
Hi Bruno, maybe this should go back to AUR if you don't have time to maintain it. I would expect packages in official repos to be compatible with other packages in the official repos. Numba is totally broken without the patch mentioned above with current version of numpy in [extra].
Comment by Claudia Pellegrino (Auerhuhn) - Monday, 06 March 2023, 17:17 GMT
Hi Bruno, this affects quite a number of packages in the AUR.
What can we do to help get this fixed?
Comment by loqs (loqs) - Monday, 06 March 2023, 23:03 GMT
Please test applying this patch and check if you encounter any test failures in check().
Comment by loqs (loqs) - Monday, 06 March 2023, 23:35 GMT
Added two more commits from the 8691 pull [1] to match those NixOS chose [2]. The additional commit [3] lifts the numpy 1.23 version restriction NixOS used a string replacement instead.
Forgot to attach patch.

[1] https://github.com/numba/numba/pull/8691
[2] https://github.com/NixOS/nixpkgs/pull/218929/commits/117cd915671433db1620e1701b101e481b31630d
[3] https://github.com/numba/numba/commit/d1cc6fcfd7599d6ccbdfa1b5436b128de5ec1632
Comment by Iyan (iyanmv) - Tuesday, 07 March 2023, 10:19 GMT
No issues on check() on my desktop using extra-x86_64-build, but with "NumPy >= 1.22 with AVX512_SKX detected: False". Now rerunning on my laptop that has AVX512.
Comment by Iyan (iyanmv) - Tuesday, 07 March 2023, 10:58 GMT
Same on my laptop. Everything seems to work just fine with that patch.
Comment by - (xiota) - Thursday, 09 March 2023, 01:17 GMT
I'm unable to build without changing `max_numpy_run_version = "1.24"` to `max_numpy_run_version = "1.25"` in `setup.py`. There's some `<` check that fails even after I changed the ones I could find to `<=`. PKGBUILD that downloads and applies loqs' patch is attached.
   PKGBUILD (2.9 KiB)
Comment by Daniel Bershatsky (daskol) - Wednesday, 15 March 2023, 20:46 GMT
Thanks @xiota. You `PKGBUILD` works perfectly.
Comment by loqs (loqs) - Tuesday, 21 March 2023, 21:29 GMT
Updated PKGBUILD.diff that 13 commits dropping [1] which did not remove the need for patching max_numpy_run_version replaced with two sed calls one for max_numpy_run_version and a second for numpy_version.
Note numba will probably break again on the python 3.11 judging from the outstanding pull requests.

[1] https://github.com/numba/numba/commit/d1cc6fcfd7599d6ccbdfa1b5436b128de5ec1632
Comment by loqs (loqs) - Saturday, 08 April 2023, 15:37 GMT
Updated to numba 0.57.0rc1 and llvmlite 0.40.0rc1 for python 3.11.