macOS Monterey - 安装Scipy出错 "找不到lapack/blas资源"

6
我已经使用brew install pyenv 在Mac上安装了pyenv。 我想运行一个需要安装scipy==1.5.4的Python项目。 我尝试使用命令pip3 install scipy==1.5.4进行安装,但是我遇到了错误No lapack/blas resources found
为了解决这个问题,我按照错误提示和其他解决方案建议运行了以下命令: brew install openblas 然后执行:
export LDFLAGS="-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/openblas/include"
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"

接下来,我进行了

brew install lapack  

随后

export LDFLAGS="-L/usr/local/opt/lapack/lib"
export CPPFLAGS="-I/usr/local/opt/lapack/include"
export PKG_CONFIG_PATH="/usr/local/opt/lapack/lib/pkgconfig"

现在我已经安装了blaslapack,但我仍然遇到类似的错误。我该如何解决?

PS

完整错误信息

    Running from SciPy source directory.
    lapack_opt_info:
    lapack_mkl_info:
    customize UnixCCompiler
      libraries mkl_rt not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE
    
    openblas_lapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE
    
    openblas_clapack_info:
    customize UnixCCompiler
    customize UnixCCompiler
      libraries openblas,lapack not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE
    
    atlas_3_10_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries tatlas,tatlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
      NOT AVAILABLE
    
    atlas_3_10_info:
    customize UnixCCompiler
      libraries satlas,satlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries satlas,satlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries satlas,satlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_3_10_info'>
      NOT AVAILABLE
    
    atlas_threads_info:
    Setting PTATLAS=ATLAS
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries ptf77blas,ptcblas,atlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_threads_info'>
      NOT AVAILABLE
    
    atlas_info:
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/local/lib
    customize UnixCCompiler
      libraries f77blas,cblas,atlas not found in /usr/lib
    customize UnixCCompiler
      libraries lapack_atlas not found in /usr/lib
    <class 'numpy.distutils.system_info.atlas_info'>
      NOT AVAILABLE
    
    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: 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()
    lapack_info:
    customize UnixCCompiler
      libraries lapack not found in ['/Users/furqan/.pyenv/versions/3.6.13/envs/venv/lib', '/usr/local/lib', '/usr/lib']
      NOT AVAILABLE
    
    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: 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
    
    /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/system_info.py:624: 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
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 583, in <module>
        setup_package()
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 579, in setup_package
        setup(**metadata)
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-build-env-n8dln98w/lib/python3.6/site-packages/numpy/distutils/core.py", line 135, in setup
        config = configuration()
      File "/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py", line 477, in configuration
        raise NotFoundError(msg)
    numpy.distutils.system_info.NotFoundError: No lapack/blas resources found. Note: Accelerate is no longer supported.
    
    ----------------------------------------
Command "/Users/furqan/.pyenv/versions/3.6.13/envs/venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-record-uy6kggfm/install-record.txt --single-version-externally-managed --compile --install-headers /Users/furqan/.pyenv/versions/3.6.13/envs/venv/include/site/python3.6/scipy" failed with error code 1 in /private/var/folders/8p/qhqd9mgj7n93g_6snx_4y9rh0000gn/T/pip-install-x19xcozn/scipy/

1
我建议您尝试使用 conda。特别是,如果您正在使用基于 Apple Silicon 的机器,您可以使用 miniforge:https://github.com/conda-forge/miniforge - foglerit
2个回答

9

当我们将一个Django应用升级到使用Python 3.8版本时,遇到了类似的问题。我们的解决方案来自于这个GitHub讨论。我们正在运行Big Sur操作系统,不确定相同的修复是否适用于您,但在运行软件包安装之前,请运行export SYSTEM_VERSION_COMPAT=1。再次说明,在您的情况下可能无法解决问题,但是对我们有效。


0

我现在正在使用 MacBookAir (M1 2020) 进行工作,这个命令对我有效:

export SYSTEM_VERSION_COMPAT=1 

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接