python
install_error
ai_generated
true
ModuleNotFoundError: No module named 'pip'
ID: python/pip-venv-pip-missing-after-ensurepip
80%Fix Rate
88%Confidence
0Evidence
2024-06-04First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
A venv was created with `--without-pip`, or ensurepip failed silently, leaving the environment without pip installed.
generic中文
venv 以 `--without-pip` 创建,或 ensurepip 静默失败,导致环境未安装 pip。
Workarounds
-
90% success
Bootstrap pip via get-pip.py: `curl -sS https://bootstrap.pypa.io/get-pip.py | python`.
-
95% success
Recreate the venv without --without-pip: `rm -rf .venv && python -m venv .venv`.
Dead Ends
Common approaches that don't work:
-
60% fail
On some distros (Debian/Ubuntu) ensurepip is disabled and prints a message suggesting apt install python3-pip instead.
-
95% fail
pip is the module being invoked; the command cannot run before pip exists.