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

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

版本兼容性

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

根因分析

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

English

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

解决方案

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

无效尝试

常见但无效的做法:

  1. 85% 失败

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

  2. 70% 失败

    pkg_resources reads installed distributions, not just sys.path.