Python is a free, open-source, high-level programming language used by thousands of developers worldwide. PIP is a Preferred Installer Program for installing and managing additional Python packages via the command line. PIP makes it easier to manage complete lists of packages and corresponding version numbers. PIP is a standard package manager that connects to an online repository of public packages called the Python Package Index, and allows users to install user-defined projects locally with the use of a setup.py file.

In this post, we will explain how to install and use PIP on Oracle Linux 8.

Step 1 – Install PIP on Oracle Linux 8

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

dnf update -y
dnf install python39 -y

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

python3.9 --version

You should get the following output:

Python 3.9.7

Next, install PIP using the following command:

dnf install python39-pip -y

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

pip3 --version

You should see the following output:

pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

Step 2 – 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:

Collecting pip
  Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 507kB/s 
Installing collected packages: pip
Successfully installed pip-21.3.1

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

pip3 --version

You should see the following output:

pip 21.3.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)

Step 3 – How to Use PIP

To see a list of all important options available with PIP, use the following command:

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:

Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
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/local/lib/python3.6/site-packages
Requires: 
Required-by: 

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

pip3 list

You should see the following output:

Package             Version
------------------- -------
configobj           5.0.6
configshell-fb      1.1.28
dbus-python         1.2.4
decorator           4.2.1
fail2ban            0.11.2
gpg                 1.13.1
isc                 2.0
kmod                0.1
libcomps            0.1.16

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

pip3 list --outdated

You should see the following output:

Package         Version Latest   Type
--------------- ------- -------- -----
configshell-fb  1.1.28  1.1.29   sdist
dbus-python     1.2.4   1.2.18   sdist
decorator       4.2.1   5.1.1    wheel
kmod            0.1     0.9.2    sdist
ply             3.9     3.11     wheel
PyGObject       3.28.3  3.42.1   sdist
pyparsing       2.1.10  3.0.9    wheel
python-dateutil 2.6.1   2.8.2    wheel
pyudev          0.21.0  0.23.2   wheel
PyYAML          3.12    6.0      wheel
setuptools      39.2.0  59.6.0   wheel
six             1.11.0  1.16.0   wheel
slip            0.6.4   20191113 sdist
urwid           1.3.1   2.1.2    sdist

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

pip3 uninstall wheel

Conclusion

In the above article, we explained how to install and use PIP on Oracle Linux 8. We also showed you how to manage Python packages with PIP. You can now easily use PIP to manage the Python dependencies. Try it on VPS hosting from Atlantic.Net!