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

Error installing scipy in Python 3.10 on Windows10

我已经在 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 .....

scipy's PyPI page 中,看起来 scipy 不支持 3.10,正如 meta 所说

Requires: Python >=3.7, <3.10

我也看了他们的 GitHub,python 3.10

似乎没有 scipy

scipy Github about this issue. Seems the root cause is there is no universal wheel file available for this release yet, but there is another open issue on Github 上还有一个未解决的问题也可以解决该问题。好消息是 scipy==1.7.2 确实支持 python 3.10 已经测试过了所以祈祷这周会有解决方案!