ModuleNotFoundError: No module named 'pip'

Fix 'No module named pip' in Python

You tried to install a package and Python says pip is missing. Don't panic—this fix takes about two minutes.

Quick answer for advanced users

Run this in your terminal: python -m ensurepip --upgrade. If that fails, download get-pip.py and run it with python get-pip.py.

Why this happens

You're trying to use pip—maybe to install a library or run a script—and Python hits you with ModuleNotFoundError: No module named 'pip'. This usually happens on a fresh Python install (especially on Linux where some distros split Python and pip into separate packages), after a partial upgrade that borked things, or when you've manually deleted or corrupted the pip directory inside site-packages. It can also pop up if you're running a Python environment that was created with --without-pip—yes, that flag exists, and it causes this exact error.

The real problem: pip isn't on Python's module path. Maybe it never was, maybe it got removed. Either way, we put it back.

How to fix it (step by step)

Step 1: Try ensurepip

Python 3.4 and later ship with a built-in module called ensurepip that can install pip for you. This is the cleanest fix.

  1. Open your terminal or command prompt.
  2. Type: python -m ensurepip --upgrade and press Enter.
  3. After a few seconds, you should see something like: Successfully installed pip-XX.X. The version number will vary.
  4. Test it: python -m pip --version. You should get a line like pip XX.X from ....

If that worked, you're done. Pip is back. Skip to the prevention tip below.

Step 2: If ensurepip failed, use get-pip.py

Sometimes ensurepip can't find its own bootstrap files (rare, but it happens on older Python 3.4 or 3.5 builds). Here's the backup plan:

  1. Download get-pip.py from bootstrap.pypa.io/get-pip.py. Save it to your current directory.
  2. Run: python get-pip.py
  3. You'll see a bunch of output, ending with Successfully installed pip-XX.X wheel-XX.X setuptools-XX.X.
  4. Verify with python -m pip --version.

That's it. The get-pip script installs pip, setuptools, and wheel together—saves you from missing those too.

Step 3: Use your system package manager (Linux only)

If you're on Ubuntu, Debian, or a similar distro, pip might be a separate package you can install the normal way:

sudo apt update
sudo apt install python3-pip  # or python-pip for Python 2

After that, check with pip3 --version (note the 3 suffix). On Fedora or RHEL-based systems, use sudo dnf install python3-pip.

What to do if you're still stuck

If none of the above worked, you've got a deeper problem. A few things to check:

  • Python version mismatch: You might have Python 3.12 installed but your PATH points to an old Python 3.6. Run python --version and see what it says. If it's ancient, update Python first.
  • Multiple Python installs: On Windows, you might have both Microsoft Store Python and python.org Python. Uninstall one to avoid conflicts. Use where python (Windows) or which python (Mac/Linux) to see which one runs.
  • Corrupted virtual environment: If you're inside a venv and pip is missing, delete the virtual environment folder and recreate it: python -m venv myenv then source myenv/bin/activate (or myenv\Scripts\activate on Windows).

As a last resort, uninstall Python completely and reinstall it fresh from python.org. On Windows, make sure you check the box "Add Python to PATH" during installation. That checkbox saves a lot of headaches.

How to prevent this from happening again

Two things. First, never delete anything inside your Python installation's Lib/site-packages folder—that's where pip lives. Second, don't run pip install --user with sudo or as root on Linux; that can break the system's pip. Stick to virtual environments for project work. For example:

python -m venv myprojectenv
source myprojectenv/bin/activate  # or .\myprojectenv\Scripts\activate on Windows
pip install requests  # now this uses the venv's pip

Virtual environments keep your global Python clean and pip intact. I've been doing help desk for years, and nine out of ten "pip missing" problems I see come from people mucking about in their global Python directory. Don't be that person.

Related Errors in Programming & Dev Tools
0X000002B3 Debugger terminated thread 0x000002B3: Quick fix & real trigger ModuleNotFoundError Fix Python ModuleNotFoundError: No module named X Parsing error: Unexpected token Fixing ESLint 'Unexpected token' with TypeScript decorators java.lang.OutOfMemoryError: Java heap space Java OutOfMemoryError: Java heap space – Fix Guide

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.