[SOLVED] pip command not found in Ubuntu


Pip is a python library, package manager that allows you to download and install packages from the (Python Package Index) PyPi repository. When you try to download a package using the pip without having a pip package manager, an error will raise on the terminal window 'pip: command not found.

In this guide, We will show you the main causes of this error and how to fix the pip command not found error on the Ubuntu 20.04 system using a potential solution.


What is "pip command not found" error ?

The python-pip package manager works as an independent package manager on Linux distribution. This means you need to install the pip tool separately from python programs.

The pip command is not found an error raised on your Linux terminal window if the pip is not installed independently on Ubuntu 20.04 system. Therefore, before installing any package using pip, the pip tool should be installed on your Ubuntu system.

When are working with the python3 version, you can use the pip or pip3 as well while installing a new python package on your system.
For example, you want to install a python package ‘scrapy’ using the pip command:

$ pip3 install scrapy

The following pip: command not found error displays on the terminal. This means pip is not installed on your Ubuntu system.

pip command not found


How to fix pip command not found error on Ubuntu?

There can be two versions of pip (at the time of writing article python4 was not released so once python4 is available, it is possible we have another version of pip) i.e. from python2 and python3.

So based on your requirement and environment you can choose to install the respective pip version (although python2 is mostly deprecated and you can choose to install pip from Python3).


1. Install pip package manager for Python3

When pip command not found error is raised on your terminal window, you can easily fix the error by running the below-mentioned command:

$ sudo apt install python3-pip

The above command will install the pip package manager on your Ubuntu 20.04 system as follows:

install python3 pip

Display the pip installed version by using the following command:

$ pip --version
$ pip3 --version
[SOLVED] pip command not found in Ubuntu

Now, you can go ahead an install a package using pip package manager by running the following command:

$ pip3 install scrapy

As you will notice, the above command will not show any error. It directly installs the scrapy python module on your system Ubuntu 20.04.

install package using pip3


2. Install pip package manager for Python2

Python 2 version has obsoleted now. This means Python 2 is no longer to use or maintained properly. Now, everyone moving towards the python 3 versions. So, try to move your python code over to the codebase that supports the newest Python 3 framework. But, if you still need to install the pip2 package manager tool then, download the get-pip.py script using the curl command as follows:

$ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
get pip script

Now, you can install pip for the python2 version using the following command:

$ sudo python2 get-pip.py
install pip2 using script

Print the pip2 installed version using the below-mentioned command:

$ pip2 --version
pip2 version


How to use the pip command?

Using the pip command, you easily install packages from the python packages index repository, local projects, version control, and distribution files.
To get installation help related to python3 packages, use the following pip3command:

$ pip3 install --help
pip3 install help


List all pip3 packages or modules

To list all pip3 packages, use the following command:

$ pip3 list
pip3 packages list


Install and uninstall a package using pip

Now, you can install a package from the pip3 packages list.

$ pip3 install package-name

Similarly, you can also uninstall it via pip3 or pip command. To uninstall a package using pip3, run the below-given command:

$ pip3 uninstall package-name
[SOLVED] pip command not found in Ubuntu


Upgrade a package using pip

You can also upgrade a specific package to its latest version using pip as follows:

$ pip install --upgrade package-name


We discussed two main reasons due to which the pip: command not found error raised. First, the pip is not installed on your Ubuntu system, or if two different python versions are installed on your system and you accidentally executed the pip command instead of pip3. Using the above-proposed solution I hope you can easily fix this error.

Views: 382
Deepak Prasad

Deepak Prasad

He is the founder of GoLinuxCloud and brings over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels in various domains, from development to DevOps, Networking, and Security, ensuring robust and efficient solutions for diverse projects. You can connect with him on his LinkedIn profile.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

Leave a Comment