Python is an interpretive programming language.

Category:  Programming Language

Usage Notes

A "stock" installation of Python is in the default path and is distributed with the operating system.  This default python has no additional packages, such as NumPy, SciPy and Matplolib.  Show the version with the command:  python -v

Users can run python computation using a SLURM script or Jupyter Notebook. Examples of SLURM can be found in the /util/academic/training directory. 

Anaconda Python is installed on the cluster.  These Anaconda Python distributions come installed with numerous packages including NumPY, SciPY and Matplotlib . Additional packages that are certified to work correctly within the Anaconda Python distribution are available from the anaconda repository.

Show the software versions: module avail python

Loading the module will set the path and any necessary variables:  

module load python/anaconda-version

Users can install Anaconda Python themselves into the home or projects directory.  See the following article:  Installing Anaconda Python on CCR

Installing additional python packages can be done into an conda environment or simply a directory.  

Installing packages into a directory.  This directory can reside in the user's home or projects directory.  Be sure to include the addition flags to make certain the packages are installed in the correct directory.  See the following notes on using conda and pip.

Installing a Certified Package from the Anaconda Repository
Use "conda install" for certified packages:
module load python/anaconda
   
conda install -p /path/to/your/pkg/install/dir name_of_package

 Note: /path/to/your/pkg/install/dir could be either under /projects or your user home directory (/home/<username>). More information on "conda install" is located here

Installing Any Other Python Packages
Use pip to install in your home directory:
    module load python/anaconda
    pip install --user 
name_of_package

Use pip to install in a projects directory:
     module load python/anaconda
pip install --install-option="--prefix=/projects/my/pkg/dir" \
        --install-option="--install-lib=/projects/my/pkg/dir/lib" \
        name_of_package

    More information on pip install is available here

Installing packages into an environment.  The Anaconda Python can be one that the user has installed or a CCR installed distribution.  If the Anaconda Python has been installed by the user, then the conda environment can be create under that installation.  Otherwise the conda environment must reside in the user's home or projects directory.  See the tutorials in the Guides article.



Using Python in an HPC Environment

Python supports a wide range of strategies for taking advantage of HPC resources. The Using-Python-2017.pdf file below provides an overview of what's available on the UB CCR cluster.



The Basics of Python (adapted from BCH 519)
CCR's Andrew Bruno has lectured on using Python for Bioinformatics applications. A condensed version of his interactive Python tutorial is given in the Intro_to_Python.pdf file below.