在 Windows10 上的 Python 3.10 中安装 scipy 时出错

Posted

技术标签:

【中文标题】在 Windows10 上的 Python 3.10 中安装 scipy 时出错【英文标题】:Error installing scipy in Python 3.10 on Windows10 【发布时间】:2021-12-15 14:42:58 【问题描述】:

我已经在 Windows 10 上安装了 Python 3.10。

然后我安装了 numpy 和 matplotlib 没有问题。

但是当我尝试安装 scipy 时,我得到了很多错误。

安装顺序如下。

这与需要 MKL/BLAS 库有关吗?如果是这样,我应该安装什么?

Microsoft Windows [Version 10.0.19043.1288]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Madeleine>echo %PATH%
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\TortoiseSVN\bin;C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\;C:\Users\Madeleine\AppData\Local\Microsoft\WindowsApps;C:\Users\Madeleine\AppData\Local\Programs\Git\cmd;C:\Users\Madeleine\AppData\Local\Programs\Python\Python310;C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts;

C:\Users\Madeleine>cd AppData

C:\Users\Madeleine\AppData>
C:\Users\Madeleine\AppData>
C:\Users\Madeleine\AppData>cd Local

C:\Users\Madeleine\AppData\Local>cd Programs

C:\Users\Madeleine\AppData\Local\Programs>cd Python

C:\Users\Madeleine\AppData\Local\Programs\Python>cd Python310

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310>cd Scripts

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts>
C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts>pip3.exe install numpy
Collecting numpy
  Using cached numpy-1.21.3-cp310-cp310-win_amd64.whl (14.0 MB)
Installing collected packages: numpy
Successfully installed numpy-1.21.3
WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts>cd ..

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310>python.exe -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\mattuser\appdata\local\programs\python\python310\lib\site-packages (21.2.3)
Collecting pip
  Using cached pip-21.3.1-py3-none-any.whl (1.7 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.2.3
    Uninstalling pip-21.2.3:
      Successfully uninstalled pip-21.2.3
Successfully installed pip-21.3.1

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310>cd Scripts

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts>cd ..

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310>cd Scripts

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts>pip3.exe install numpy
Requirement already satisfied: numpy in c:\users\mattuser\appdata\local\programs\python\python310\lib\site-packages (1.21.3)

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts>pip3.exe install matplotlib
Collecting matplotlib
  Using cached matplotlib-3.4.3.tar.gz (37.9 MB)
  Preparing metadata (setup.py) ... done
Collecting cycler>=0.10
  Using cached cycler-0.11.0-py3-none-any.whl (6.4 kB)
Collecting kiwisolver>=1.0.1
  Using cached kiwisolver-1.3.2-cp310-cp310-win_amd64.whl (52 kB)
Requirement already satisfied: numpy>=1.16 in c:\users\mattuser\appdata\local\programs\python\python310\lib\site-packages (from matplotlib) (1.21.3)
Collecting pillow>=6.2.0
  Using cached Pillow-8.4.0-cp310-cp310-win_amd64.whl (3.2 MB)
Collecting pyparsing>=2.2.1
  Using cached pyparsing-3.0.4-py3-none-any.whl (96 kB)
Collecting python-dateutil>=2.7
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Using legacy 'setup.py install' for matplotlib, since package 'wheel' is not installed.
Installing collected packages: six, python-dateutil, pyparsing, pillow, kiwisolver, cycler, matplotlib
    Running setup.py install for matplotlib ... done
Successfully installed cycler-0.11.0 kiwisolver-1.3.2 matplotlib-3.4.3 pillow-8.4.0 pyparsing-3.0.4 python-dateutil-2.8.2 six-1.16.0

C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\Scripts>pip3.exe install scipy
Collecting scipy
  Using cached scipy-1.6.1.tar.gz (27.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Madeleine\AppData\Local\Temp\tmp47167bak'
       cwd: C:\Users\Madeleine\AppData\Local\Temp\pip-install-vwpw8nym\scipy_a546785b9a2e47e186898eb2d288e51b
  Complete output (138 lines):
  setup.py:461: UserWarning: Unrecognized setuptools command ('dist_info --egg-base C:\Users\Madeleine\AppData\Local\Temp\pip-modern-metadata-hczr1_to'), proceeding with generating Cython sources and expanding templates
    warnings.warn("Unrecognized setuptools command (''), proceeding with "
  Running from SciPy source directory.
  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\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\lib', 'C:\\', 'C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\libs']
    NOT AVAILABLE

  openblas_lapack_info:
    libraries openblas not found in ['C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\lib', 'C:\\', 'C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\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

  openblas_clapack_info:
    libraries openblas,lapack not found in ['C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\lib', 'C:\\', 'C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\libs']
    NOT AVAILABLE

  flame_info:
    libraries flame not found in ['C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\lib', 'C:\\', 'C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\libs']
    NOT AVAILABLE

  accelerate_info:
    NOT AVAILABLE

  atlas_3_10_threads_info:
  Setting PTATLAS=ATLAS
    libraries lapack_atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib
    libraries tatlas,tatlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib
    libraries lapack_atlas not found in C:\
    libraries tatlas,tatlas not found in C:\
    libraries lapack_atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\libs
    libraries tatlas,tatlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\libs
  <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
    NOT AVAILABLE

  atlas_3_10_info:
    libraries lapack_atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib
    libraries satlas,satlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib
    libraries lapack_atlas not found in C:\
    libraries satlas,satlas not found in C:\
    libraries lapack_atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\libs
    libraries satlas,satlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\libs
  <class 'numpy.distutils.system_info.atlas_3_10_info'>
    NOT AVAILABLE

  atlas_threads_info:
  Setting PTATLAS=ATLAS
    libraries lapack_atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib
    libraries ptf77blas,ptcblas,atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib
    libraries lapack_atlas not found in C:\
    libraries ptf77blas,ptcblas,atlas not found in C:\
    libraries lapack_atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\libs
    libraries ptf77blas,ptcblas,atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\libs
  <class 'numpy.distutils.system_info.atlas_threads_info'>
    NOT AVAILABLE

  atlas_info:
    libraries lapack_atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib
    libraries f77blas,cblas,atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib
    libraries lapack_atlas not found in C:\
    libraries f77blas,cblas,atlas not found in C:\
    libraries lapack_atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\libs
    libraries f77blas,cblas,atlas not found in C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\libs
  <class 'numpy.distutils.system_info.atlas_info'>
    NOT AVAILABLE

  lapack_info:
    libraries lapack not found in ['C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\lib', 'C:\\', 'C:\\Users\\Madeleine\\AppData\\Local\\Programs\\Python\\Python310\\libs']
    NOT AVAILABLE

  C:\Users\Madeleine\AppData\Local\Temp\pip-build-env-a8sdi_lt\overlay\Lib\site-packages\numpy\distutils\system_info.py:1858: 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.
    return getattr(self, '_calc_info_'.format(name))()
  lapack_src_info:
    NOT AVAILABLE

  C:\Users\Madeleine\AppData\Local\Temp\pip-build-env-a8sdi_lt\overlay\Lib\site-packages\numpy\distutils\system_info.py:1858: 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.
    return getattr(self, '_calc_info_'.format(name))()
    NOT AVAILABLE

  Traceback (most recent call last):
    File "C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 363, in <module>
      main()
    File "C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 164, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "C:\Users\Madeleine\AppData\Local\Temp\pip-build-env-a8sdi_lt\overlay\Lib\site-packages\setuptools\build_meta.py", line 161, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "C:\Users\Madeleine\AppData\Local\Temp\pip-build-env-a8sdi_lt\overlay\Lib\site-packages\setuptools\build_meta.py", line 253, in run_setup
      super(_BuildMetaLegacyBackend,
    File "C:\Users\Madeleine\AppData\Local\Temp\pip-build-env-a8sdi_lt\overlay\Lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 588, in <module>
      setup_package()
    File "setup.py", line 584, in setup_package
      setup(**metadata)
    File "C:\Users\Madeleine\AppData\Local\Temp\pip-build-env-a8sdi_lt\overlay\Lib\site-packages\numpy\distutils\core.py", line 135, in setup
      config = configuration()
    File "setup.py", line 499, in configuration
      raise NotFoundError(msg)
  numpy.distutils.system_info.NotFoundError: No BLAS/LAPACK libraries found.
  To build Scipy from sources, BLAS & LAPACK libraries need to be installed.
  See site.cfg.example in the Scipy source directory and
  https://docs.scipy.org/doc/scipy/reference/building/index.html for details.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/26/68/84dbe18583e79e56e4cee8d00232a8dd7d4ae33bc3acf3be1c347991848f/scipy-1.6.1.tar.gz#sha256=c4fceb864890b6168e79b0e714c585dbe2fd4222768ee90bc1aa0f8218691b11 (from https://pypi.org/simple/scipy/) (requires-python:>=3.7). Command errored out with exit status 1: 'C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\python.exe' 'C:\Users\Madeleine\AppData\Local\Programs\Python\Python310\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Madeleine\AppData\Local\Temp\tmp47167bak' Check the logs for full command output.
  Using cached scipy-1.6.0.tar.gz (27.3 MB)


..... many more similar errors .....

【问题讨论】:

【参考方案1】:

在scipy's PyPI page 中,看起来 scipy 不支持元数据所说的 3.10

Requires: Python >=3.7, <3.10

我还查看了他们的 GitHub,似乎没有适用于 python 3.10 的 scipy

【讨论】:

这是真的!我成功卸载了3.10,安装了3.9.7,scipy安装就好了。谢谢! 不客气。请将此答案标记为正确,因为它解决了您的问题。 是的,对不起,我升级了,然后忘记将其标记为正确。现在完成。【参考方案2】:

scipy Github 上有一个关于此问题的未解决问题。似乎根本原因是此版本还没有可用的通用轮文件,但Github 上还有另一个未解决的问题来解决这个问题。好消息是 scipy==1.7.2 确实支持 python 3.10 已经过测试,所以祈祷本周会有一个解决方案!

【讨论】:

以上是关于在 Windows10 上的 Python 3.10 中安装 scipy 时出错的主要内容,如果未能解决你的问题,请参考以下文章

无法在 Windows 10 上的 python 3.6 64 位上运行 pyqt5(没有 anaconda 没有 virtualenv)

无法加载原生 TensorFlow 运行时。 Windows 10 上的 Python 3.6

Windows 10 和 Spyder 上的 Python 错误 [SSL: CERTIFICATE_VERIFY_FAILED]

pymysql.connect 命令使 Windows 上的 python shell 崩溃

Windows 10 和 Linux Ubuntu 16.04 在运行时间上的巨大差异,用于 ExtraTreesClassifier 训练和预测 (Python)

Windows 10 上的 anaconda cythonize C++