Mondoze Knowledge Base

Search our articles or browse by category below

Linux Based VPS Easy Python 2 Pip Installation Guide for Ubuntu 18.04

Last modified: October 7, 2022
You are here:
Estimated reading time: 2 min

If you are working on a Linux based VPS, regardless of being a VPS administrator, software developer, or others, you might have to install pip onto your VPS as long as Python programming languages are involved. Pip is a package management system that allows users to install Python packages using a terminal.

For this guide, we will be guiding you on how to install Python 2 Pip on Ubuntu 18.04.

Step 1: Check if the system runs Python 2

For this step, you have to make sure that your Ubuntu 18.04 system is running Python 2. To do so, open the terminal by right-clicking on the desktop and selecting the option “Open Terminal”. Alternatively, you can press Ctrl+Alt+T from your keyboard. After that, type in the following command to check the version of Python 2 in your system.

python2 -version

Step 2: Update

Before making any installation, it is always wiser to keep the repository package updated. In order to do that, type in the following command into the terminal and run it.

sudo apt update

Step 3: Installation

After finishing updating the repository package, you can start the Python2 and pip installation. You can easily install pip by using the following command.

sudo apt install python-pip

During the installation process, all dependencies that are required for building Python modules will be installed. If there are any requests regarding the confirmation for installation, you will need to enter Y or “Enter” Key for the installation to complete.

Step 4: Verifying files

After the installation is completed, you would have to verify if the installation is truly completed and the version you have installed. Use the following command to verify the pip version installed.

pip -version

To know if the installation is completed, you will see an output in your terminal as follow.

Processing triggers for man-db (2.8.3-2ubuntu0.1) …
Processing triggers for libc-bin (2.27-3ubuntu1.4) …
[root@mondoze:~# pip –version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
root@mondoze-testing:~#

You should be able to see your pip version installed, and if there is no result, it means that your installation has failed. Retrace to the earlier steps again for the installation.

After that, you may choose to run to following code to install a text file that shows a list of packages that can be installed using the pip command. To install the text file, type:

sudo pip install -r requirements.txt

Finally, to ensure you have the latest version of pip that supports Python 2, type in the following command to upgrade pip to the latest version.

sudo pip install -upgrade pip

With this, you have successfully installed pip into your Ubuntu 18.04.

Was this article helpful?
Dislike 0
Views: 17