This comprehensive Linux guide expects that you run the following commands as root user but if you decide to run the commands as a different user then ensure that the user has sudo access and that you precede each of the privileged commands with sudo

pip is a standard package-management system used to install and manage software packages written in Python. Many packages can be found in the default source for packages and their dependencies — Python Package Index. Most distributions of Python come with pip preinstalled.

In this tutorial, we will guide you about how to install Python pip on your Ubuntu 18.04 system. Follow the instructions below.

Updating Packages Repository Databse

Before installing pip on your Ubuntu 18.04, you need to update your yum repository cache by running the following command

root@codesposts:~$ apt update

Installing pip

Now, run the following command to install Python pip on your system.

root@codesposts:~$ apt install python-pip

Verifying The Installation

You can verify the version of the pip installed on your system by running the following command.

root@codesposts:~$ pip --version

pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)

Installing Python3 pip

If you want to install the Python3 pip instead of the Python2 pip, you can run the command below

root@codesposts:~$ apt install python3-pip

Verifying The Version

Run the following command to verify the version of pip3 installed on your system.

root@codesposts:~$ pip3 --version

pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Installing Packages Using pip

To install a package using the pip, run the command like below

root@codesposts:~$ pip install twitter
OR
root@codesposts:~$ pip3 install twitter

Replace the “twitter” with the package name you want to install.

Displaying All Installed Packages

You can display the list of all the packages installed on your system using pip by running the command below

root@codesposts:~$ pip list

DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
asn1crypto (0.24.0)
colorama (0.4.1)
configobj (5.0.6)
cryptography (2.1.4)
enum34 (1.1.6)
idna (2.6)
ipaddress (1.0.17)
IPy (1.0)
keyring (10.6.0)
keyrings.alt (3.0)
pip (9.0.1)
pycrypto (2.6.1)
pyfiglet (0.8.post1)
pygobject (3.26.1)

Removing A Package

If you want to remove a package, you can run the command below

root@codesposts:~$ pip uninstall twitter

Replace the “twitter” with the package name you want to install.