Reading Time: 3 minutes

What is PIP?

In this article, we will discuss how to install PIP on Ubuntu 18.04. PIP is a tool used to install and manage Python packages. This tutorial will show how to install and check the version of PIP as well as run a few basic commands for using PIP on Ubuntu 18.04.

The Python programming language is deemed to be one of the most popular and easiest to learn due to its emphasis on code readability. Python is cross-platform, which means it can be run on multiple operating systems, including Windows Server OS. We do need to note that PIP is not installed by default on Ubuntu 18.04.

Pre-Flight Check

  • These instructions are based on a Ubuntu 18.04 LTS server. We are logged in as the root user.
  • If you are using a different operating system, check out our other pip installation guides.
  • We need to confirm that Python is installed.

Verify Python Is Installed

To verify that Python is installed on your server, run the following command:

root@host:~# python
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.

This checks the Python version and ensures that Python 3 is installed on our Ubuntu system. Exit out of the Python shell by typing Ctrl+C.

Install PIP

Let's start by updating Ubuntu.

root@host:~#  apt update
root@host:~# python3 --version
Python 3.7.5

Next, we install PIP.

root@host:~# apt install python3-pip
After this operation, 129 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up python3.6-dev (3.6.8-1~18.04.3) ...
Setting up libpython3-dev:amd64 (3.6.7-1~18.04) ...
Setting up build-essential (12.4ubuntu1) ...
Setting up python3-dev (3.6.7-1~18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

Now, let's check the version we have installed.

root@host:~# pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Use Cases

In order to use PIP, we have several options. We can stay within a virtual environment to test out programs within a distinct or “virtual” Python environment, or we can run PIP globally, which runs the programs on the server itself. In this case, we will work on our projects within a virtual Python environment (using venv) to limit any interaction with the project’s dependencies and to avoid wider conflicts with the system’s default Python environment. To show all of the available options for pip, we can run:

root@host:~# pip3 --help

  pip3 <command> [options]

  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.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING,
                              ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
  --trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
                              Don't periodically check PyPI to determine whether a new version of pip is available for download.
                              Implied with --no-index.

You can also get more information about a "specific" PIP command using pip --help. For example to get more information about the install command, type:

root@host:~# pip3 install --help

To search for a specific package, we can use:

root@host:~# pip3 search <search_string>

root@host:~# pip3 search pypi
go-pypi (0.0.4)                       - Go pypi
pypi-api (0)                          - pypi-api
upt-pypi (0.5)                        - PyPI frontend for upt
pypi-chat (0.0.4)                     - A project of pypi chat.
pypi-xmlrpc (2019.4.13)               - pypi XML-RPC
Flask-Pypi-Proxy (0.5.1)              - A Pypi proxy
pypi-task-demo (0.0.1)                - PyPI demo
pypi-test-fiveplus (0.0.2)            - PyPI Test
hello-pypi-yue (0.1.1)                - The Pypi test
aeverall-testing-pypi (0.1)           - Test of PyPI

To see all of the installed packages, we can run:

pip3 search installed package

This will usually output a significant number of packages.

To install a package using PIP, we use:

pip3 install <package_name>

Finally, to uninstall a package using PIP, we simply run:

pip3 uninstall <installed_package_name>

Check Us Out!

Should you run into any issues using PIP, simply reach out to one of our experienced systems administrators who can provide more information about this handy tool!

About the Author: David Singer

I am a g33k, Linux blogger, developer, student, and former Tech Writer for My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Have Some Questions?

Our Sales and Support teams are available 24 hours by phone or e-mail to assist.


Latest Articles

What is an Intrusion Prevention System (IPS)?

Read Article

Premium Business Email Pricing FAQ

Read Article

What is the Fortran Programming Language?

Read Article

Microsoft Exchange Server Security Update

Read Article

How to Monitor Your Server in WHM

Read Article