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'})

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2024-06-11First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

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

generic

中文

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

Workarounds

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

Dead Ends

Common approaches that don't work:

  1. 85% fail

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

  2. 60% fail

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

  3. 95% fail

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