Python Ubuntu
How To

How to Install pip3 on Ubuntu

Sagar Sharma
Sagar Sharma

Table of Contents

Pip (Pip Installs Packages) is a command line utility to install and manage packages written in Python.

So in this guide, I will be covering the following:

  • Installing pip3
  • Using pip3 to install packages
  • Removing pip3 packages

Install pip3 on Ubuntu

As the pip package is available in the default repository so all you'd need to do is execute a single command for the installation:

sudo apt install python3-pip

Once you are done with the installation, you can check the installed version of pip:

pip3 --version
check the installed version of pip on ubuntu

And if you get similar output, congratulations, you have successfully installed the pip3 package on Ubuntu.

Using pip on Ubuntu

Once you install the pip, you must be excited about installing packages so I will start with how you can install packages using pip.

How to install packages using pip

There are two ways to install a package using pip.

  • Installing for specific users (without sudo)
  • Systemwide installation (needs sudo)

Install pip package for currently logged-in user

So if you want to install a python package for a specific user, you can follow the given command syntax:

pip3 install --user python_package_name

Here, the --user is used to install packages for currently logged-in users.

So let's say I want to install a package named pypisearch for the currently logged-in user, so I will be using the following command:

pip install --user pypisearch

Systemwide installation of pip package

If you want to perform system-wide installation, you can refer to the given command syntax:

sudo pip3 install python_package_name

For example, if I want to install a package named NumPy systemwide, I will be using the following command:

sudo pip3 install numpy

How to search python packages using pip

Generally, users would use the pip search command to search for packages but it is no longer working.

And when I tried searching for package names stress, it gave me the following error:

PyPI no longer supports 'pip search' (or XML-RPC search).

So I came across 2 solutions to search for a python package:

  • Use pypi.org to search packages (using the browser).
  • Use pypisearch as a replacement for pip search.

Search Python packages using the browser

If you don't have access to GUI, we have a list of the best terminal-based browsers:

You can Surf Internet in Linux Terminal With These Command Line Browsers
I’m guessing that you are probably using Firefox or a Chrome-based browser like Brave to read this article. Or, maybe, Google Chrome or Chromium or other web browsers available for Linux. In other words, you are utilizing a GUI-based approach to browse the web. However, back in the days,

To search packages using a browser, all you need to do is visit pypi.org and enter the name of the package you are looking for:

search python packages using browser

Once you find the package you were looking for, select the package and it will avail you the command for installation at the top:

install python package using the browserpackage

Yep, it is that simple!

Search python packages using the pypisearch utility

Like me, if you embrace terminal always, I found a replacement for pip search command named pypisearch.

But first, you will have to install it using the following command:

sudo pip install pypisearch

Once you are done with the installation, you can search the packages by appending their names to the pypisearch command:

pypisearch python_package_name

Let's say I want to search for the numpy package so I will be using the following command:

pypisearch numpy
search pip packages in ubuntu using the pypisearch command

And as you get the description for every result, it is quite easy to find what you were looking more.

Remove pip packages from Ubuntu

To remove any package, the first step is to know the exact name of that package and it can easily be found by listing installed packages.

To list installed packages, append the list flag to the pip3 command as shown:

pip3 list
list installed pip packages in ubuntu

Once you find the package name, you can refer to the given command syntax to remove pip packages:

pip3 uninstall installed_package_name
⚠️
You will need superuser privileges if you performed a systemwide installation (used sudo while installing). 

So let's say I want to remove a package named pypisearch, So I will be using the following command:

sudo pip3 uninstall pypisearch
uninstall pip package from ubuntu

You can also list the installed package to confirm whether the package was successfully removed or not.

You can also use the grep command if you have various packages installed and you don't want to scroll through them:

pip3 list | grep 'package_name'
varify the pip package is installed or not on ubuntu

And if you get the empty output as mine, the package is no longer available on this system.

Looking for a good IDE for Python?

If you are in search of a feature-rich IDE for Python, your search should end here:

Best Python IDEs for Linux
Whether a coder or not, you must have heard about Python Programming language in some capacity. Python is used extensively in Artificial Intelligence and Machine Learning, some of the most popular buzzwords in computing. Being a popular programming language, you may already know or be intereste…

And if you have any queries related to this topic or have discovered a brilliant tool that should reach everyone, let me know in the comments.