How to solve ImportError: No module named pip in Python

1. Overview

In this tutorial, we'll see how to solve a popular Python error on Linux Mint and Ubuntu:

ImportError: No module named pip

The error is raised when you try to install new package or running command like:

python3 -m pip list

In the next sections we will see how to solve the error

2. Solve ImportError: No module named pip on Ubuntu

To install pip module on Linux Mint or Ubuntu we can use apt-get and install it as follows:

sudo apt-get install python3-pip

Now after running:

python3 -m pip list

you should get something like:

Package                  Version             
------------------------ --------------------
apt-clone                0.2.1               
apturl                   0.5.2               
attrs                    19.3.0        

3. Install pip with ensurepip module

Alternatively we can install pip from Python itself by running. Most python versions are shipped with module ensurepip which can be used for installation:

python -m ensurepip --upgrade

The command above will work for Linux distros. If you like to learn more you can check: pip documentation v22.0.3.

4. Manual Installation of pip module

Finally if you prefer to manually download and install pip you can follow next steps:

Or simply:

cd ~/Downloads
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py

This method is perfect if you need to install pip offline.

5. Conclusion

To conclude, this article shows how to solve the "ImportError: No module named pip" error in several different ways.

All solutions are tested on Linux Mint and Ubuntu. Some of them might work on Windows or Mac with small changes. For further reference please check the official documentation: pip installation on Linux, MacOS and Windows.