{
  "id": "python/pip-uninstall-permission-denied",
  "signature": "ERROR: Exception:\nTraceback (most recent call last):\n  File \"...\", line 1, in <module>\nPermissionError: [Errno 13] Permission denied: '/usr/lib/python3.11/site-packages/foo/__init__.py'",
  "signature_zh": "错误：异常：\n回溯（最近的调用最后）：\n  File \"...\"，第 1 行，在 <module> 中\nPermissionError: [Errno 13] 权限被拒绝：'/usr/lib/python3.11/site-packages/foo/__init__.py'",
  "regex": "ERROR:\\ Exception:\\\nTraceback\\ \\(most\\ recent\\ call\\ last\\):\\\n\\ \\ File\\ \"\\.\\.\\.\",\\ line\\ 1,\\ in\\ <module>\\\nPermissionError:\\ \\[Errno\\ 13\\]\\ Permission\\ denied:\\ '/usr/lib/python3\\.11/site\\-packages/foo/__init__\\.py'",
  "domain": "python",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "pip is trying to modify a site-packages directory owned by root (or another user), but the current user lacks write permission.",
  "root_cause_type": "generic",
  "root_cause_zh": "pip 尝试修改由 root（或其他用户）拥有的 site-packages 目录，但当前用户缺少写权限。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Weakens system security and can break imports for other users; does not address the real fix.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Leaves the old root-owned copy in place, causing import shadowing and version confusion.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "python3 -m venv ~/.venvs/app\nsource ~/.venvs/app/bin/activate\npython -m pip install foo",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "python -m pip install --user --force-reinstall foo\n# ensure ~/.local/bin is on PATH\nexport PATH=\"$HOME/.local/bin:$PATH\"",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}