生成Docker imag时在pip安装期间发生CondaValueError

2024-09-30 16:21:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图从一个Python项目中构建一个Docker映像,该项目使用一个使用conda构建的环境。这是我当前的Dockerfile:

FROM continuumio/miniconda

SHELL ["/bin/bash", "-c"]

ADD . /service

WORKDIR /service

RUN conda env create -n my-env -f=environment.yml

RUN python setup.py develop

RUN source activate my-env

WORKDIR src

CMD ["python", "app.py"]

在尝试从environment.yamlpip部分下载大型依赖项后,conda env create期间生成失败:

^{pr2}$

我也尝试过从Ubuntu映像构建映像,并在其上手动安装conda,指定conda的版本以匹配我在本地运行的版本,但在同一个地方仍然失败。环境构建在本地(在Mac上)运行时运行良好。在

知道是什么问题吗?(或者至少如果我能看到比pip returned an error更详细的错误消息)

编辑-以下是更详细的日志:

Step 5/9 : RUN conda env create -n ppm -f=environment.yml
 ---> Running in 2956e595fa1d
Solving environment: ...working... done
pip-9.0.1            | 1.6 MB    | ########## | 100% 
wheel-0.29.0         | 81 KB     | ########## | 100% 
setuptools-36.4.0    | 557 KB    | ########## | 100% 
python-2.7.13        | 11.5 MB   | ########## | 100% 
zlib-1.2.11          | 109 KB    | ########## | 100% 
readline-6.2         | 606 KB    | ########## | 100% 
libpq-9.5.4          | 93 KB     | ########## | 100% 
openssl-1.0.2l       | 3.2 MB    | ########## | 100% 
tk-8.5.18            | 1.9 MB    | ########## | 100% 
certifi-2016.2.28    | 211 KB    | ########## | 100% 
sqlite-3.13.0        | 4.0 MB    | ########## | 100% 
psycopg2-2.7.1       | 435 KB    | ########## | 100% 

Downloading and Extracting Packages
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
Collecting chardet==3.0.4 (from -r /service/condaenv.FWKDwj.requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
Collecting click==6.7 (from -r /service/condaenv.FWKDwj.requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl (71kB)
Collecting dill==0.2.8.2 (from -r /service/condaenv.FWKDwj.requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/6f/78/8b96476f4ae426db71c6e86a8e6a81407f015b34547e442291cd397b18f3/dill-0.2.8.2.tar.gz (150kB)
Collecting flask==1.0.2 (from -r /service/condaenv.FWKDwj.requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl (91kB)
Collecting icc-rt==2018.0.3 (from -r /service/condaenv.FWKDwj.requirements.txt (line 5))
  Downloading https://files.pythonhosted.org/packages/84/32/15087ef76af6bb54d008e10bf7a425ce84140bc20b06f491faf212c08b47/icc_rt-2018.0.3-py2.py3-none-manylinux1_x86_64.whl (12.0MB)
Collecting idna==2.6 (from -r /service/condaenv.FWKDwj.requirements.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl (56kB)
Collecting intel-numpy==1.14.3 (from -r /service/condaenv.FWKDwj.requirements.txt (line 7))
  Downloading https://files.pythonhosted.org/packages/b4/12/c058933174b68a293be75adc38eb25ca812161b060e251569ccb0a4b1d87/intel_numpy-1.14.3-cp27-cp27mu-manylinux1_x86_64.whl (6.0MB)
Collecting intel-openmp==2018.0.3 (from -r /service/condaenv.FWKDwj.requirements.txt (line 8))
  Downloading https://files.pythonhosted.org/packages/8d/1f/9080b1e64054de729bd93953a65029f3cf1b2606125f8b63da21f0583797/intel_openmp-2018.0.3-py2.py3-none-manylinux1_x86_64.whl (714kB)
Collecting itsdangerous==0.24 (from -r /service/condaenv.FWKDwj.requirements.txt (line 9))
  Downloading https://files.pythonhosted.org/packages/dc/b4/a60bcdba945c00f6d608d8975131ab3f25b22f2bcfe1dab221165194b2d4/itsdangerous-0.24.tar.gz (46kB)
Collecting jinja2==2.10 (from -r /service/condaenv.FWKDwj.requirements.txt (line 10))
  Downloading https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl (126kB)
Collecting markupsafe==1.0 (from -r /service/condaenv.FWKDwj.requirements.txt (line 11))
  Downloading https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz
Collecting mkl==2018.0.3 (from -r /service/condaenv.FWKDwj.requirements.txt (line 12))
  Downloading https://files.pythonhosted.org/packages/42/65/a761991d954021ce8dbf70fcb7dd52bc8e0c2cd330b6a8c7de5580582483/mkl-2018.0.3-py2.py3-none-manylinux1_x86_64.whl (269.2MB)

CondaValueError: pip returned an error

The command '/bin/bash -c conda env create -n ppm -f=environment.yml' returned a non-zero code: 1

Tags: fromhttpsorgtxtpackagesservicelinefiles