In this tutorial, we will show you how to install pip on an Ubuntu 18.04 VPS.
Pip is a package management system which can be used to install and manage packages written in Python. Python is a programming language that allows you to perform web development, software development, system administration, scientific and numeric data analysis, and much more. The Python Package Index (PyPI) hosts thousands of third-party modules for Python and you can install any of these modules using the pip package manager. Installing Pip on Ubuntu 18.04 is a very easy task, and if you follow our instructions carefully, you will have pip installed on your Ubuntu 18.04 VPS in just a few minutes. Let’s get started with the installation.
Prerequisites:
- An Ubuntu 18.04 VPS
- Access to the root account, or to a user with sudo privileges.
Step 1: Connect to the Server
To connect to your server via SSH as the root user, use the following command:
and replace “IP_ADDRESS” and “PORT_NUMBER” with your actual server IP address and SSH port number. You can use the username of an admin account in place of the word ‘root’ if needed.
Once logged in, make sure that your server is up-to-date by running the following commands:
Step 2: Install pip for Python 3
Python 3 is the default version that comes with Ubuntu 18.04. To check if pip for Python 3 is already installed on your server, run the following command:
If pip3 is not installed, you will get the following output:
We can now install pip3 by running the following command:
After the installation is completed, you can now check again whether pip3 as been successfully installed with:
If pip3 has been successfully installed, you should get the following output on your screen:
Step 3: Install pip for Python 2 (optional)
If you want to use Python 2 instead of the default Python 3 version on your Ubuntu 18.04 server, you can follow these instructions, instead.
First, check if pip (for Python 2) is installed on your server with:
If pip is not installed, you will get the following output:
To install pip and Python 2 on your server, run the following command:
After the installation is completed, you can verify it with the following command:
The following output should be displayed on your screen:
Step 4: Basic pip3 Commands
Now that you have successfully installed pip3 on your server, we will show you how to use it by going over a few basics.
The basic syntax for pip3 is the following:
Here are some useful commands to help you get started with using pip3.
To search for a package, run the following command:
To install a package:
To list all installed packages:
To uninstall a package:
For more pip3 options and usage examples, you can run the following command:
And if you want to get more information about any specific command, you can use the following command:
Congratulations – you now have an instance of Pip installed, and you know more about how to use it.
Of course, you don’t have to install pip on Ubuntu 18.04 if you use one of our Python VPS Hosting services, in which case you can simply ask our expert Linux admins to install pip on Ubuntu 18.04 for you. They are available 24×7 and will take care of your request immediately. We also published a post on How to Install pip on Ubuntu 20.04.
PS. If you liked this post on how to install pip on Ubuntu 18.04, please share it with your friends on the social networks by using the buttons below, or simply leave a reply down in the comments section. Thanks.
Here’s a link to our new version: How to install pip on Ubuntu 20.04.