scipy (setup.py) 的构建轮:已完成,状态为 'error'

Building wheel for scipy (setup.py): finished with status 'error'

我正在尝试构建 Docker 映像并使用 requirements.txt 文件安装这些要求:

numpy==1.18.1
scipy==1.2.1
joblib==0.13.2
Cython==0.29.13
pandas==0.25.3
scikit-learn==0.21.3
h5py==2.8.0
Keras==2.3.1
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0

这是我的 dockerfile:

FROM python:3

MAINTAINER author@sample.com

RUN mkdir /test
COPY ./ /test
WORKDIR /test

## Install your dependencies here using apt-get etc.


RUN pip install -r requirements.txt

当我尝试构建时,这是我收到的错误消息

ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d0v5nn_0/scipy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d0v5nn_0/scipy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-u8mo7l4r
       cwd: /tmp/pip-install-d0v5nn_0/scipy/
  Complete output (9 lines):
  /tmp/pip-install-d0v5nn_0/scipy/setup.py:114: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-d0v5nn_0/scipy/setup.py", line 492, in <module>
      setup_package()
    File "/tmp/pip-install-d0v5nn_0/scipy/setup.py", line 468, in setup_package
      from numpy.distutils.core import setup
  ModuleNotFoundError: No module named 'numpy'
  ----------------------------------------
  ERROR: Failed building wheel for scipy

在此之后它还尝试 运行 一个

Running setup.py clean for scipy

但没有成功

不确定这是否是错误的原因,但考虑到 release notes of Numpy 1.18.1,您应该让 Cython ≥ 0.29.14 而 requirements.txt 指定 Cython==0.29.13

FROM python:3 结果得到 Python 3.8.

The Python versions supported in this release are 3.5-3.8. Downstream developers should use Cython >= 0.29.14 for Python 3.8 support and OpenBLAS >= 3.7 to avoid errors on the Skylake architecture.