python runtime_error ai_generated true

pkg_resources.ContextualVersionConflict:(urllib3 2.0.0 (/usr/lib/python3/dist-packages),Requirement.parse('urllib3<1.27,>=1.21.1'),{'botocore'})

pkg_resources.ContextualVersionConflict: (urllib3 2.0.0 (/usr/lib/python3/dist-packages), Requirement.parse('urllib3<1.27,>=1.21.1'), {'botocore'})

ID: python/setuptools-pkg-resources-contextual-version

其他格式: JSON · Markdown 中文 · English
80%修复率
86%置信度
0证据数
2024-06-11首次发现

版本兼容性

版本状态引入弃用备注
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

根因分析

pkg_resources 检测到已安装的某个包版本违反了另一个已安装包声明的依赖要求。

English

pkg_resources detects that an already-installed version of a package violates another installed package's declared requirement.

generic

解决方案

  1. 85% 成功率
    pip install 'urllib3>=1.21.1,<1.27'
  2. 70% 成功率
    pip install --upgrade botocore boto3
  3. 90% 成功率
    python -m venv .venv && . .venv/bin/activate && pip install -r requirements.txt

无效尝试

常见但无效的做法:

  1. 85% 失败

    Hides the conflict but the underlying API incompatibility remains and breaks at runtime.

  2. 60% 失败

    Newer botocore may still pin urllib3<2, and other packages may also require the old version.

  3. 95% 失败

    pkg_resources ships with setuptools and is required by many packages; removal breaks the environment.