numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216

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

What is the problem, thx

Reinstall pymatgen using pip install pymatgen

Hi, I met this problem as well. It seems a version problem. I haven’t solved this in a direct way. But you could try this in your code:
try:
import pymatgen
except:
import pymatgen

This could make it looks like nothing happened.

This is usually an issue with the installing of numpy either via pip or conda. If you used conda, I suggest you simply do a pip install numpy pymatgen --upgrade --force and see if that solves your problem.