python module_error ai_generated partial

pkg_resources.ContextualVersionConflict: (foo 1.0 (/venv/lib/python3.11/site-packages), Requirement.parse('foo>=2.0'), {'bar'})

ID: python/setuptools-entry-points-collision

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

A plugin/entry point consumer (`bar`) requires foo>=2.0, but an older foo is activated in the same working set, so pkg_resources raises a conflict when resolving entry points.

generic

中文

某个插件/入口点消费者(`bar`)要求 foo>=2.0,但同一工作集中激活的是旧版 foo,因此 pkg_resources 在解析入口点时抛出冲突。

Workarounds

  1. 90% success
    Upgrade foo in the same environment and restart the process: `pip install --upgrade 'foo>=2.0'`.
  2. 80% success
    Isolate plugins per environment so entry points resolve against one consistent set of distributions.

Dead Ends

Common approaches that don't work:

  1. 85% fail

    Does not affect the already-running process's working set.

  2. 70% fail

    pkg_resources reads installed distributions, not just sys.path.