python - 如何解决安装 mxnet 时出现 numpy 错误?

标签 python windows numpy mxnet

我刚刚运行默认命令在 Windows 上安装 mxnet,但弹出了此错误。我需要使用 mxnet 才能运行 Insightface 库。我想知道我做错了什么。

我做了什么:

  • 全新安装 python 3.8
  • 将我的 Python 降级到 3.6.5(不起作用)
Python:3.8.2 CUDA 工具包:10.1

我跑了:

pip install mxnet-cu101
Collecting mxnet-cu101
  Using cached mxnet_cu101-1.5.0-py2.py3-none-win_amd64.whl (385.0 MB)
Requirement already satisfied: requests<2.19.0,>=2.18.4 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from mxnet-cu101) (2.18.4)
Requirement already satisfied: graphviz<0.9.0,>=0.8.1 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from mxnet-cu101) (0.8.4)
Collecting numpy<1.17.0,>=1.8.2
  Using cached numpy-1.16.6.zip (5.1 MB)
Requirement already satisfied: idna<2.7,>=2.5 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet-cu101) (2.6)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet-cu101) (2020.12.5)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet-cu101) (1.22)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet-cu101) (3.0.4)
Building wheels for collected packages: numpy
  Building wheel for numpy (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\user\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-m6fnv3bf\\numpy_8eca072617e943b3ae46a61e83ecf95f\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-m6fnv3bf\\numpy_8eca072617e943b3ae46a61e83ecf95f\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\User\AppData\Local\Temp\pip-wheel-ve4duj2p'      
       cwd: C:\Users\User\AppData\Local\Temp\pip-install-m6fnv3bf\numpy_8eca072617e943b3ae46a61e83ecf95f\
  Complete output (264 lines):
  Running from numpy source directory.
  C:\Users\User\AppData\Local\Temp\pip-install-m6fnv3bf\numpy_8eca072617e943b3ae46a61e83ecf95f\numpy\distutils\misc_util.py:476: SyntaxWarning: "is" with a literal. Did you mean "=="?
    return is_string(s) and ('*' in s or '?' is s)
  blas_opt_info:
  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\\user\\appdata\\local\\programs\\python\\python38\\lib', 
'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python38\\libs']
    NOT AVAILABLE

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

  openblas_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries openblas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python38\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python38\\libs']
  get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
  customize GnuFCompiler
  Could not locate executable g77
  Could not locate executable f77
  customize IntelVisualFCompiler
  Could not locate executable ifort
  Could not locate executable ifl
  customize AbsoftFCompiler
  Could not locate executable f90
  customize CompaqVisualFCompiler
  Could not locate executable DF
  customize IntelItaniumVisualFCompiler
  Could not locate executable efl
  customize Gnu95FCompiler
  Could not locate executable gfortran
  Could not locate executable f95
  customize G95FCompiler
  Could not locate executable g95
  customize IntelEM64VisualFCompiler
  customize IntelEM64TFCompiler
  Could not locate executable efort
  Could not locate executable efc
  customize PGroupFlangCompiler
  Could not locate executable flang
  don't know how to compile Fortran code on platform 'nt'
    NOT AVAILABLE

  atlas_3_10_blas_threads_info:
  Setting PTATLAS=ATLAS
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries tatlas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python38\\lib', 
'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python38\\libs']
    NOT AVAILABLE

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

  atlas_blas_threads_info:
  Setting PTATLAS=ATLAS
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries ptf77blas,ptcblas,atlas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python38\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python38\\libs']
    NOT AVAILABLE

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

  accelerate_info:
    NOT AVAILABLE

  C:\Users\User\AppData\Local\Temp\pip-install-m6fnv3bf\numpy_8eca072617e943b3ae46a61e83ecf95f\numpy\distutils\system_info.py:639: UserWarning:
      Atlas (http://math-atlas.sourceforge.net/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [atlas]) or by setting
      the ATLAS environment variable.
    self.calc_info()
  blas_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries blas not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python38\\lib', 'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python38\\libs']
    NOT AVAILABLE

  C:\Users\User\AppData\Local\Temp\pip-install-m6fnv3bf\numpy_8eca072617e943b3ae46a61e83ecf95f\numpy\distutils\system_info.py:639: UserWarning:
      Blas (http://www.netlib.org/blas/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [blas]) or by setting
      the BLAS environment variable.
    self.calc_info()
  blas_src_info:
    NOT AVAILABLE

  C:\Users\User\AppData\Local\Temp\pip-install-m6fnv3bf\numpy_8eca072617e943b3ae46a61e83ecf95f\numpy\distutils\system_info.py:639: UserWarning:
      Blas (http://www.netlib.org/blas/) sources not found.
      Directories to search for the sources can be specified in the
      numpy/distutils/site.cfg file (section [blas_src]) or by setting
      the BLAS_SRC environment variable.
    self.calc_info()
    NOT AVAILABLE

  'svnversion' is not recognized as an internal or external command,
  operable program or batch file.
  non-existing path in 'numpy\\distutils': 'site.cfg'
  lapack_opt_info:
  lapack_mkl_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries mkl_rt not found in ['c:\\users\\user\\appdata\\local\\programs\\python\\python38\\lib', 
'C:\\', 'c:\\users\\user\\appdata\\local\\programs\\python\\python38\\libs']
    NOT AVAILABLE

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

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

  atlas_3_10_threads_info:
  Setting PTATLAS=ATLAS
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python38\lib       
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries tatlas,tatlas not found in c:\users\user\appdata\local\programs\python\python38\lib      
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in C:\
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries tatlas,tatlas not found in C:\
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python38\libs      
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries tatlas,tatlas not found in c:\users\user\appdata\local\programs\python\python38\libs     
  <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
    NOT AVAILABLE

  atlas_3_10_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python38\lib       
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries satlas,satlas not found in c:\users\user\appdata\local\programs\python\python38\lib      
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in C:\
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries satlas,satlas not found in C:\
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python38\libs      
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries satlas,satlas not found in c:\users\user\appdata\local\programs\python\python38\libs     
  <class 'numpy.distutils.system_info.atlas_3_10_info'>
    NOT AVAILABLE

  atlas_threads_info:
  Setting PTATLAS=ATLAS
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python38\lib       
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries ptf77blas,ptcblas,atlas not found in c:\users\user\appdata\local\programs\python\python38\lib
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in C:\
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries ptf77blas,ptcblas,atlas not found in C:\
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python38\libs      
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries ptf77blas,ptcblas,atlas not found in c:\users\user\appdata\local\programs\python\python38\libs
  <class 'numpy.distutils.system_info.atlas_threads_info'>
    NOT AVAILABLE

  atlas_info:
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python38\lib       
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries f77blas,cblas,atlas not found in c:\users\user\appdata\local\programs\python\python38\lib
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in C:\
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries f77blas,cblas,atlas not found in C:\
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries lapack_atlas not found in c:\users\user\appdata\local\programs\python\python38\libs      
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  customize MSVCCompiler
    libraries f77blas,cblas,atlas not found in c:\users\user\appdata\local\programs\python\python38\libs
  <class 'numpy.distutils.system_info.atlas_info'>
    NOT AVAILABLE

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

  C:\Users\User\AppData\Local\Temp\pip-install-m6fnv3bf\numpy_8eca072617e943b3ae46a61e83ecf95f\numpy\distutils\system_info.py:639: UserWarning:
      Lapack (http://www.netlib.org/lapack/) libraries not found.
      Directories to search for the libraries can be specified in the
      numpy/distutils/site.cfg file (section [lapack]) or by setting
      the LAPACK environment variable.
    self.calc_info()
  lapack_src_info:
    NOT AVAILABLE

  C:\Users\User\AppData\Local\Temp\pip-install-m6fnv3bf\numpy_8eca072617e943b3ae46a61e83ecf95f\numpy\distutils\system_info.py:639: UserWarning:
      Lapack (http://www.netlib.org/lapack/) sources not found.
      Directories to search for the sources can be specified in the
      numpy/distutils/site.cfg file (section [lapack_src]) or by setting
      the LAPACK_SRC environment variable.
    self.calc_info()
    NOT AVAILABLE

  c:\users\user\appdata\local\programs\python\python38\lib\distutils\dist.py:274: UserWarning: Unknown 
distribution option: 'define_macros'
    warnings.warn(msg)
  running bdist_wheel
  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
  creating build
  creating build\src.win-amd64-3.8
  creating build\src.win-amd64-3.8\numpy
  creating build\src.win-amd64-3.8\numpy\distutils
  building library "npymath" sources
  No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
  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/
  ----------------------------------------
  ERROR: Failed building wheel for numpy
  Running setup.py clean for numpy
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\user\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-m6fnv3bf\\numpy_8eca072617e943b3ae46a61e83ecf95f\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-m6fnv3bf\\numpy_8eca072617e943b3ae46a61e83ecf95f\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
       cwd: C:\Users\User\AppData\Local\Temp\pip-install-m6fnv3bf\numpy_8eca072617e943b3ae46a61e83ecf95f
  Complete output (10 lines):
  Running from numpy source directory.

  `setup.py clean` is not supported, use one of the following instead:

    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)

  Add `--force` to your command to use it anyway if you must (unsupported).

  ----------------------------------------
  ERROR: Failed cleaning build dir for numpy
Failed to build numpy

最佳答案

我也遇到过和你类似的问题。我的原因是我卸载了 anaconda 但不清楚。我的 anaconda 环境很困惑。软件包安装在其他地方。所以我的解决办法就是明确卸载然后重新安装。有一个清理anaconda的包,你可以google一下。

如果手动卸载anaconda,还需要卸载python。 也许你也可以创建一个新的 anaconda 环境。它可能会有所帮助

关于python - 如何解决安装 mxnet 时出现 numpy 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65325177/

相关文章:

python - 如何确定矩阵在 python-numpy 中是否是奇异的?

python - 数据帧转换后保留标题

python - python 对单个图像的非负矩阵分解

python - mypy 给出错误,类型不兼容 "Optional[int]";预期“Union[SupportsFloat、str、bytes、bytearray]

python - 请求模块中的数据有效负载?

python - 使用 Flask 提供变化的文件

python - 如何在 Anaconda 中将 python 2.7.8 升级到 2.7.9 而不会与其环境中的其他组件发生冲突?

python - PANDAS Quantiles 根据我们的提问方式给出不同的答案

windows - 从 PHPmyadmin 从 Windows 到 Mac 的数据库

c# - "Correct"与本地 Windows 服务通信的方式