PYTHON

From HPCC Wiki
Jump to navigation Jump to search

On Penzias Python is provided as a part of development package Anaconda/Miniconda. Anaconda distribution includes libraries (i.e. numpy) while miniconda is empty shell which can accommodate various packages. In general there are 2 supported versions of Python installed on Penzias system:

  • Python 2.7.13 which can be accessed by loading module python/2.7.13_anaconda
  • Python 3.6 which can be accessed by loading module python/3.6.0_anaconda

The same versions of Python can be accessed via miniconda builds but no extra modules will be automatically available (i.e. numpy, pandas etc.)

  • Python 2.7.13 only can be accessed by loading module python/miniconda2
  • Python 2.7.13 only can be accessed by loading module python/miniconda3

When using miniconda builds users have to have all needed python modules installed in their own space (see below).

In order to make Python binaries available user needs to load corresponding module:

module load python/2.7.13_anaconda

(for version 2.7.13) or for version 3.6.0

module load python/3.6.0_anaconda 

After the module is loaded Python interpreter can be simply called by "python" command.

Versions 2.7.3-2.7.11 are installed as Enthought Python Distribution [1]. EPD contains over 100 libraries such as SciPy, NumPy, matplotlib, IPython, PyTables, PIL, wxPython, etc... The Version 2.7.13 is installed as ANACONDA build and also supports more than 100 Python libraries. In addition the ANACONDA distribution is compiled with OpenMPI support (module for openmpi/1.8.4_intel must be loaded).

Installing Python packages

Users may install python packages/modules in their own space. Many packages available in Python repositories can be installed easily with PIP manager, which is available in any of Anaconda and Miniconda builds.

Users must remember that using PIP without first loading the module for python will cause the installed modules to match system python on login node only. However the python interpreter available (after login module) on all nodes is installed in /share/usr/compilers/python space. Thus when installing packages in user space it is very important to follow the procedure outlined below. The given example demonstrates how users can install package "guppy" in their own space:

For Python 2.7.13 in Anaconda build:

module load python/2.7.13_anaconda
pip install guppy --user

For Python 3.6.0 in Anaconda build

module load python/3.6.0_anaconda
pip install guppy --user

For Python 2.7.13 in Miniconda

module load python/miniconda2
pip install guppy --user

For Python 3.6.0 in Miniconda 3

module load python/miniconda3
pip install guppy --user

To check if the package is properly installed type:

pip list | grep guppy