{
  "id": "python/pkg-resources-missing",
  "signature": "ModuleNotFoundError: No module named 'pkg_resources'",
  "signature_zh": "ModuleNotFoundError：没有名为 'pkg_resources' 的模块",
  "regex": "ModuleNotFoundError:\\ No\\ module\\ named\\ 'pkg_resources'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "setuptools is not installed in the active environment, or the environment was created without setuptools (e.g., some venv setups or distro Python without pip). Code importing pkg_resources fails.",
  "root_cause_type": "generic",
  "root_cause_zh": "当前环境中未安装 setuptools，或环境创建时未包含 setuptools（例如某些 venv 配置或未安装 pip 的发行版 Python）。导入 pkg_resources 的代码因此失败。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "There is no standalone pkg_resources package on PyPI; it ships inside setuptools.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Silences the error but any code depending on resource access still fails later.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Install setuptools into the active environment:\npython -m pip install setuptools",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Migrate to importlib.metadata / importlib.resources:\nfrom importlib.metadata import version\nprint(version('requests'))",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}