Install python pip virtualenv

Install python-pip to install other packages ( pandas, numpy, scipy, virtualenv etc. ). Before installing pip make sure to update and upgrade and autoremove on Linux as follows.

sudo apt-get autoremove ( apt-get or apt package manager will do )
sudo apt-get update
sudo apt-get upgrade

sudo apt-get install python-pip

Install ” virtualenv ”  to keep the python ENV separate for different versions of python and packages.

sudo pip install virtualenv

check the installed packages using pip freeze.

pip freeze

result is following:

adium-theme-ubuntu==0.3.4
unity-lens-photos==1.0
virtualenv==15.0.3

setup python 2.7.12 in ENV pointed to by directory ${HOME}/PYTHON/Py_12  .  Give the virtual environment access to the global site-packages .

virtualenv --system-site-packages ~/PYTHON/Py_12

To work in this virtualenv, activate the ENV with following script. This will setup the environment to work within the new environment without being too ependent on global environment.

source bin/activate

once done using the ENV, you can deactivate the  ENV setup to restore to default values with the following.

deactivate  ( # Do it in the End )

Install pandas using pip in virtualenv ENV. It automatically installs ” pandas, numpy, pytz, six and python-dateutil ” packages.

pip install pandas

Check the installed packages using pip freeze.

pip freeze

Result is following :

adium-theme-ubuntu==0.3.4
numpy==1.11.1
pandas==0.18.1
python-dateutil==2.5.3
pytz==2016.6.1
six==1.10.0
unity-lens-photos==1.0
virtualenv==15.0.3

To upgrade pip utility or upgrade a package run following command :

pip install --upgrade pip
or
pip install --upgrade <package_name>

To check version of pip

pip -V

Result of pip version :

pip 8.1.2 from /home/xerius/PYTHON/Py_12/local/lib/python2.7/site-packages (python 2.7)

Create a requirements file for pip packages to upgrade in virtualenv ENV:

pip list | cut -f1 -d' '   > ../pip_req.file ;  alert

Upgrade all the python packages installed by pip in virtualenv ENV:

pip install -r ../pip_req.file -U ; alert

Install nose ( This is required for doing tests on pandas & numpy ):

pip install nose

Install scipy :

pip install scipy

Result of pip freeze ; alert ( # alert is an alias in some distros, I changed it for my needs )

adium-theme-ubuntu==0.3.4
nose==1.3.7
numpy==1.11.1
pandas==0.18.1
py==1.4.31
pytest==3.0.2
python-dateutil==2.5.3
pytz==2016.6.1
scipy==0.18.0
six==1.10.0
unity-lens-photos==1.0
virtualenv==15.0.3

 

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s