Installation problem: Building wheel for spglib (PEP 517) ... error

Building wheels for collected packages: spglib
Building wheel for spglib (PEP 517) … error
ERROR: Command errored out with exit status 1:
command: ‘C:\ProgramData\Anaconda3\python.exe’ ‘C:\ProgramData\Anaconda3\lib\site-packages\pip_vendor\’ build_wheel ‘C:\Users\luyan\AppData\Local\Temp\tmpqxqs2btk’
cwd: C:\Users\luyan\AppData\Local\Temp\pip-install-95kf2kew\spglib
Complete output (12 lines):
setuptools is used.
running bdist_wheel
running build
running build_py
creating build
creating build\
creating build\\spglib
copying spglib\ → build\\spglib
copying → build\\spglib
running build_ext
building ‘spglib._spglib’ extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with “Microsoft C++ Build Tools”: Microsoft C++ Build Tools - Visual Studio

ERROR: Failed building wheel for spglib
Failed to build spglib
ERROR: Could not build wheels for spglib which use PEP 517 and cannot be installed directly

I guess this problem is due to the uninstalled “Microsoft C++ Build Tools - Visual Studio” your computer.
I have solved this problem in the following way every time.

  1. Go to visual studio downloads at Download Visual Studio 2019 for Windows & Mac
  2. Scroll down to ‘All Downloads’
  3. Click the doprdown for ‘Tools for Visual Studio 2019’
  4. Download 'Build Toolds for Visual Studio 2019
  5. Install Build Tools Visual C++
  6. Reboot compute and pip install automatminer

Another option I would recommend is installing pymatgen with anaconda. If you have Anaconda on your PC, do this by calling conda install -c conda-forge pymatgen