Python is a high-level, multi-paradigm programming language that is both easy to learn and useful in a wide variety of applications. Python has a large standard library as well as a large number of third-party extensions, most of which are completely free and open source. We highly recommend using Python 2.7.1, as we have added a lot of Python packages and tuned them to perform well on our systems.
Python is available on the Oakley and Glenn clusters.
* - Default version (not a module)
** - This version of python is installed as an integrated package Anaconda (https://store.continuum.io/cshop/anaconda/).
Note: Module load 3.4.1 will actually load version 3.4.2.
On Ruby module load 2.7.8 will actually load version 2.7.9
To run the Python interpreter using the default system-level Python installation, simply type the command “
python”. On Glenn, the default version used is 2.4.3. On Oakley, the default version used is 2.6.6.
Each system also has the Python 2.7.1 module. To load this module, type one of the following commands depending on which system you are using.
On Glenn, type:
module load python-2.7.1
On Oakley, type:
module load python/2.7.1
After the module is loaded, you can run the interpreter by using the command
To unload the Python 2.7.1 module, use the command
module unload python
We have installed a number of Python packages and tuned them for optimal performance on our systems. When Python 2.7.1 is loaded, executing
module help python will show you the current list of packages available.
setuptools, readline, bitarray, cloud, configobj, coverage, docutils, enstaller, epydoc, grin, html5lib, jinja2, nose, paramiko, ply, Crypto, pygarrayimage, pyglet, pygments, OpenSSL, pyparsing, pyproj, serial, dateutil, pytz, sphinx, sqlalchemy, xlrd, xlwt, scons, ldap, _mysql, numpy, scipy, pexpect, zope.interface, twisted, foolscap, wx, sip, PyQt4, matplotlib, zmq, IPython, PIL, reportlab, cython, numexpr, tables, argparse
Of special note is the fact that numpy and scipy have been compiled to use the optimized math libraries for each system (ACML on Glenn, MKL on Oakley) for best performance.
Due to architecture differences between our supercomputers, we recommend not
installing your own packages in
. Instead, you should install them in some other directory and set
in your default environment. For more information about installing your own Python modules, please see our HOWTO
Running Python Scripts in Batch
Python can technically be used in both interactive and non-interactive batch jobs, but you will most likely only want to run a Python script non-interactively. To do this, you will need to write a batch submission script and a Python script.
Below is a sample batch submission script (using the Oakley syntax) and a simple “Hello World” program written in Python.
Example batch submission script,
#PBS –N hello
#PBS –l nodes=1:ppn=1
#PBS –l walltime=1:00:00
#PBS –j oe
module load python/2.7.1
#end of sample.job
Example Python script,
hello = [“Hello”, “World”]
for i in hello:
#end of hello.py
For more information about using the batch system, see Batch Processing at OSC.
HOWTO: Install your own python modules
Extensive documentation of the Python programming language and software downloads can be found at the official Python website