There was an error installing pymatgen on Windows 10

There was an error installing pymatgen on Windows 10.
I installed pymatgen in anaconda in Python version 3.11.
But when I was installing pymatgen, it seemed like some compilation modules related to C++were missing, so there were errors during the installation process.
Here are the errors that occurred during compilation:

      Compiling pymatgen/optimization/linear_assignment.pyx because it changed.
      [1/1] Cythonizing pymatgen/optimization/linear_assignment.pyx
      building 'pymatgen.optimization.linear_assignment' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pymatgen
Failed to build pymatgen
ERROR: Could not build wheels for pymatgen, which is required to install pyproject.toml-based projects
WARNING: There was an error checking the latest version of pip.

Does this error affect the final operation of pymatgen?

Hi @Xuetian_Li, yes as it doesn’t look like you were ultimately able to install pymatgen (see ERROR: Failed building wheel for pymatgen. Failed to build pymatgen).

Were you installing from conda, pip, or git? If you install with pip (pip install pymatgen), there are pre-built wheels on PyPI (no compilation needed on your side).

1 Like

Hi @Aaron_Kaplan , I installed it using pip. I repeated it several times, but the same phenomenon still appears.

You may just need to install the C++ compiler recommended by pip, see this stack exchange answer for a guide.

Okay, thank you for your help.