繁体   English   中英

Docker pip3未安装软件包

[英]Docker pip3 not installing packages

我有以下Dockerfile和requirements.txt文件。 requirements.txt似乎正在处理中,但是没有看到任何输出“正在安装收集的软件包”的语句,就像我在没有Docker的系统上安装软件包时看到的那样。 在docker build中,我最终遇到一个错误,该错误是应已安装requirements.txt中的先前软件包。

Docker文件

FROM alpine:3.8
ADD . /code
RUN apk add alpine-sdk python3-dev
WORKDIR /code
RUN sudo apk update
RUN pip3 install --trusted-host pypi.python.org -r requirements.txt
CMD ["python3", "linqcmd"]

requirements.txt

boto3
click
python-levenshtein
python-dateutil
cython
# pip3 install git+https://github.com/izderadicka/pdfparser
-e git://github.com/izderadicka/pdfparser.git#egg=pdfparser

docker-compose up --build输出

...
Step 6/7 : RUN pip3 install --trusted-host pypi.python.org -r requirements.txt
 ---> Running in 515dd716aa7c
Collecting boto3 (from -r requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/a8/45/810f786ce144bfd19d9f2f700a8cd4358435559a2b88b2c235f7bb3f29df/boto3-1.8.6-py2.py3-none-any.whl (128kB)
Collecting click (from -r requirements.txt (line 5))
  Downloading https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl (71kB)
Collecting python-levenshtein (from -r requirements.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/42/a9/d1785c85ebf9b7dfacd08938dd028209c34a0ea3b1bcdb895208bd40a67d/python-Levenshtein-0.12.0.tar.gz (48kB)
Collecting python-dateutil (from -r requirements.txt (line 7))
  Downloading https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl (211kB)
Collecting cython (from -r requirements.txt (line 8))
  Downloading https://files.pythonhosted.org/packages/21/89/ca320e5b45d381ae0df74c4b5694f1471c1b2453c5eb4bac3449f5970481/Cython-0.28.5.tar.gz (1.9MB)
Obtaining pdfparser from git+git://github.com/izderadicka/pdfparser.git#egg=pdfparser (from -r requirements.txt (line 10))
  Cloning git://github.com/izderadicka/pdfparser.git to ./src/pdfparser
    Complete output from command python setup.py egg_info:
    You need to install cython first - sudo pip install cython

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /code/src/pdfparser/
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Service 'web' failed to build: The command '/bin/sh -c pip3 install --trusted-host pypi.python.org -r requirements.txt' returned a non-zero code: 1

根据设计,pip不会收集任何软件包,直到将其收集起来并为所有要安装的轮子构建好轮子为止。 这样做是为了防止安装过程中的失败导致仅安装某些软件包。 因此,在你的情况下, cython不会被前车轮专为安装pdfparser ,这显然需要cython ,以建立,因此安装失败。 您需要在两个单独的步骤中安装cythonpdfparser

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM