我正在尝试构建一个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
但没有成功
答案 0 :(得分:1)
不确定是不是错误的原因,但考虑到release notes of Numpy 1.18.1,您应该使Cython≥0.29.14,而requirements.txt
指定Cython==0.29.13
。
FROM python:3
可获取Python 3.8。
此版本中支持的Python版本为3.5-3.8。下游 开发人员应使用Cython> = 0.29.14获得Python 3.8支持,并且 OpenBLAS> = 3.7,以避免Skylake体系结构上的错误。