Installing Python packages

1. Python availability

When you need to install a specific Python package you DO NOT have to install Python. We provide a few Python versions that can be accessed via modules. The base installs already have a lot of added packages. To find out what Python is available:

[user@login-x:~]$ module avail python
---------------------- /opt/rcic/Modules/modulefiles/LANGUAGES ---------------------------
python/2.7.17 python/3.8.0
While you can still choose python version 2, it is no longer supported and may not work when the cluster is upgraded to the next operating system. It is advisable to use Python 3.

Steps below explain the basic steps specific to the cluster.

For additional info on installing Python packages please see Python documentation Python packages with pip

2. Install Python packages

Python has thousands of specific packages and it is not possible for us to maintain them all. For this reason users can easily add their desired packages to the base installs using local user area. The local installation of Python packages will go to the $HOME/.local and is automatically available to the user.

  1. Get an interactive node

    Always claim an interactive node because some packages builds involve compilation and downloads that can use a lot of CPU time and memory.

    [user@login-x:~]$ srun -c 2 -p free --pty /bin/bash -i
  2. Load desired module

    For building in your user area, first you need to load Python module:

    [user@login-x:~]$ module load python/3.8.0

    Check that python and pip are available to you, the output of the commands should be similar to:

    [user@login-x:~]$ which python
    [user@login-x:~]$ which pip
  3. Install your software package

    Below we provide a common installation example using pip.

    [user@login-x:~]$ pip install --user pluggy
    Collecting pluggy
      Using cached pluggy-1.0.0-py2.py3-none-any.whl (13 kB)
    Installing collected packages: pluggy
    Successfully installed pluggy-1.0.0

    Verify that pluggy is now available.

    [user@login-x:~]$ python
    Python 3.8.0 (default, Oct  8 2020, 14:17:31)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pluggy