luispedro / mahotas

Computer Vision in Python
https://mahotas.rtfd.io
Other
846 stars 148 forks source link

Pip install error #132

Closed kevinjohncutler closed 2 years ago

kevinjohncutler commented 2 years ago

Installing with pip gives me this error on import:

RuntimeError: module compiled against API version 0x10 but this version of numpy is 0xf
Could not import submodules (exact error was: numpy.core.multiarray failed to import).

There are many reasons for this error the most common one is that you have
either not built the packages or have built (using `python setup.py build`) or
installed them (using `python setup.py install`) and then proceeded to test
mahotas **without changing the current directory**.

Installing though conda does not raise this error. This is the same issue as #113, but apparently for numpy version 0x10 (1.23) and 0x0f (1.22). The release notes say mahotas 1.4.13 should work for 1.22, which is my version (only for compatibility with numba). As expected, there is no error if I instead use mahotas 1.4.12.

luispedro commented 2 years ago

My guess is that pip install uses wheels which are actually dependent on the version that was used to build and this is leading to this incompatibility.

Maybe pip install --no-binary mahotas would work

kevinjohncutler commented 2 years ago

Ah, so pip install mahotas --no-binary :all: will do it (without the :all I get an error). Another way that works is pip install git+https://github.com/luispedro/mahotas.git. Thanks!

Czaki commented 1 year ago

If someone finds this problem, it looks like an outdated NumPy version in the author environment.