How To'sLinux

How to Fix “Pip Command Not Found” Error in Linux, Windows, Mac?

Pip command not found error is one of the common and most frustrating errors users experiences in Linux, Windows, and Mac. It pops up whenever you try to run pip from your terminal. Pip is a tool used to install, update and manage packages in your Linux system. It’s like the Python version of brew or msys2 on Windows.

Pip is short for the Python installation package. Pip isn’t just a command, it’s also a package manager that helps you easily install programs and libraries on your Linux system.

1. How to Fix “Pip command not found” error in Linux

To fix the “bash: Pip command not found” error in Linux, or any other distro. You can find the fixes below:

Check The Python and Pip Version

First, we’re gonna make sure we don’t have outdated versions of python and pip installed on our system. Or if you don’t have Python or Pip installed on your Ubuntu or any other Linux distribution we’re going to install them too.

Check Python Version

To make sure what version of python you’re running use the following command:

python3 --version

Check Pip Version

To find out what version of Pip you’ve installed on your system use the following command:

pip3 --version

As you can in the above screenshots, I’ve both python and pip latest versions installed. But in some cases, you might get an error “bash: Pip command not found” which we’re gonna fix in ubuntu or any other Linux distribution.

Note: If you have Python 3 installed on your system and you’re getting pip command not found an error that could be because you gonna want to install the pip3 version along with python 3. Follow the steps below to easily install Python3 on your Ubuntu system.

Installing Python3 on Ubuntu Linux

Now, that python2 is obsolete it is not recommended to install that specific version and move your codebase or upgrade to Python3. With the latest Ubuntu version, there’s builtin-python3 installed on the system. However, we’re going to install python3 on our ubuntu system.

First, check if you have any python version installed.

As of now, we don’t have any python version installed but we’re going to install python3 on our ubuntu system.

1. Update System

In a terminal, enter:

sudo apt update

2. Installing Supporting Software

Software-properties-common lets you add PPA repositories to your package manager. Install supporting tools using:

sudo apt install software-properties-common

4. Adding Deadsnakes PPA

Deadsnakes is an Ubuntu PPA with the latest versions. Enter PPA:

sudo add-apt-repository ppa:deadsnakes/ppa

To proceed, press enter. Update package lists:

sudo apt update

5. Install Python 3 Version

Now you can use the command to start installing Python 3.8:

sudo apt install python3.8

Let the process finish, and then check whether the python version is installed correctly.

python --version

The installation process of Python3 is simple, as you can it’s successfully installed.

Install Pip3 on Ubuntu

First, make sure you don’t have any version of pip installed to avoid conflicting between the packages and libraries.

pip --version
OR
pip3 --version

As you can see the output “Command ‘pip3’ not found, but can be installed with:” we’re gonna want to install it.

To install pip, simply run:

sudo apt update
sudo apt install python3-venv python3-pip

After the installation process is complete, check the pip version. You won’t receive the “pip command not found error” as the issue has been resolved.

Install Pip3 on Arch Linux

pacman -S python2-pip
pacman -S python-pip

Install Pip3 on CentOS and RHEL

yum install epel-release
yum install python-pip

Install Pip3 on Fedora

dnf install python-pip
dnf install python3-pip

2. How to Fix “Pip command not found” error in Windows

If you have Python 3 installed on your Windows system and getting a “pip command not found” error in Windows, follow the method below to fix the issues.

Check The Python and Pip Version

Let’s get started!

Check Python Version

First, make sure you have python 3 installed because older versions of python are obsolete right now. Use the following command to verify what version of python you’re running on Windows, for that you can use CMD or Powershell.

python --version

Check Pip Version

If you have verified that you have the latest python version installed, you can check whether you have pip installed or not, to verify use the following command.

pip --version

Now, that we have both python and pip running the latest version, there’s no way we’re gonna receive the pip not found error on windows because everything looks updated. And if you’re receiving errors we’re gonna reinstall everything to avoid misconfigurations issues while installing python and pip and setup path variables.

Reinstall Python on Windows

First, we’re gonna do a fresh installation of python to fix “Pip Command Not Found” errors occurring in the windows machine.

  1. First, go to Settings in Windows and Apps locate Python and uninstall it.
  2. Now, Download the latest version of Python.
  3. Finally, complete the installation process and done.

Install Pip on Windows

Now, that we have a fresh installation of python installed on our Windows system. It’s time to install pip through the command line. Open CMD and type the following command:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Execute the curl command to download that python file. After downloading we have to execute it to start the installation process.

python get-pip.py

After installing pip on your system, follow the steps below to add its path to the environment variables.

Setup Python Environment Variable in Windows 10

If you have successfully installed python and pip on your windows and still getting the “pip command not found” error then there’s something wrong with the environment variables that needed a fix. Follow the steps below:

  1. First, navigate to the “C:\Users\Noor\AppData\Local\Programs\Python\Python310\Scripts” path in my case it’s Noor as a username it would be different for you and locate the pip3.exe file.
  2. Now, Search Environment Variables on Windows and open it.
  3. Click Environment Variables on the Advanced tab.
  4. Under the User variables for Noor, find the Path variable and edit it.
  5. Click on New and add the path that you have copied in the first place and press OK.

Now that pip is in your environment variables, execute ‘pip3‘ from the command prompt.

FAQs

What are the common errors related to pip?

These are the most common errors you may encounter while working with python and pip.

  1. Bash: pip: command not found
  2. Sudo pip command not found in Ubuntu
  3. Pip command not found in mac
  4. pip command not found in Windows
  5. pyenv pip command not found
  6. pip command not found mac python 3
  7. zsh: command not found: pip
  8. ‘pip’ is not recognized as an internal or external command, operable program or batch file

Conclusion

Pip is available with Python in all Windows versions. Linux Python is installed by default; you only need to install pip. If you installed Python correctly, the pip command not found error is unlikely. If you’re still encountering this issue, I hope you can resolve it by following this guide.

Noor Qureshi

Experienced Founder with a demonstrated history of working in the computer software industry. Skilled in Network Security and Information Security.

Related Articles

Back to top button