How to fix "bash: pip: command not found" on Arch Linux

Endrit Qerreti

Endrit Qerreti

So you tried running pip command on Arch Linux, and you got the error "bash: pip: command not found" on the terminal?

This error happens because python package index (pip) it's not installed on your system.

The good news is that, this issue can be fixed by installing pip on your system. All it takes is one single line command to install pip.

In this tutorial, you will learn how to install pip on Arch Linux.

Step 1 - Update your system

Checking for updates on Arch Linux is easy, and it can be done similarly as other linux distros. Simply open your terminal, and run the update command

sudo pacman -Syu

Step 2 - Install pip

If there are packages to be updated on your system, make sure to update them and reboot your system, before installing pip. Once everything is updated, you can install pip.

python-pip is available on the main repository of Arch Linux, so you can use its default package manager pacman

On your terminal, run the following command

sudo pacman -S python-pip

Next, you need to confirm pip installation. Simply press Y on this prompt, and then enter so pip installation begins.

You will see the following output on the terminal, this means pip got installed on your system.

Step 4 - Create a Virtual environment

A virtual environment is recommended to use so PIP doesn't conflict with pacman. To create a virtual environment, first you need to install the virtualenv package

sudo pacman -S python-virtualenv

Next, create a virtual environment.

virtualenv -p /usr/bin/python3 myvirtualenv

Replace:myvirtualenv with the path of your virtual environment.

For example, let's create a directory called virtualenv on /home and use this directory as our virtual environment.

virtualenv -p /usr/bin/python3 virtualenv

Next, activate the new virtual environment

source virtualenv/bin/activate

And you should be good to install packages with pip now.

Step 3 - Update PIP

Now that PIP is installed, you need to update it. Launch terminal, and run the following command to do this

pip install --upgrade pip

Step 5 - Use PIP

Managing packages with PIP is easy. Here are some useful PIP commands that you should know

Install a package with PIP

To install a package with pip, you need to use the install command.

pip install package-name

Where package-name is the package that you are installing

Uninstall a package with PIP

To uninstall a package with PIP, you can use the uninstall command.

pip uninstall package-name

Download a package with PIP

If you are looking to download a package but not install it on your system, then you can do so, by using the download command.

pip download package-name

List all installed packages with PIP

To view all PIP packages that are installed on your system, you need to use the list command

pip list

Conclusion

In this tutorial, you learned how to fix the error "bash: pip: command not found" when trying to run a pip command on Arch Linux.