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

ValueError: numpy.dtype size changed #3953

Closed
ftherrien opened this issue Jul 26, 2024 · 3 comments
Closed

ValueError: numpy.dtype size changed #3953

ftherrien opened this issue Jul 26, 2024 · 3 comments
Labels

Comments

@ftherrien
Copy link
Contributor

ftherrien commented Jul 26, 2024

Python version

Python 3.10.12

Pymatgen version

pymatgen-2024.7.18

Operating system version

Ubuntu 22.04.4 LTS

Current behavior

>>> from pymatgen.core import Lattice
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/felixtherrien/envs/ocpenv/lib/python3.10/site-packages/pymatgen/core/__init__.py", line 11, in <module>
    from pymatgen.core.lattice import Lattice
  File "/home/felixtherrien/envs/ocpenv/lib/python3.10/site-packages/pymatgen/core/lattice.py", line 19, in <module>
    from pymatgen.util.coord import pbc_shortest_vectors
  File "/home/felixtherrien/envs/ocpenv/lib/python3.10/site-packages/pymatgen/util/coord.py", line 14, in <module>
    from pymatgen.util import coord_cython
  File "src/pymatgen/util/coord_cython.pyx", line 1, in init pymatgen.util.coord_cython
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

This happens in a fresh environment where I only installed pymatgen
pip install pymatgen
In that environment the version of numpy is 2.0.1

Expected Behavior

If I install numpy version 1.26.4, the error disapears

Minimal example

from pymatgen.core import Lattice

Relevant files to reproduce this bug

No response

@ftherrien ftherrien added the bug label Jul 26, 2024
@lbluque
Copy link
Contributor

lbluque commented Jul 26, 2024

The issue here seems to be that the build specifies,

"oldest-supported-numpy",

Which wont work with numpy>=2.0.

To fix quickly, downgrade numpy.

To actually support numpy>=2.0, looks like the build system has to use numpy>=2, which should be backward compatible. See:
https://numpy.org/devdocs/dev/depending_on_numpy.html#numpy-2-0-specific-advice

@DanielYang59
Copy link
Contributor

Hi @ftherrien thanks for reporting this. I believe this issue has been resolved by #3894. Can you have another try?

@ftherrien
Copy link
Contributor Author

Works now. Thanks!

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

No branches or pull requests

3 participants