[英]Poetry install fails during docker build with CalledProcessError and EnvCommandError
我一直在尝试构建一个 docker 映像,该映像使用诗歌命令RUN poetry install
安装依赖项。
我将其作为 GitLab CI/CD 管道的docker build
作业的一部分,在自己的运行器 VM 实例上运行。
但是,docker 构建过程在poetry install
运行期间反复崩溃并出现CalledProcessError
,然后在处理此错误期间出现EnvCommandError
和PoetryException
错误。
几个示例错误如下:
CalledProcessError
Command '['/home/ray/anaconda3/bin/python', '/home/ray/anaconda3/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl/pip', 'install', '--disable-pip-version-check', '--prefix', '/home/ray/anaconda3', '--no-deps', '/home/ray/.cache/pypoetry/artifacts/a8/b9/10/d38e9304d486f9398ab4163054bd6af79c74073ad8685d6cc67f88eccc/Werkzeug-2.2.2-py3-none-any.whl']' returned non-zero exit status 1.
然后
EnvCommandError
Command ['/home/ray/anaconda3/bin/python', '/home/ray/anaconda3/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl/pip', 'install', '--disable-pip-version-check', '--prefix', '/home/ray/anaconda3', '--no-deps', '/home/ray/.cache/pypoetry/artifacts/a8/b9/10/d38e9304d486f9398ab4163054bd6af79c74073ad8685d6cc67f88eccc/Werkzeug-2.2.2-py3-none-any.whl'] errored with the following return code 1, and output:
WARNING: Ignoring invalid distribution -irtualenv (/home/ray/anaconda3/lib/python3.9/site-packages)
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/home/ray/anaconda3/lib/python3.9/site-packages/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl'
然后还有PoetryException
错误:
PoetryException
Failed to install /home/ray/.cache/pypoetry/artifacts/a8/b9/10/d38e9304d486f9398ab4163054bd6af79c74073ad8685d6cc67f88eccc/Werkzeug-2.2.2-py3-none-any.whl
at anaconda3/lib/python3.9/site-packages/poetry/utils/pip.py:55 in pip_install
Werkzeug-2.2.2
(上面列出)和torch-1.11.0
(未列出到备用空间)发生了同样的一系列错误。
我尝试了以下但没有成功:
pip cache purge
添加到我的 docker 文件或在构建 docker 映像之前,按照此处所述清理 PyPI 缓存。/home/ray/.cache/pypoetry/artifacts/a8/b9/10/d38e9304d486f9398ab4163054bd6af79c74073ad8685d6cc67f88eccc/Werkzeug-2.2.2-py3-none-any.whl
。 所以我不明白如何删除它们。如果需要,我可以分享 docker 文件。
我将不胜感激任何帮助!
RUN pip install -U pip virtualenv
Poetry 从virtualenv
package 和virtualenv.seed.wheels.embed.get_embed_wheel
启动时获取并缓存pip
轮的路径。 看起来virtualenv
可以在poetry install
运行时更新,并且此路径变得无效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.