Python import error:ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Closed this issue · 3 comments
When I import mcubes in my python file,an error occurs.I'm very confused and wondering if anyone is having the same problem.
File "*", line 6, in <module>
import mcubes
File "*/site-packages/mcubes/__init__.py", line 2, in <module>
from ._mcubes import marching_cubes, marching_cubes_func
File "mcubes/src/_mcubes.pyx", line 2, in init mcubes._mcubes
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
environment:
Python 3.10.0
PyMCubes 0.1.4
numpy 2.0.0
Getting the same error with the following environment:
$ pip list
Package Version
-------- -------
numpy 2.0.0
pip 24.1.1
PyMCubes 0.1.4
scipy 1.14.0
and Python 3.12.2
and Windows 10
Indeed, there is a problem with the versions in the requirements of PyMCubes, and the precompiled packages available in pip do not yet support NumPy 2.0.
While I fix this (and possibly add support for NumPy 2.0), you can downgrade to NumPy 1.26 with
python -m pip install 'numpy~=1.26.0'
(or similar with your package manager if you don't use pip).
Thanks for reporting this and sorry for the inconvenience.
I just uploaded a new version of PyMCubes. Just upgrade with:
python -m pip install --upgrade pymcubes
This problem should be fixed now. Thanks!