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

6

我正在尝试在python:3.8-alpine3.11中安装scipy,但是会出现"No lapack/blas resources found."的错误。在alpien3.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'

构建 wheel 所需的要求:开始 构建 wheel 所需的要求:已完成,状态为 'done' 准备 wheel 元数据:开始 准备 wheel 元数据:已完成,状态为 '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 当前工作目录:/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。


请调整代码格式,同时您的帖子似乎大部分都是代码,请添加更多细节。 - Vaibhav Sharma
1个回答

8

后来我使用了apk add py3-scipy,它起作用了。

pip install scipy在alpine上出现错误,因为缺少lapack包。而py3-scipy安装时会安装所有依赖的包。


1
我必须执行 RUN apk add --no-cache --update-cache gfortran build-base wget libpng-dev openblas-dev,然后再执行 apk add py3-scipy 才能使其正常工作。 - shadow

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