Running Python with custom libraries.
CSG maintains the set of Python libraries available on the lab machines and login servers.
If there's a package you want to use that isn't available on the system, we may be able to add it for you.
However this is a bit non-trivial to do, and we generally can't do so quickly (or perhaps at all) unless there's wide demand for it.
If the package you want isn't going to be widely used, or you just want to try it out, we suggest you install it in your own home directory instead.
There are a number of different ways to do this; this article covers using virtualenv.
If you have suggestions for better approaches, let us know.
Setting up a "virtualenv"
In your home directory, run:
$ virtualenv --system-site-packages testpy $ cd testpy/ $ source bin/activate
This sets up a directory named "testpy" containing a virtual python library environment.
You can use a differnet name, or create any number of distinctly named environments.
By source-ing the activate script, you start to use your new environment - and when you run python, it should use the libraries you set up there.
Add the latest version of a library (eg: Numpy) like this:
pip install numpy
Or, download and set up a specific version:
pip install numpy==1.8
Large library bundles may take a while to download, compile and install.
Exit the environment by running:
Home directory space use
Keeping a collection of libraries can use a significant amount of home directory space.
- If you only need the environment for a single login session, consider creating it in /tmp instead of your homedir.
- Once you're done with your environment, please delete the directory it lives in, to save disk space.
- [Class Administrators] If you want other people to use a particular virtualenv, please share read access to a common one rather than asking everyone to create their own copy.