Numpy.ufunc has the wrong size, try recompiling

When I run “Example: Generating phase diagrams”, something wrong occurred:
Traceback (most recent call last):
File “C:/Users/ADOLPH/Desktop/python/login/login/pym.py”, line 1, in
from pymatgen import MPRester
File “D:\Anaconda3\lib\site-packages\pymatgen_init_.py”, line 46, in
from pymatgen.core import *
File “D:\Anaconda3\lib\site-packages\pymatgen\core_init_.py”, line 8, in
from .structure import Structure, IStructure, Molecule, IMolecule
File “D:\Anaconda3\lib\site-packages\pymatgen\core\structure.py”, line 24, in
from pymatgen.core.lattice import Lattice
File “D:\Anaconda3\lib\site-packages\pymatgen\core\lattice.py”, line 22, in
from pymatgen.util.coord import pbc_shortest_vectors
File “D:\Anaconda3\lib\site-packages\pymatgen\util\coord.py”, line 9, in
from . import coord_cython as cuc
File “init.pxd”, line 872, in init pymatgen.util.coord_cython
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216

I would post pymatgen questions on the pymatgen forum: https://pymatgen.discourse.group/

In general for problems like this, you should also include what the version and how you installed all the referenced packages. So in this case: pymatgen, numpy, and python. The more info you provide, the easier it is for people to help you.

Hello,
Happened to me as well.
I think it occurs because you are using anaconda virtual environment but you actually use pip to download numpy.
I think you should download numpy via conda and not via pip and it would work.
Kind regards,
Volodia

1 Like