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

- **ID:** `python/setuptools-entry-points-collision`
- **领域:** python
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

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.
   ```

## 无效尝试

- **** — Does not affect the already-running process's working set. (85% 失败率)
- **** — pkg_resources reads installed distributions, not just sys.path. (70% 失败率)
