How to Install Pip on Ubuntu 16.04

How to Install Pip on Ubuntu 16.04

Pip is an acronym for ‘Pip Installs Packages’. It is a package manager that makes it easier for installing and managing python packages. It will be installed by default in latest version of python.
Python-pip will be already installed if you are using python version greater than or equal to 2.7.9 OR if Python version is greater than or equal to 3.4.

Execute the command ‘pip –version’ to check whether pip is already installed on your Ubuntu server. If it is already installed then it will show the version of pip installed. Follow the below steps if pip is not installed on your ubuntu server.

 

Install pip using apt package manager

1. You must log into your Linux server via SSH as root user OR login as user with sudo privileges. Use putty software to connect to your ubuntu server via SSH.

2. Run ‘apt-get update’ to update the package list.

3. Check the version of python installed on the server.

Command : python --version

4. Install python-pip package

Run the below command if the Python version installed on your server is 3.x:

sudo apt-get install python3-pip

Execute the below command if the Python version installed on your server is 2.x:

sudo apt-get install python-pip

5. Now pip is installed, run the command ‘pip –version’ or ‘pip -V’ to check the version of pip installed

# pip --version
pip 9.0.3 from /usr/local/lib/python3.5/dist-packages (python 3.5)

# pip -V
pip 9.0.3 from /usr/local/lib/python3.5/dist-packages (python 3.5)

 

Installing pip with get-pip.py

1. Log into Ubuntu server as root user OR user with sudo privileges.

2. Download get-pip.py from pypa.io website

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

3. After download, run ‘python get-pip.py’ to install pip

4. Run ‘pip –help’ to show help for pip commands.

 

# pip --help

Usage:
pip [options]

Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
check Verify installed packages have compatible dependencies.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion.
help Show help for commands.

General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).
--log Path to a verbose appending log.
--proxy Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries Maximum number of retries each connection should attempt (default 5 times).
--timeout Set the socket timeout (default 15 seconds).
--exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert Path to alternate CA bundle.
--client-cert Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
--cache-dir

Store the cache data in .
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.