ModuleNotFoundError: No module named 'pip'

Fix 'No module named pip' After Python Upgrade

After upgrading Python, pip often disappears because the new version doesn't carry it. Here's how to get it back, from a 30-second check to a manual install.

Why This Happens

You upgraded Python—maybe from 3.10 to 3.12—and suddenly pip is missing. This is common. The new Python version doesn't automatically bring its own pip, especially if you installed it from a source like python.org or a package manager that strips it out.

The error shows up when you run pip install something or python -m pip. You'll see something like:

ModuleNotFoundError: No module named 'pip'

Don't panic. You don't need to reinstall Python. Here's the fix, starting with the quickest option.


Fix 1: The 30-Second Try

First, check if pip is just hidden. Sometimes the upgrade leaves pip behind but not on your PATH. Run this:

python -m pip --version

If that shows a version number, then pip exists—you just need to invoke it with python -m pip instead of pip.

If you see the error again, move to Fix 2.


Fix 2: Use ensurepip (5 Minutes)

Python ships with a tool called ensurepip. It can install pip into your current Python environment. This is the standard, safe way to get pip back.

On Windows, macOS, or Linux

  1. Open your command prompt or terminal.
  2. Run this command:
python -m ensurepip --upgrade

What to expect: After running it, you'll see some output like Successfully installed pip-23.2.1 (version may vary).

Now test it:

python -m pip --version

If that works, you're done. If not, or if you get an error like No module named ensurepip, move to Fix 3.


Fix 3: Manual Install with get-pip.py (15+ Minutes)

When ensurepip is missing—which happens if your Python build didn't include it—you'll need to grab pip from the official source. This takes a few extra steps but works every time.

Step 1: Download get-pip.py

Open a browser and go to:

https://bootstrap.pypa.io/get-pip.py

Right-click and save the file as get-pip.py in your home directory or any folder you can find easily.

Step 2: Run the Installer

Open a terminal (or command prompt) and cd to the folder where you saved the file. Then run:

python get-pip.py

What to expect: The script will download pip and install it. You'll see progress bars and a final message. It might also try to upgrade setuptools and wheel—that's fine, let it do its thing.

Step 3: Verify pip

python -m pip --version

You should see something like pip 23.2.1 from /usr/local/lib/python3.12/site-packages/pip (python 3.12). That means pip is installed and working.

Step 4: Add pip to PATH (if needed)

If you want to use just pip instead of python -m pip, you might need to add the Scripts folder to your PATH. This is common on Windows.

To find the Scripts folder, run:

python -m site --user-site

That prints a path like C:\Users\YourName\AppData\Roaming\Python\Python312\site-packages. Go up one level and you'll see a Scripts folder. Add that to your system PATH.

I'm not going to detail PATH editing here because it varies by OS. Search for your OS and 'edit PATH' and you'll get exact steps.


What If You're Using a Virtual Environment?

If you're in a virtual environment (venv) and pip is missing, the same fixes apply, but run them while the env is activated. The python command inside the env points to that env's interpreter.

If you just upgraded Python globally, your existing venvs might be broken. That's a separate issue—you'd need to recreate them with python -m venv myenv.


Prevent This Next Time

When you upgrade Python in the future, check if pip comes along. After the upgrade, run python -m pip --version right away. If it's missing, use ensurepip immediately—it's the fastest fix.

Also, if you use package managers like Homebrew or apt, they sometimes handle pip separately. For Homebrew, you'd do brew install python-pip. For apt, sudo apt install python3-pip. But the manual method above works regardless.

One more thing: don't use sudo pip install on Linux if you can avoid it. Use a virtual environment. It saves you from a world of pain later.

That's it. You should have pip back now. If you hit any snags, the official pip documentation at pip.pypa.io has the full details.

Related Errors in Programming & Dev Tools
0X80000003 STATUS_BREAKPOINT (0X80000003): A breakpoint has been reached 0X40000021 STATUS_WX86_EXCEPTION_LASTCHANCE (0x40000021) fix java.lang.OutOfMemoryError: Java heap space Fix Java OutOfMemoryError: Java heap space Module not found: Can't resolve 'fs' Fix 'Module not found: Can't resolve fs' in Next.js Client Components

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.