Scipy python:3.8-alpine3.11 中的错误 - 未找到 lapack/blas 资源

Scipy error in python:3.8-alpine3.11 - No lapack/blas resources found

我正在尝试在 python:3.8-alpine3.11 中安装 scipy,但得到 "No lapack/blas resources found." 它工作正常阿尔皮恩3.10。

Below are the logs:



Step 5/28 : RUN    pip3 install numpy==1.14.3
 ---> Using cache
 ---> f77d037c9008
Step 6/28 : RUN    pip3 install scipy==1.3.1
 ---> Running in 86d118b54acc
Looking in indexes: simple
Collecting scipy==1.3.1
  Downloading scipy-1.3.1.tar.gz (23.6 MB)
  Installing build dependencies: started
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: still running...
  Installing build dependencies: finished with status 'done'

获取构建轮子的要求:已开始 获取构建轮子的要求:完成状态 'done' 准备车轮元数据:开始 准备车轮元数据:完成状态 'error' 错误:命令出错,退出状态为 1: 命令:/usr/bin/python3.8 /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp1qlw5c3z cwd: /tmp/pip-install-cz2mzto6/scipy 完整输出(150 行): lapack_opt_info: lapack_mkl_info: 自定义 UnixCCompiler 在 ['/usr/local/lib'、'/usr/lib'、'/usr/lib/'] 中找不到库 mkl_rt 不可用

openblas_lapack_info:
customize UnixCCompiler
customize UnixCCompiler
customize UnixCCompiler
C compiler: gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC

creating /tmp/tmphgxupjii/tmp
creating /tmp/tmphgxupjii/tmp/tmphgxupjii
compile options: '-c'
gcc: /tmp/tmphgxupjii/source.c
gcc /tmp/tmphgxupjii/tmp/tmphgxupjii/source.o -L/usr/lib -lopenblas -o /tmp/tmphgxupjii/a.out
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/tmphgxupjii/tmp/tmphgxupjii/source.o: in function `main':
/tmp/tmphgxupjii/source.c:4: undefined reference to `zungqr_'
collect2: error: ld returned 1 exit status
/usr/lib/gcc/x86_64-alpine-linux-musl/9.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/tmphgxupjii/tmp/tmphgxupjii/source.o: in function `main':
/tmp/tmphgxupjii/source.c:4: undefined reference to `zungqr_'
collect2: error: ld returned 1 exit status
  NOT AVAILABLE

openblas_clapack_info:
customize UnixCCompiler
customize UnixCCompiler
  libraries openblas,lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
  NOT AVAILABLE

atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
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
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 /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
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 /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
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 /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
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

lapack_info:
customize UnixCCompiler
  libraries lapack not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/']
  NOT AVAILABLE

lapack_src_info:
  NOT AVAILABLE

  NOT AVAILABLE

setup.py:386: UserWarning: Unrecognized setuptools command ('dist_info --egg-base /tmp/pip-modern-metadata-oeuez3h_'), proceeding with generating Cython sources and expanding templates
  warnings.warn("Unrecognized setuptools command ('{}'), proceeding with "
Running from scipy source directory.
/tmp/pip-build-env-h5qyzy7s/overlay/lib/python3.8/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()
/tmp/pip-build-env-h5qyzy7s/overlay/lib/python3.8/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()
/tmp/pip-build-env-h5qyzy7s/overlay/lib/python3.8/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()
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
    main()
  File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 110, in prepare_metadata_for_build_wheel
    return hook(metadata_directory, config_settings)
  File "/tmp/pip-build-env-h5qyzy7s/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 156, in prepare_metadata_for_build_wheel
    self.run_setup()
  File "/tmp/pip-build-env-h5qyzy7s/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 242, in run_setup
    super(_BuildMetaLegacyBackend,
  File "/tmp/pip-build-env-h5qyzy7s/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 142, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 505, in <module>
    setup_package()
  File "setup.py", line 501, in setup_package
    setup(**metadata)
  File "/tmp/pip-build-env-h5qyzy7s/overlay/lib/python3.8/site-packages/numpy/distutils/core.py", line 135, in setup
    config = configuration()
  File "setup.py", line 403, in configuration
    raise NotFoundError(msg)
numpy.distutils.system_info.NotFoundError: No lapack/blas resources found.
----------------------------------------

错误:命令出错,退出状态为 1:/usr/bin/python3.8 /usr/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp1qlw5c3z 检查日志完整的命令输出。 命令“/bin/sh -c pip3 install scipy==1.3.1”返回了一个非零代码:1

后来用了apk add py3-scipy,成功了

pip install scipy 由于缺少 lapack 包而在 alpine 中抛出错误。 py3-scipy 安装所有依赖包。