How to upgrade pip
Tested: we reproduced this error and confirmed the fix on Ubuntu 24.04 with Python 3.12 (pip 24.0 upgraded to 26.3), November 29, 2026.
Run this with the Python whose pip you want to upgrade, ideally inside your project’s virtual environment:
python -m pip install --upgrade pip
On Windows, use the launcher: py -m pip install --upgrade pip. On Mac and Linux outside a virtual environment, python may be missing, so use python3.
In our test on Ubuntu 24.04, this upgraded pip inside a virtual environment from 24.0 to 26.3. The same command against the system Python stopped with error: externally-managed-environment, which is expected on current Linux systems.
Step by step
- Activate your environment:
source .venv/bin/activate(Mac and Linux) or.venv\Scripts\activate(Windows). If you don’t have one,python3 -m venv .venvcreates it. - Check the current version:
python -m pip --version. The path should point inside.venv. - Upgrade:
python -m pip install --upgrade pip. - Check again:
python -m pip --version.
Errors you may hit
| Error | Why | Fix |
|---|---|---|
error: externally-managed-environment |
You’re upgrading the OS or Homebrew Python’s pip | Do it inside a virtual environment |
No module named pip |
That Python has no pip at all | python -m ensurepip --upgrade (guide) |
Permission denied or [WinError 5] |
Upgrading a Python installed for all users | Use a virtual environment instead |
'pip' is not recognized |
pip’s folder isn’t on PATH | Use py -m pip on Windows |
Could not fetch URL https://pypi.org/simple/pip/ |
Network, proxy or certificate problem | Check your proxy settings or connection |
Upgrade pip everywhere you use it
Each virtual environment has its own pip, so upgrading in one doesn’t change the others. New environments start with the pip version bundled with Python, which can be a few releases behind. To get the latest pip in a new environment straight away:
python3 -m venv --upgrade-deps .venv
--upgrade-deps (Python 3.9 and later) upgrades pip as the environment is created.
Upgrade other packages with pip
pip install --upgrade (or -U) works the same way for any package: it replaces the installed version with the newest one your Python supports.
python -m pip list --outdated # what has a newer version
python -m pip install --upgrade requests # newest version of one package
python -m pip install "requests==2.32.3" # a specific version
In our test, pip list --outdated showed requests 2.31.0 with 2.34.2 available, and the upgrade moved it to 2.34.2. The same pinning works for pip itself: python -m pip install "pip==24.2" installed exactly that version. pip has no single command to upgrade everything; upgrade packages one at a time, or update the versions in requirements.txt and reinstall.
Confirm it worked
python -m pip --version shows the new version, and the path still points to the environment you meant. pip also stops printing the A new release of pip is available notice.
FAQ
Should you upgrade pip?
Yes, inside your virtual environments. Newer pip versions handle new package formats and fix bugs, and an old pip is a common cause of failed installs.
Should I upgrade the system pip?
No. On Linux and with Homebrew Python, the system pip belongs to the package manager, and recent versions block the upgrade with error: externally-managed-environment. Upgrade pip inside each virtual environment instead.
Why use python -m pip instead of pip?
python -m pip runs the pip that belongs to that exact Python, so you upgrade the copy you meant. On Windows it's also the only way pip can replace its own running files.
How do I check which pip version I have?
Run python -m pip --version. It prints the version and the folder pip is installed in, which tells you which Python it belongs to.
