PIP is a package management system used for installation and management of software packages in Python. PIP stands for Python Package Index (PyPI).
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Python queries on Linyx systems.
In this context, we shall look into how to install PIP on Ubuntu 18.04 system. Before you start installation of PIP, you should logged in as root user with sudo privileges.
By default, Python 3 is pre-installed with Ubuntu 18.04. Follow the below steps to install PIP for Python 3.
i. Begin by updating the system package list using below command:
$ sudo apt update
ii. Next, execute below command to install pip:
$ sudo apt install python3-pip
iii. Once the installation is finished you can verify installation by typing:
$ pip3 --version
Note that the Version number of PIP may change with time.
To begin with this installation procedure, ensure that the system is up to date. In order to update the package manager index by issue below command:
$ sudo apt update
After that you need to install Python 2 as it's not pre-installed. So run following command to install Python 2 and PIP for it:
$ sudo apt install python-pip
After Installation is completed, you can confirm the version of pip by running the below command:
$ pip --version
In this section, we will see some useful basic pip commands. First of all to get the list of all the commands in PIP issue below command:
$ pip3 --help
If you want to get information for particular command then issue command as below:
$ pip install --help
Above command will give details about install command.
To search package using PIP just type as below:
$ pip3 search PACKAGE_NAME
You should replace PACKAGE_NAME with the name of package which you want to search.
Below is the syntax to install package with PIP:
$ pip3 install PACKAGE_NAME
Same as search replace the PACKAGE_NAME with package name.
You can install packages using requirements file. requirement.txt is a text file that contains a list of pip packages with their versions which are required to run a specific Python project. Use below command to install a list of requirements specified in a file:
$ pip3 install -r requirements.txt
You can upgrade already installed packages to latest version using below command:
$ pip3 install --upgrade PACKAGE_NAME
To uninstall package with pip issue the below command:
$ pip3 uninstall PACKAGE_NAME
Note : If you are using Python 2 then replace pip3 with pip when issuing commands.
This article covers how to install PIP on Ubuntu 18.04 for Python 3 and Python 2. In fact, PIP is the default package manager for Python packages which allows you to install, and manage Python packages in an easy and convenient manner.
How to Install pip for Python3 ?
Pip3 can be installed on Ubuntu using the APT package manager.
1. To start off, update the package lists as shown:
$ sudo apt update
2. To install pip3 run the command:
$ sudo apt install python3-pip
3. Verify that pip3 is installed by running the command:
$ pip3 --version
For assistance on more command options and usage of pip3, run the below command:
$ pip3 --help