【问题标题】:Poetry install fails with EnvCommandError: looks for version 2020.12.21.3-lambda, why?诗歌安装失败并出现 EnvCommandError:查找版本 2020.12.21.3-lambda,为什么?
【发布时间】:2021-01-18 23:17:58
【问题描述】:

诗歌无法完成任何installadd 而不抛出EnvCommandError 与无法为soupsieve 找到setup.py 有关。

它查找版本“2020.12.21.3-lambda”,但我不明白为什么它不像其他依赖项那样从具有正常版本的远程源加载依赖项。

$ poetry update
Updating dependencies
Resolving dependencies... (54.1s)

Writing lock file

Package operations: 59 installs, 0 updates, 0 removals

  • Installing soupsieve (2020.12.21.3-lambda): Failed

  EnvCommandError

  Command ['/home/git/my-project/.venv/bin/pip', 'install', '--no-deps', 'file:///home/Library/Caches/pypoetry/artifacts/22/36/ca/c8aae41f80011be881aa337cc80abc25ffd8542471c325e4410afa86c8/authorities-deployer-2020.12.21.3-lambda.zip'] errored with the following return code 1, and output: 
 Looking in indexes: ... # censored proxy
  Processing /home/Library/Caches/pypoetry/artifacts/22/36/ca/c8aae41f80011be881aa337cc80abc25ffd8542471c325e4410afa86c8/authorities-deployer-2020.12.21.3-lambda.zip
      ERROR: Command errored out with exit status 1:
       command: /home/git/my-package/my-package/.venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/q6/xjd92kc90zsds149_rx08cy40000gp/T/pip-req-build-40kngare/setup.py'"'"'; __file__='"'"'/private/var/folders/q6/xjd92kc90zsds149_rx08cy40000gp/T/pip-req-build-40kngare/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/q6/xjd92kc90zsds149_rx08cy40000gp/T/pip-pip-egg-info-02b8jxuf
           cwd: /private/var/folders/q6/xjd92kc90zsds149_rx08cy40000gp/T/pip-req-build-40kngare/
      Complete output (5 lines):
      Traceback (most recent call last):
        File "<string>", line 1, in <module>
        File "/usr/local/Cellar/python@3.9/3.9.0_5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tokenize.py", line 392, in open
          buffer = _builtin_open(filename, 'rb')
      FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/q6/xjd92kc90zsds149_rx08cy40000gp/T/pip-req-build-40kngare/setup.py'
      ----------------------------------------
  ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  WARNING: You are using pip version 20.3.1; however, version 20.3.3 is available.
  You should consider upgrading via the '/home/git/my-package/my-package/.venv/bin/python -m pip install --upgrade pip' command.
  

  at ~/.poetry/lib/poetry/utils/env.py:1074 in _run
      1070│                 output = subprocess.check_output(
      1071│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1072│                 )
      1073│         except CalledProcessError as e:
    → 1074│             raise EnvCommandError(e, input=input_)
      1075│ 
      1076│         return decode(output)
      1077│ 
      1078│     def execute(self, bin, *args, **kwargs):

这个包在一段时间内运行良好。我不记得更改 pyproject.toml 中的任何内容。 我尝试检查pyproject.toml 的旧版本,看看是否可能发生意外更改。同样的结果。

我也尝试删除 .venv/ Poetry 创建并重新创建它。同样的结果。

我不知道 soupsieve 作为依赖项来自何处。它在诗歌创建的环境中使用普通的旧 pip 安装得很好。

cd project/
poetry shell
pip install soupsieve # Installs 2.1 without a problem

【问题讨论】:

  • 您是否尝试删除诗歌缓存? poetry cache clear . --all
  • 是的。不工作。谢谢。

标签: python pip python-poetry


【解决方案1】:

快速修复

所以根本问题与poetry 无关,但我至少能够通过显式添加具有特定版本的子依赖项来解除对这个问题的阻碍。

pip add soupsieve==2.1

根本问题

真正的问题是,我们的系统通过一个被错误元数据污染的私有工件存储库代理所有内容:它包含名为 soupsieve 的东西,实际上不是 soupsieve

一旦我们删除了这些东西,poetry 就会恢复正常工作。

【讨论】:

  • 我们遇到了与损坏的工件类似的问题,并通过从它抱怨的缓存系统中删除工件本身来解决它(在您的情况下:/home/Library/Caches/pypoetry/artifacts/22/36 /ca/c8aae41f80011be881aa337cc80abc25ffd8542471c325e4410afa86c8/authorities-deployer-2020.12.21.3-lambda.zip)
  • 是的。正是我们必须做的。
【解决方案2】:

我遇到了同样的错误,因为由于某种原因poetry install 总是无法在%APPDATA% 中创建虚拟环境路径。解决方案是将 venv 移动到本地项目根目录。

poetry config virtualenvs.in-project true
poetry env remove python
poetry install

【讨论】:

    猜你喜欢
    • 2021-04-24
    • 1970-01-01
    • 2021-06-13
    • 2021-08-07
    • 2022-09-24
    • 2022-08-11
    • 2020-06-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多