Numpy >=1.22.0 RuntimeError
See original GitHub issueHi 👋 There appears to be an issue when using the newer Numpy >= 1.22.0 (current release is 1.22.1). It compiles without issue but gives the following error when trying to run the compiled standalone:
Traceback (most recent call last):
File "/home/theguy/projects/test_nuitka/numpy_test.dist/numpy_test.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "/home/theguy/projects/test_nuitka/numpy_test.dist/numpy/__init__.py", line 144, in <module numpy>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "/home/theguy/projects/test_nuitka/numpy_test.dist/numpy/core/__init__.py", line 23, in <module numpy.core>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "/home/theguy/projects/test_nuitka/numpy_test.dist/numpy/core/multiarray.py", line 80, in <module numpy.core.multiarray>
File "/home/theguy/projects/test_nuitka/numpy_test.dist/numpy/core/overrides.py", line 201, in decorator
File "/home/theguy/projects/test_nuitka/numpy_test.dist/numpy/core/overrides.py", line 183, in decorator
RuntimeError: __code__ is not writable in Nuitka
Issue tested with Nuitka 0.6.18.6, 0.6.19.1 and develop branch. If one holds the numpy version back to 1.21.5, there’s no problem.
0.6.19.1
Commercial: None
Python: 3.9.7 (default, Sep 10 2021, 14:59:43)
Flavor: Debian Python
Executable: /home/theguy/.cache/pypoetry/virtualenvs/test-nuitka-Z7Y54p4h-py3.9/bin/python
OS: Linux
Arch: x86_64
Distribution: Pop 21.10
Installed through poetry (virtualenv)
Nuitka @ file:///home/theguy/.cache/pypoetry/artifacts/0e/82/a6/3eda349f3337b0fbbda8ecb9a47f50a9ee2e7095fa023a188751046956/Nuitka-0.6.19.1.tar.gz numpy @ file:///home/theguy/.cache/pypoetry/artifacts/df/02/c1/3940f115306d04c79d2a84ed299e313221e70a193e47f967dc53ac0986/numpy-1.22.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
SSCCE: numpy_test.py
# nuitka-project: --standalone
# nuitka-project: --plugin-enable=numpy
# nuitka-project: --static-libpython=no
import numpy as np
arr = np.array([[1, 2, 3], [4, 2, 5]])
print("Shape of array: ", arr.shape)
python -m nuitka numpy_test.py
./numpy_test.dist/numpy_test
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
It seems there was also a macOS issue caused by build system changes, also on factory and will be in the hotfix too, which I had to delay because of that.
I will look into this tomorrow, but you try to enable the anti-bloat plugin, that might help, as it removes stuff in that area.