Reaching Others University at Buffalo - The State University of New York
Skip to Content

PYTHON

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.

Show the version with the command:
    python -v

CCR also supports an alternative to the "stock" installation via the Anaconda distribution. It is available as a module.

Show the software versions:
    module avail python

Loading the module will set the path and any necessary variables:
    module load python/anaconda

Anaconda Python comes installed with numerous packages including NumPY and SciPY. Additional packages that are certified to work correctly within the Anaconda Python distribution are available from the anaconda repository. Other packages may also be available, but are not guaranteed to work. Individual users are responsible for installation and maintenance of packages not included in the CCR anaconda installation. Instructions for installing packages in "user space" are given below.

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. 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=/projets/my/pkg/dir/lib" \
                        name_of_pacakge

    More information on pip install is available here.

Activating Support for Python 3
Anaconda supports Python 3 but it must be explicitly activated. For example:
    module load python/anaconda
    source activate /util/academic/python/anaconda/envs/py3k


To revert to Python 2, use the deactivate command:
    source deactivate

Did You Know?

The CCR installation of Anaconda uses a number of high performance libraries including MKL, IOPro, and NumbaPro.

 

To load these packages, use the following import statements in your code:

 

   import iopro
   import numbapro
   import mkl

 

Note that NumPY is already built to use MKL.