How to Install Python 3 Pip on Ubuntu 22.04

How to Install Python 3 Pip on Ubuntu 22.04

Whether you’re a VPS web server administrator, a software developer, or a general user, you might need to install pip3 on Ubuntu. As a package management system, pip lets you install packages of software written in the Python programming language.

In this tutorial, we will explain what pip is, how it works, and the ways to install pip on Ubuntu using Python 3. Finally, we’ll also go over how to install a pip package.

How to Install Pip 3 on Ubuntu 22.04

Pip for Python 3 is commonly referred to as pip3. Fortunately, Ubuntu 22.04 has Python 3 installed by default. However, you will still need to install pip3 manually. Follow these steps:

  1. Open the terminal.
  2. To update the repository package list, run the following command:
sudo apt update
  1. Install pip for Python 3 and all the dependencies by entering this command:
sudo apt install python3-pip
installing pip for python 3
  1. Verify the installation by printing your version number of pip:
pip3 --version
command line output verifying the installation
  1. To upgrade pip to the newest version, run the following command:
sudo pip3 install --upgrade pip
upgrading pip to the newest version

How to Install a Pip Package

Now that you have installed pip on your Ubuntu machine, you can start installing Python packages found in the Python Package Index (PyPI) with pip and manage them using various commands.

To install a package, run:

pip3 install <package name>

For example, here’s how to install Scrapy – the web-crawling framework tool – on a machine running Python 3:

pip3 install scrapy

To install a specific version of a package with pip, specify the version number in the command. For example, run this command if you want to install Scrapy 1.5:

pip3 install scrapy==1.5

To update an installed package to the newest version that’s available on the Python Package Index (PyPI), enter this command:

pip3 install <package_name> --upgrade

For example, enter this command to update Scrapy on a machine that’s running Python 3:

pip3 install scrapy --upgrade
command line output after running command to update scrapy on a machine running python 3

Sometimes, you will want to remove installed pip packages. To uninstall a package on Python 3, run the following command:

pip3 uninstall <package_name>

What Is Pip and What Does It Do?

Pip, which stands for “pip installs packages”, is a command-line package management system for software written in the Python programming language. Once installed, pip allows you to install and manage Python packages from the command line or a terminal program.

A Python package is a collection of Python modules. They contain Python definitions and statements, usually including runnable code.

Pip eases the process of installing and managing Python modules and packages because it connects to the Python Package Index (PyPI) – the official third-party software repository for Python.

When a user installs Python packages using pip, the package manager will resolve all the dependencies and check whether the chosen software packages are already installed. If pip finds that the software hasn’t been installed, it will install them on the machine.

Conclusion

Pip is a helpful command line package manager and installer for Ubuntu. Using various commands, pip allows you to manage Python software packages from the Ubuntu terminal.

In this tutorial, you have learned how to install pip on Ubuntu machines running Python 3.

We hope you’ve found this article helpful and wish you the best of luck in your future projects with pip3 on Ubuntu.

Author
The author

Hasna A.

Hasna is passionate about tech, culture, and the written word. She hopes to create content that helps people succeed on the web. When not writing, rearranging, or polishing sentences, she enjoys live music and overanalyzing movies.