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:
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
--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:
So I came across 2 solutions to search for a python package:
pypi.orgto search packages (using the browser).
pypisearchas a replacement for
Search Python packages using the browser
If you don't have access to GUI, we have a list of the best terminal-based browsers:
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:
Once you find the package you were looking for, select the package and it will avail you the command for installation at the top:
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
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
Let's say I want to search for the
numpy package so I will be using the following 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:
Once you find the package name, you can refer to the given command syntax to remove pip packages:
pip3 uninstall installed_package_name
So let's say I want to remove a package named
pypisearch, So I will be using the following command:
sudo pip3 uninstall pypisearch
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'
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:
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.