Minnesota Supercomputing Institute
2.24.0
1.1.1, 1.3.0, 1.4.1, 1.5.2, 7.2, canopy-1.1.1-standalone, canopy-1.3.0, canopy-1.4.1, pygtk/2.24.0
Wednesday, December 7, 2016
Python is a high level programming language that aims to combine remarkable power with very clear syntax. The Enthought Python Distribution is a cross-platform environment for scientific computing in Python, and includes the Canopy IDE and package manager. MSI has installed an academic-licensed version that includes hundreds of modules, including tools that enable efficient parallel computations.
Loading the module python-epd makes the Enthought Python installation your default Python for all Python-related commands (python, ipython, pip):
module load python-epd
Because this module is our currently recommended version for Python 2, you will also obtain this module if you type:
module load python
General information about using Python at MSI is available on the main Python software documentation page.
Instead of IPython, you can open the Canopy graphical development environment by typing the command:
canopy
MSI has installed the MPI module mpi4py, which allows large parallel computations using MPI. A program using mpi4py to run on ten nodes with eight cores per node would be submitted to a queue using a PBS script such as this:
#PBS -l nodes=10:ppn=8,pmem=1gb,walltime=4:00:00 #PBS -m abe cd /location/of/the/script module load python-epd mpirun python mpi_program.py
Note that this installation is linked against the Intel Math Kernel Library, so many math operations using NumPy or SciPy will be automatically parallelized to use all available CPU cores on the machine.
Enthought Python makes use of virtual environments, a technology that enables the creation of multiple, lightweight, independent Python environments. Using a command like
module load python-epd venv -s ~/mypython
will create a virtual environment that inherits all the capabilities of the main Canopy installation in your home directory, where you can modify it or build your own Python modules. The command
source ~/mypython/bin/activate
would then make this local Python directory your default in that terminal until you log out or type the command deactivate. With a virtual environment activated, you can easily install new Python modules. In many cases, simply using the pip packages manager like so:
pip install newpackage
is all that is needed.