Skip to content

ValueError: numpy.dtype size changed #3953

@ftherrien

Description

@ftherrien

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions