{
  "id": "python/pip-venv-pip-missing-after-ensurepip",
  "signature": "ModuleNotFoundError: No module named 'pip'",
  "signature_zh": "ModuleNotFoundError：没有名为 'pip' 的模块",
  "regex": "ModuleNotFoundError:\\ No\\ module\\ named\\ 'pip'",
  "domain": "python",
  "category": "install_error",
  "subcategory": null,
  "root_cause": "A venv was created with `--without-pip`, or ensurepip failed silently, leaving the environment without pip installed.",
  "root_cause_type": "generic",
  "root_cause_zh": "venv 以 `--without-pip` 创建，或 ensurepip 静默失败，导致环境未安装 pip。",
  "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"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "On some distros (Debian/Ubuntu) ensurepip is disabled and prints a message suggesting apt install python3-pip instead.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "pip is the module being invoked; the command cannot run before pip exists.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Bootstrap pip via get-pip.py: `curl -sS https://bootstrap.pypa.io/get-pip.py | python`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Recreate the venv without --without-pip: `rm -rf .venv && python -m venv .venv`.",
      "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-06-04",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}