{
  "id": "python/pip-cannot-uninstall-distutils-installed",
  "signature": "ERROR: Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.",
  "signature_zh": "错误：无法卸载 'numpy'。它是 distutils 安装的项目，因此我们无法准确确定哪些文件属于它，这会导致仅部分卸载。",
  "regex": "ERROR:\\ Cannot\\ uninstall\\ 'numpy'\\.\\ It\\ is\\ a\\ distutils\\ installed\\ project\\ and\\ thus\\ we\\ cannot\\ accurately\\ determine\\ which\\ files\\ belong\\ to\\ it\\ which\\ would\\ lead\\ to\\ only\\ a\\ partial\\ uninstall\\.",
  "domain": "python",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "The package was installed by the OS package manager (apt/yum) via distutils, so pip has no RECORD file to know which files to remove.",
  "root_cause_type": "generic",
  "root_cause_zh": "该包由操作系统包管理器（apt/yum）通过 distutils 安装，因此 pip 没有 RECORD 文件来知道要删除哪些文件。",
  "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": "Upgrade still needs to uninstall the old version first; same error occurs.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Manually deleting files leaves stale metadata in the OS package database and can break system tools.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Create a virtualenv so pip owns the packages:\n  python -m venv .venv && source .venv/bin/activate\n  pip install numpy",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "Force pip to ignore the installed version:\n  pip install --ignore-installed numpy",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.75,
      "how": "Remove the OS package first:\n  sudo apt-get remove python3-numpy\n  pip install numpy",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-28",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}