Python environments on Hoffman2

Creation date: 10/31/2017 9:15 AM    Updated: 10/28/2019 9:56 AM
Here is a short demonstration on how you could use python environments on the cluster using any of the installed python versions.

A cleaner alternative to perform installation via:

qrsh
module load python/2.7.13_shared
pip install <package> --user


is to use python environments, you cad do so as follows:

qrsh 
module load python/2.7.13_shared
mkdir $HOME/mypython_env
virtualenv env_python2.7.13
source env_python2.7.13/bin/activate


after issuing the activate command your prompt will change as for example is shown here:


[rdtest@n9859 ~/mypython_env]$ which python
/u/home/r/rdtest/mypython_env/env_python2.7.13/bin/python


you can now perform your package installations simply by following this example:

pip install numpy

Note: in a python environment you do not need to use the "--user" part to the pip command. This is because the environment is a separate branch of python and all the packages installed therein are self contained in that specific environment.

When you are done using the python environment just type:

deactivate


__
October, 2017