Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "ERROR: Command errored out with exit status 1" when using pip to install numpy in Python 3.8.0

Tags:

python

pip

After upgrading Python to 3.8.0, I have trouble installing packages related to numpy using pip, including numpy, matplotlib and sklearn. The error message is as follows:

What should I do to solve this problem?

C:\WINDOWS\System32>pip install numpy

...

Installing collected packages: numpy
    Running setup.py install for numpy ... error
    ERROR: Command errored out with exit status 1:                                                                           command: 'c:\users\tonakai\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Tonakai\AppData\Local\Temp\pip-record-3pg_3uvq\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\Tonakai\AppData\Local\Temp\pip-install-ub45_c1a\numpy\
    Complete output (299 lines):
    Running from numpy source directory.

    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:

      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)

  blas_mkl_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries mkl_rt not found in ['c:\\users\\tonakai\\appdata\\local\\programs\\python\\python38\\lib', 'C:\\', 'c:\\users\\tonakai\\appdata\\local\\programs\\python\\python38\\libs']
    NOT AVAILABLE
...

c:\users\tonakai\appdata\local\programs\python\python38\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    non-existing path in 'numpy\\random': 'src\\splitmix64\\splitmix.h'
    running install
    running build
    running config_cc
    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    running config_fc
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    running build_src
    build_src
    building py_modules sources
    building library "npymath" sources
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\tonakai\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\Tonakai\\AppData\\Local\\Temp\\pip-install-ub45_c1a\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Tonakai\AppData\Local\Temp\pip-record-3pg_3uvq\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
like image 457
ZR Han Avatar asked Nov 06 '22 13:11

ZR Han


1 Answers

You need to upgrade setuptools and pip. You can do that by running:

pip install -U pip setuptools

Then you can run your pip install numpy.

like image 193
ttfreeman Avatar answered Nov 14 '22 21:11

ttfreeman