Hprc banner tamu.png

SW:Python

From TAMU HPRC
Revision as of 15:23, 11 July 2018 by Narendra5 (talk | contribs)
Jump to: navigation, search

Python

Python is an interpreted high-level programming language for general-purpose programming. Python has had many versions over the years. Most python programs run on Python 2 (example - 2.7.x) or Python 3 (example - 3.5.x).


Modules and Versions

To check the available Python modules on a cluster. Please type the following command.

  [NetID@cluster NetID]$ module spider Python

This will show many version of python complied with different toolchains. The first part of the module name (Ex - Python/3.5.1) refers to the python language version. The second part of the module name (Ex - -intel-2016a) refers to the HPRC toolchain used to compile the module.

  Python/3.5.1-intel-2016a
  Python/3.5.2-foss-2017A
  Python/3.5.2-GCCcore-6.3.0-bare
  Python/3.5.2-intel-2016a
  Python/3.5.2-intel-2016b
  Python/3.5.2-intel-2017A
  Python/3.5.2-iomkl-2017A

What is a toolchain?

A toolchain on a TAMU HPRC cluster is a collection of tools used for building software. They typically include:

  • a compiler collection providing basic language support (C/Fortran/C++)
  • a MPI implementation for multi-node communication
  • a set of linear algebra libraries (FFTW/BLAS/LAPACK) for accelerated math

For more information on toolchains checkout our Toolchains page.

Which Python to use ?

If your project requires a specific version of python language (Ex. 2.7.11) with specific compiler than use that particular version. We recommend using the most recent toolchain (intel-2017A) with your python version. Once you decide your version than please continue to do your work on the same version. Changing versions everytime can cause errors. In short, current recommended version for python 2 language

  Python/2.7.12-intel-2017A

Current recommended version for python 3 language

  Python/3.5.2-intel-2017A

Loading/Unloading Python

You can use "module load" command for loading a particular python version on cluster. An example command for loading python 3 :

  [NetID@cluster NetID]$ module load Python/3.5.2-intel-2017A

You can use the following example command for unloading python 3.

  [NetID@cluster NetID]$ module purge Python/3.5.2-intel-2017A

Write the following command, if you want to check the python language version that you are currently using.

  [NetID@cluster NetID]$ python --version

Default Python Packages (pip)

Python is useful if it has many packages. The "pip list" command will show the default python packages available.

  [NetID@cluster NetID]$ pip list

NOTE: Users don't have permission to install new packages using "pip install" command directly on the terminal. Users need to first create a virtual environment which is explained in next section.