Install Pip Ubuntu: A Detailed Guide to Cover Every Step

install pip ubuntu
install pip ubuntu

Pip is very important for managing packages and dependencies, if you are working with Python on a device running Ubuntu. Wherever possible, at Unixmen we also share how a command got its name. Pip is short for “Pip Installs Packages”. Pip is a package management system that is used to install and manage software packages written in Python. In this article, let Unixmen take you through the instructions to install Pip on Ubuntu and also a little more like managing packages.

Why is Pip famous?

At Unixmen, we do not just cover the basic installation process. We also let the readers know why it is essential and also the common pitfalls. Put simply, Pip is a command line tool that lets you install Python packages from indexes like the Python Package Index (PyPI). Pip becomes a very handy tool when you are either doing simple experiments with Python, working with popular data science tools, or developing a web based application.

Pip offers you the capability to easily install, upgrade, and uninstall Python packages. This capability becomes very helpful for Python developers. Pip also handled the package dependencies, making sure the users have the correct versions of libraries that your experiment or project requires.

Installing Pip on Ubuntu Prerequisites

Before you install Pip on Ubuntu systems, make sure you satisfy a few prerequisites that are required. Here they are:

  • A system with Ubuntu 20.04 LTS or higher versions.
  • Sudo or administrative privileges to install software on your system

Update Package List on Ubuntu

Before we install Pip, you have to ensure that you have access to the latest software versions. To do this, open your Terminal window and run the following command:

sudo apt update

Running this command updates the list of existing packages and their versions but does not install or upgrade any packages.

Install Python on Ubuntu

You need to have Python installed on your Ubuntu system because Pip is a package manager for Python. Ubuntu developers have packaged Python 3 along with Ubuntu 20.04 and later versions. It would be wise if you check Python is installed by executing this command in the Terminal window:

python3 --version

If Python 3 is not installed in your Ubuntu system, you can install it by executing the command:

sudo apt install python3

Running this command installs Python 3 along with its package manager.

How to Install Pip on Ubuntu with Python 3

Now that we have installed Python, the next step is to proceed with installing Pip. APT, Ubuntu’s package manager, includes Pip in its default repo. To install Pip for Python 3, execute this command in the Terminal window:

sudo apt install python3-pip

Running this command installs Pip and all its dependency packages. Once the installation is complete, to check the version of Pip installed, execute this command in the Terminal window:

pip3 --version

If the output displays the version of Pip installed on your system, the installation has been successful. If the installation was unsuccessful for any reason, simply install Pip again.

Install a Sample Package using Pip

Just to ensure Pip is installed correctly and works properly, we encourage you to install a sample Python package using Pip. We recommend this so that there are no unwanted surprises when you are in a hurry and require Pip but at that moment, Pip fails to work.

At this instance, let’s see how you can install the “requests” library, a popular Python library for making HTTP requests, using Pip. Execute the command:

pip3 install requests

If the installation runs successfully, we can determine that Pip works on your Ubuntu system perfectly. To triple check if the installation was seamless, execute the command:

pip3 show requests

The output will display all information like installed package, location, dependencies, and version.

How to Manage Python Packages with Pip

Once Pip is installed, the next step is to manage Python packages effectively. Let us learn some basic Pip commands. Here are some basic syntaxes:

  • To install a package:
    pip3 install package_name
  • To upgrade a package:
    pip3 install --upgrade package_name
  • To uninstall a package:
    pip3 uninstall package_name
  • To view the list of all installed Python packages:
    pip3 list

Wrapping Up

As we have learnt, installing Pip on an Ubuntu device is a very simple but rewarding process. We encourage you to install Pip on Ubuntu systems to make use of very helpful Python packages. Pip makes your life easier by handling dependencies as well.

Related Link

Pip’s official documentation to install Pip on Ubuntu

Some More Articles that would be of Interest to You