Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility of Python3.8+, Cython, Numpy, and Numba #5

Open
yangyushi opened this issue Jan 3, 2022 · 0 comments
Open

Incompatibility of Python3.8+, Cython, Numpy, and Numba #5

yangyushi opened this issue Jan 3, 2022 · 0 comments

Comments

@yangyushi
Copy link
Owner

Some user with Python version newer than 3.8 might experience following issue when importing nplocate.

>>> import nplocate
Traceback (most recent call last):
 File<stdin>“, line 1, in <module>
 File “.../python3.8/site-packages/nplocate/__init__.py”, line 4, in <module>
  from .model import GaussianSphere
 File “.../python3.8/site-packages/nplocate/model.py”, line 16, in <module>
  from nplocate import csimulate
 Filenplocate/csimulate.pyx”, line 1, in init nplocate.csimulate
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

After some experiment I think this is related to the version of numpy (1.20.x). It needs to be upgraded to 1.22.x, so that the Cython compiled code csimulate.pyx could work.

So, if you see the error, try to upgrade the numpy to latest version.

However, the situation can be harder when numba is taken into consideration. The current numba version (0.54.1) does not support numpy 1.21.x +. Hopefully the numba people will support latest numpy at some point. At the moment, the way to solve the issue seems to be using an older Python (like Python 3.7).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant