Linux: Install pip Client To Install Python Packages

The pip command is a tool for installing and managing Python packages, such as those found in the Python Package Index. It’s a replacement for easy_install. pip is very useful for web development as well as for sys-admins who manages cloud computing based resources created Openstack, Rackspace, AWS, Google and other cloud computing service providers. The pip command can be installed in two different methods:
Method #1: pip for all users with root privileges required. It is recommended that you use package manager to install the pip.
Method #2: pip for a single user with no root privileges required. It is recommended that you use virtualenv script, which create isolated Python environments in your $HOME directory.
Warning examples may crash your computerWARNING! Only use any one of the following method to install pip. Do not install pip using both methods.
Method #1: Install pip for all users

The pip command is not installed by default. You need to install it as per your distro.

RHEL / CentOS / Fedora Linux installation

First, turn on EPEL repo for RHEL / CentOS Linux. Next, type the following yum command under RHEL / CentOS / Fedora Linux to install python-pip package:
# yum -y install python-pip

Sample outputs:

Loaded plugins: product-id, refresh-packagekit, rhnplugin, security,
: subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package python-pip.noarch 0:0.8-1.el6 will be installed
–> Processing Dependency: python-setuptools for package: python-pip-0.8-1.el6.noarch
–> Running transaction check
—> Package python-setuptools.noarch 0:0.6.10-3.el6 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

Package Arch Version Repository Size
python-pip noarch 0.8-1.el6 epel 178 k
Installing for dependencies:
python-setuptools noarch 0.6.10-3.el6 rhel-x86_64-workstation-6 336 k

Transaction Summary
Install 2 Package(s)

Total download size: 513 k
Installed size: 764 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): python-pip-0.8-1.el6.noarch.rpm | 178 kB 00:01
(2/2): python-setuptools-0.6.10-3.el6.noarch.rpm | 336 kB 00:00
Total 63 kB/s | 513 kB 00:08
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6)
Package: epel-release-6-7.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : python-setuptools-0.6.10-3.el6.noarch 1/2
Installing : python-pip-0.8-1.el6.noarch 2/2
Installed products updated.
Verifying : python-setuptools-0.6.10-3.el6.noarch 1/2
Verifying : python-pip-0.8-1.el6.noarch 2/2

python-pip.noarch 0:0.8-1.el6

Dependency Installed:
python-setuptools.noarch 0:0.6.10-3.el6


Please note that name of the command is pyton-pip under RHEL and friends. I recommend that you add the following alias to your ~/.bashrc file, enter:

$ echo ‘alias pip=”/usr/bin/pip-python”‘ >> $HOME/.bashrc
$ . $HOME/.bashrc

Debian / Ubuntu Linux installation

Type the following apt-get command to install
# apt-get install python-pip

$ sudo apt-get install python-pip

Sample outputs:

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 67.8 kB of archives.
After this operation, 332 kB of additional disk space will be used.
Get:1 squeeze/main python-pip all 0.7.2-1 [67.8 kB]
Fetched 67.8 kB in 1s (40.4 kB/s)
Selecting previously deselected package python-pip.
(Reading database … 274928 files and directories currently installed.)
Unpacking python-pip (from …/python-pip_0.7.2-1_all.deb) …
Processing triggers for man-db …
Setting up python-pip (0.7.2-1) …
Processing triggers for python-support …
Method #2: Install pip for a single user

This method does not require root access or modify your system Python installation. Type the following command:

curl -O
Sample outputs:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 107k 100 107k 0 0 35120 0 0:00:03 0:00:03 –:–:– 49618
Create your own virtual environment called py_virtual:

python py_virtual
Sample outputs:

New python executable in py_virtual/bin/python
Installing setuptools……………………….done.
Installing pip…………………done.
Activate your new virtual environment, run:

. py_virtual/bin/activate
Sample outputs (note prompt changed):

How do I use pip command?

To install new python package type:

pip install packageName
To uninstall python package installed by pip type:

pip uninstall packageName
To search python package type:

pip search packageName
To see a list of all commands type:

pip help
Sample outputs

–version show program’s version number and exit
-h, –help Show help
-v, –verbose Give more output
-q, –quiet Give less output
–log Log file where a complete (maximum verbosity) record will be kept
–proxy Specify a proxy in the form user:passwd@proxy.server:port. Note that the user:password@ is optional and required only if you
are behind an authenticated proxy. If you provide user@proxy.server:port then you will be prompted for a password.
–timeout Set the socket timeout (default 15 seconds)
Default action when a path already exists. Use this option more than one time to specify another action if a certain option is
not available. Choices: (s)witch, (i)gnore, (w)ipe, (b)ackup
Commands available:
bundle: Create pybundles (archives containing multiple packages)
freeze: Output all currently installed packages (exact versions) to stdout
help: Show available commands
install: Install packages
search: Search PyPI
uninstall: Uninstall packages
unzip: Unzip individual packages
zip: Zip individual packages

Search all openstack cloud releated tools:

pip search openstack
Sample outputs:

ftp-cloudfs – FTP interface to Rackspace Cloud Files and OpenStack Swift
vaporize – A clean and consistent library for the Rackspace Cloud / OpenStack
openstack.nose_plugin – openstack style output for nosetests
nova-adminclient – client for administering OpenStack Nova
python-glanceclient – Client library for OpenStack Image API
python-novaclient – Client library for OpenStack Nova API.
python-quantumclient – CLI and python client library for OpenStack Quantum
python-melangeclient – Client library for OpenStack Melange API.
txAWS – Async library for EC2, OpenStack, and Eucalyptus
python-swiftclient – Client Library for OpenStack Object Storage API
python-keystoneclient – Client library for OpenStack Keystone API
django_openstack_auth – A Django authentication backend for use with the OpenStack Keystone Identity backend.
python-cinderclient – Client library for OpenStack Cinder API.
rackspace-auth-openstack – Rackspace Auth Plugin for OpenStack Clients.
openstackocci – OCCI interface for Openstack.
django-openstack – A Django interface for OpenStack.
futuregrid_passwdstack – Password Stack is a simple tool that allows normal users to reset their own password in the OpenStack Dashboard
cloudenvy – Fast provisioning on openstack clouds.
reddwarf – PaaS services for Openstack
python-openstackclient – OpenStack command-line client
reviewday – Report generator for OpenStack code reviews.
horizon – The OpenStack Dashboard.
hpcloud-auth-openstack – HP Cloud Auth Plugin for OpenStack Clients.
To install the OpenStack dashboard package called horizon, enter:

pip install horizon
PyPI – the Python Package Index.
Pip installer documentation and download from the official project site.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s