{
  "id": "python/setuptools-could-not-find-version-satisfying",
  "signature": "pkg_resources.VersionConflict: (foo 1.0 (/usr/lib/python3/dist-packages), Requirement.parse('foo>=2.0'))",
  "signature_zh": "pkg_resources.VersionConflict: (foo 1.0 (/usr/lib/python3/dist-packages), Requirement.parse('foo>=2.0'))",
  "regex": "pkg_resources\\.VersionConflict:\\ \\(foo\\ 1\\.0\\ \\(/usr/lib/python3/dist\\-packages\\),\\ Requirement\\.parse\\('foo>=2\\.0'\\)\\)",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "At import time, pkg_resources checks installed distributions and finds a version that does not satisfy a declared requirement, often because two packages were installed into different site-packages directories.",
  "root_cause_type": "generic",
  "root_cause_zh": "在导入时，pkg_resources 检查已安装的发行版，发现某个版本不满足声明的需求，通常是因为两个包被安装到不同的 site-packages 目录。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If the old foo is in the system dist-packages and pip installs to user site-packages, pkg_resources may still find the old one first.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Hides the version mismatch; the package may call APIs that do not exist in the old version and crash later.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Check which foo is found:\n  python -c \"import foo; print(foo.__file__)\"\n  pip show foo\nThen uninstall the old one:\n  pip uninstall foo\n  pip install 'foo>=2.0'",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use a virtualenv with --system-site-packages disabled so the system dist-packages does not shadow your venv:\n  python -m venv .venv  # do NOT pass --system-site-packages\n  source .venv/bin/activate\n  pip install foo",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-08",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}