How to Perform a Full Re-Installation of PIP and PIP3 on Ubuntu?

The “pip” is the official package manager and “pip” command for “python2” whereas the “pip3” is the updated version of “pip” for Python 3. Both these tools are used to install third-party packages that are not available in the standard Python Library. 

While working with these package managers, the executable or any other missing files may keep on causing continuous disruption. So, reinstallation seems to be the possible solution. 

This post lists the complete procedure to reinstall “pip” and “pip3” in the most used Linux distro Ubuntu.

Prerequisites: Uninstall the Current Version 

The existing “pip” and “pip3” packages should be completely removed from the system before their re-installation. Let’s see how these packages can be uninstalled/removed.

Execute the “apt” command with “autoremove(remove dependencies)” and the “–purge(remove configuration files)” flags to remove “pip” and “pip3”:

Uninstall “pip”:

$ sudo apt autoremove --purge python-pip

The “pip” package has been fully uninstalled from the system.

Uninstall “pip3”:

$ sudo apt autoremove --purge python3-pip

The “pip3” package has been fully removed.

How to Re-Install “pip” in Ubuntu?

The “pip” package manager re-installation requires a few necessary steps that are discussed below:

Step 1: Update Ubuntu Repositories

First, update the ubuntu default repositories to get the latest release of a newly installed application. For this, use the “apt” package manager with superuser privileges i.e “sudo” to perform this task:

$ sudo apt update

The system packages updated version list has been displayed in the terminal.

Step 2: Install “pip” in Ubuntu

The “pip” is used with python2 (named as python as well), and can be installed as follows: 

$ sudo apt install python-pip

The “pip2” and its required dependencies have been installed in Ubuntu 22.04 LTS.

Step 3: Verify “pip”

As the “pip” is for the “python2” so specify the “2” with the “pip” to check its version again using the “version” flag:

$ pip2 --version

The “pip” package manager has been completely reinstalled having the “20.3.4” version.

How to Re-install “pip3” in Ubuntu?

The re-installation of “pip3” follows the same steps of guidelines as performed for the “pip”.

Step 1: Update System Repositories

Same as the first step of (Method1), update the system repositories of Ubuntu using the “apt” package manager:

$ sudo apt update

Step 2: Install “pip3” in Ubuntu

The “pip3” is the official package manager of “python3” and can be installed on Ubuntu as follows: 

$ sudo apt install python3-pip

The “pip3” has been completely reinstalled into the current Ubuntu system

Step 3: Verify “pip3”

Check the installed “pip” version for verification purpose. To do so, run the “pip” as a command with the “–version” flag in this way:

$ pip3 --version

It is verified that “pip3” has been completely reinstalled having the “22.0.2” version.

Conclusion

For the re-installation, first, remove the current versions of PIP and PIP3 using the “apt remove” commands. After that, you can install the PIP and PIP3 to get the latest versions of these on your Ubuntu systems. 

This post has listed the uninstallation as well as the installation methods of PIP and PIP3 on Ubuntu.