代码之家  ›  专栏  ›  技术社区  ›  user994165

Docker pip3未安装包

  •  0
  • user994165  · 技术社区  · 7 年前

    我有下面的Dockerfile和要求.txt文件。这个要求.txt似乎正在处理,但我没有看到任何输出“Installing collected packages”语句,就像我在没有Docker的系统上安装包时看到的那样。在docker构建中,我最终遇到了一个错误,上一个包在要求.txt应该已经安装了。

    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"]
    

    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—生成输出

    ...
    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
    
    1 回复  |  直到 7 年前
        1
  •  2
  •   jwodder    7 年前

    按照设计,pip在收集并构建了所有要安装的程序包之前不会安装任何程序包;这样做是为了防止安装过程中的故障导致只安装一些程序包。因此,就你而言, cython 在车轮制造完成之前不会安装 pdfparser 显然需要 赛顿 所以安装失败。你需要安装 赛顿 PDF雷达