Introduction
If you are a Linux user and you are trying to use the pip3 command to install packages, but you are getting an error saying “Command ‘pip3’ not found”, then this article is for you. This error can be caused by a few different things, but the good news is that it is usually easy to fix. In this article, we will discuss the different causes of this error and how to fix it. We will also provide some tips on how to prevent this error from happening in the future. So, let’s get started!
How to Fix “Command ‘pip3’ not found” Error in Linux
1. Check if pip3 is installed:
Run the command ‘pip3 -V’ in the terminal. If you get an output like ‘pip 9.0.1 from /usr/local/lib/python3.6/dist-packages (python 3.6)’, then pip3 is installed.
2. Install pip3:
If pip3 is not installed, you can install it using the command ‘sudo apt-get install python3-pip’.
3. Update pip3:
If pip3 is already installed, you can update it using the command ‘pip3 install –upgrade pip’.
4. Check the PATH variable:
The PATH variable is used to tell the system where to look for executable files. If the PATH variable is not set correctly, the system will not be able to find the pip3 command. To check the PATH variable, run the command ‘echo $PATH’. If the output does not include the path to the pip3 executable, you can add it by running the command ‘export PATH=$PATH:/usr/local/bin’.
PIP is the conventional package manager for Python, which is the standard tool for installing and managing Python packages alongside their dependencies which are not included in the standard Python library.
When using pip, you might encounter the error “pip command not found” on the terminal. Below is an excerpt of the error as captured on the Ubuntu system.
$ pip3 install pandas Command 'pip3' not found, but can be installed with: sudo apt install python3-pip
From the output, you can infer that there’s a high chance that PIP is not installed.
In this article, we look at ways how you can install PIP in Linux to fix the “pip command not found” error.
Install PIP in Linux
The first course of action is to ensure that Python is installed on the system, which you can confirm by running:
$ python3 --version Python 3.9.2
From the output, we already have Python 3.9 installed.
To install PIP on Debian-based distributions, run the following command:
$ sudo apt install python3-pip -y
The command installs PIP alongside a bunch of other additional packages and dependencies.
For RHEL-based distributions such as Fedora, Rocky, AlmaLinux, and CentOS run the following yum command.
$ sudo yum install python3-pip -y
For Arch Linux distributions, execute the command:
$ sudo pacman -S python-pip -y
Once installed, verify the version of the pip installed as shown.
$ pip3 --version pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)
Additionally, you can verify the location of pip binaries as shown
$ which pip3 /usr/bin/pip3
From the output, we have installed PIP 20.3.4.
Upgrade PIP in Linux
The other way to fix the “pip command not found” error is to upgrade PIP to the latest version.
$ sudo -H pip3 install --upgrade pip
From the output, we have upgraded the pip from version 20.3.4 to 23.1.2.
PIP – Install Python Packages
Now you should be able to install and manage Python packages and libraries using Pip without an issue.
For example, you can install Pandas as shown.
$ pip3 install pandas
In this article, we have successfully resolved the error “pip command not found”. I hope you found this article informative.
If You Appreciate What We Do Here On Jassweb, You Should Consider:
Jassweb is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit Jassweb! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
How to Fix “Command ‘pip3’ not found” Error in Linux
If you are a Linux user, you may have encountered the “Command ‘pip3’ not found” error when trying to install a Python package. This error occurs when the pip3 command is not found in the system’s PATH environment variable. In this article, we will explain how to fix this error.
What is the “Command ‘pip3’ not found” Error?
The “Command ‘pip3’ not found” error is an error that occurs when the pip3 command is not found in the system’s PATH environment variable. This error is usually encountered when trying to install a Python package using the pip3 command.
How to Fix the “Command ‘pip3’ not found” Error
The “Command ‘pip3’ not found” error can be fixed by adding the path to the pip3 command to the system’s PATH environment variable. To do this, follow these steps:
- Open the terminal and type the following command:
echo $PATH
- This will display the current PATH environment variable.
- Now, type the following command to add the path to the pip3 command to the PATH environment variable:
export PATH=$PATH:/path/to/pip3
- Replace
/path/to/pip3
with the actual path to the pip3 command. - Now, try running the pip3 command again and it should work.
Conclusion
In this article, we have explained how to fix the “Command ‘pip3’ not found” error in Linux. We have shown how to add the path to the pip3 command to the system’s PATH environment variable. After doing this, the pip3 command should work as expected.