How To Fix The ‘No Module Named Pip’ Error


By squashlabs, Last Updated: November 2, 2023

How To Fix The ‘No Module Named Pip’ Error

If you encounter the ‘No module named pip’ error in Python, it means that the pip package manager is not installed or not accessible in your Python environment. Pip is the standard package manager for Python, and it allows you to easily install and manage Python packages. This error often occurs when you are trying to use pip but it is not installed or configured correctly. In this guide, we will explore two possible solutions to fix this error.

Solution 1: Install Pip

The first solution is to install pip manually. Here are the steps to do it:

1. Check if pip is already installed by running the following command in your terminal or command prompt:

pip --version

If pip is installed, you will see its version number. If not, proceed to the next step.

2. Download the script by running the following command:

curl -o

If you don’t have curl installed, you can also download the script manually from this link:

3. Run the script using the Python interpreter with the following command:


Make sure to use the appropriate command if you have multiple versions of Python installed on your system, such as python3 instead of python.

4. After the installation is complete, verify that pip is installed by running the following command:

pip --version

You should see the version number of pip displayed in the output.

Solution 2: Check Python Installation

If the previous solution did not work, it’s possible that your Python installation is missing or incomplete. Follow these steps to check and fix your Python installation:

1. Check if Python is installed by running the following command:

python --version

If Python is installed, you will see its version number. If not, you need to install Python first. Visit the official Python website ( and download the appropriate version for your operating system. Follow the installation instructions provided by Python.

2. Add Python to your system’s PATH environment variable. The PATH variable is a list of directories that the operating system searches when you run a command. By adding Python to the PATH, you can access it from any directory in the terminal or command prompt.

On Windows:
– Open the Control Panel and go to System and Security > System > Advanced system settings.
– Click on the “Environment Variables” button.
– In the “System variables” section, scroll down to find the “Path” variable and click on “Edit”.
– Add the path to your Python installation directory (e.g., C:\Python39) to the list of paths. Make sure to separate it from other paths with a semicolon (;).
– Click “OK” to save the changes.

On Linux/Mac:
– Open a terminal window.
– Open your shell configuration file. For example, for Bash, you can use the command: nano ~/.bashrc
– Add the following line at the end of the file, replacing /path/to/python with the actual path to your Python installation directory:

export PATH="/path/to/python:$PATH"

– Save the file and exit the editor.
– Restart the terminal or run the following command to apply the changes:

source ~/.bashrc

3. After adding Python to the PATH, open a new terminal or command prompt window and check if Python is accessible by running the following command:

python --version

You should see the version number of Python displayed in the output.

4. Install pip using the recommended installation method for your operating system. Visit the official pip website ( and follow the instructions provided.

Reasons for the Error

The ‘No module named pip’ error can occur due to several reasons:

1. Pip not installed: If pip is not installed on your system, you won’t be able to use it to install Python packages.

2. Incorrect Python installation: If Python is not installed or not properly configured on your system, it can result in the ‘No module named pip’ error.

3. PATH variable not set: If the PATH environment variable is not set correctly to include the Python installation directory, the system won’t be able to find the pip executable.

Alternative Ideas

If the above solutions do not work, you can try the following alternative ideas:

1. Use a package manager: Instead of installing pip manually, you can use a package manager that comes with your operating system, such as apt-get on Ubuntu or Homebrew on macOS. These package managers can help you install Python and pip easily.

2. Use a virtual environment: Virtual environments allow you to create isolated Python environments with their own set of installed packages. You can create a new virtual environment and install pip within that environment. This can help you avoid conflicts with the system’s Python installation.

Here’s an example of how to create a virtual environment and activate it:

python -m venv myenv          # Create a virtual environment
source myenv/bin/activate   # Activate the virtual environment (Linux/Mac)
myenv\Scripts\activate      # Activate the virtual environment (Windows)

After activating the virtual environment, you can install packages using pip without conflicts.

More Articles from the Python Tutorial: From Basics to Advanced Concepts series: