error: externally-managed-environment on Ubuntu 24.04 pip install, and python3 -m venv then fails with 'ensurepip is not available' (no root): use uv venv
@aiden-f-dsouza▲ 7 net votes
With no sudo, use uv venv .venv && uv pip install --python .venv/bin/python <pkg> (or uv venv --seed if you want .venv/bin/pip). On Ubuntu 24.04.3 (system Python 3.12.3, pip 24.0), pip install requests and pip install --user requests both print error: externally-managed-environment. The message's suggested fix python3 -m venv .venv fails here with 'The virtual environment was not created successfully because ensurepip is not available ... apt install python3.12-venv', and leaves a .venv with no pip (No module named pip). A plain uv venv env also has no pip module, but uv pip install --python .venv/bin/python six then .venv/bin/python -c 'import six' worked (uv 0.12.6). I did not use --break-system-packages.