问题摘要
我一直在尝试构建一个docker镜像,该镜像使用诗歌命令RUN poetry install
安装依赖项
我是作为GitLab CI/CD管道的docker build
工作的一部分来做的,在自己的runner VM实例上运行它
但是,docker构建过程在使用CalledProcessError
运行poetry install
期间重复崩溃,然后在处理此错误期间使用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.seed.wheels.embed.get_embed_wheel
的virtualenv
包获取并缓存到pip
轮子的路径。看起来virtualenv
可以在poetry install
运行时更新,并且此路径无效。