繁体   English   中英

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

[英]how to solve numpy error while installing mxnet?

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

我做了什么:

  • 全新安装 python 3.8
  • 将我的 python 降级到 3.6.5(不起作用)

Python:3.8.2 CUDA 工具包:10.1

我运行: pip 安装 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 环境很乱。 软件包安装在其他地方。 所以我的解决方案是清楚地卸载它然后重新安装它。 有一个 package 来清理 anaconda,你可以谷歌它。

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

似乎它试图构建 numpy package。 解决方法是首先使用 conda 安装它并指定错误消息的版本,此处为 1.16.6:

conda install numpy=1.16.6

然后你可以再次输入:

pip install mxnet-cu101

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM