Python is a free, open-source, powerful programming language widely used by developers. PIP, a “Preferred Installer Program,” is a package manager for installing and managing additional Python packages via the command line. PIP makes your job easier by managing complete lists of packages and corresponding version numbers. PIP is a package manager that connects to the Python Package Index and allows users to install user-defined projects locally using a setup.py file.

This post will explain how to install and use PIP on Arch Linux.

In This Article

Step 1 – Configure Pacman Repo

By default, the default repository is outdated in Arch Linux, so you will need to modify the default mirror list. You can do it by editing the mirror list configuration file:

nano  /etc/pacman.d/mirrorlist

Remove all lines and add the following lines:

## Score: 0.7, United States
Server = http://mirror.us.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.8, United States
Server = http://lug.mtu.edu/archlinux/$repo/os/$arch
Server = http://mirror.nl.leaseweb.net/archlinux/$repo/os/$arch
## Score: 0.9, United Kingdom
Server = http://mirror.bytemark.co.uk/archlinux/$repo/os/$arch
## Score: 1.5, United Kingdom
Server = http://mirrors.manchester.m247.com/arch-linux/$repo/os/$arch
Server = http://archlinux.dcc.fc.up.pt/$repo/os/$arch
## Score: 6.6, United States
Server = http://mirror.cs.pitt.edu/archlinux/$repo/os/$arch
## Score: 6.7, United States
Server = http://mirrors.acm.wpi.edu/archlinux/$repo/os/$arch
## Score: 6.8, United States
Server = http://ftp.osuosl.org/pub/archlinux/$repo/os/$arch
## Score: 7.1, India
Server = http://mirror.cse.iitk.ac.in/archlinux/$repo/os/$arch
## Score: 10.1, United States
Server = http://mirrors.xmission.com/archlinux/$repo/os/$arch

Save and close the file, then update all the package indexes with the following command:

pacman -Syu

Step 2 – Install PIP on Arch Linux

Before installing PIP, Python must be installed on your server. If not installed, you can install it by running the following command:

pacman -S python

After the installation, you can verify the Python version using the following command:

python --version

You should get output similar to:

Python 3.10.8

Next, install PIP using the following command:

pacman -S python-pip

Once PIP is installed, you can verify the installed version of PIP using the following command:

pip3 --version

You should get output similar to:

pip 22.2.2 from /usr/lib/python3.10/site-packages/pip (python 3.10)

Step 3 – How to Update PIP

It is a good idea to update PIP to the latest version. You can update it using the following command:

pip3 install --upgrade pip

You should see the following output:

Requirement already satisfied: pip in /usr/lib/python3.10/site-packages (22.2.2)

You can now verify the PIP version again using the following command:

pip3 --version

You should get output similar to:

pip 22.2.2 from /usr/lib/python3.10/site-packages/pip (python 3.10)

Step 4 – How to Use PIP

You can use the –help option to see a list of all essential options available with PIP:

pip3 --help

You should see the following output:

Usage:   
  pip3  [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  cache                       Inspect and manage pip's wheel cache.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

To install a specific package, run the following command:

pip3 install wheel

To get detailed information about the installed package, run the following command:

pip3 show wheel

You will get the following output:

Name: wheel
Version: 0.37.1
Summary: A built-package format for Python
Home-page: https://github.com/pypa/wheel
Author: Daniel Holth
Author-email: [email protected]
License: MIT
Location: /usr/lib/python3.10/site-packages
Requires: 
Required-by: 

To get a list of all installed packages, run the following command:

pip3 list

You should get output similar to:

Package Version
------- -------
pip     22.2.2
wheel   0.37.1

To get a list of all outdated packages, run the following command:

pip3 list --outdated

To uninstall a specific package from your system, run the following command:

pip3 uninstall wheel

You will get the following output:

Found existing installation: wheel 0.37.1
Uninstalling wheel-0.37.1:
  Would remove:
    /usr/bin/wheel
    /usr/lib/python3.10/site-packages/wheel-0.37.1.dist-info/*
    /usr/lib/python3.10/site-packages/wheel/*
Proceed (Y/n)? y
  Successfully uninstalled wheel-0.37.1

Conclusion

In the above post, you learned how to install and use the PIP package manager on Arch Linux. You also learned how to manage Python packages with PIP. You can now use  PIP to execute the Python dependencies. Try it on a dedicated server hosting from Atlantic.Net!