Python on Aether

The recommended way to use Python on Aether is via Anaconda.

Managing Python environments

The global Anaconda Python installation lives in /home/conda. The recommended way to use the Anaconda environment on Aether is outside the module system. In order to enable the conda command, you can add the following piece of code to your $HOME/.bashrc:

if [ -f "/home/conda/etc/profile.d/conda.sh" ]; then
  . "/home/conda/etc/profile.d/conda.sh"
fi

Then, whenever you are logged in to Aether, you will have the conda command available (please check here for the documentation); you will not need to activate the Anaconda module as previously.

Also, make sure that the directory /home/conda/envs appears somewhere under envs_dirs in your ~/.condarc, and make sure to remove the directory /opt/software/conda/envs from the same place. For example, the envs_dirs section in your ~/.condarc could look like this:

envs_dirs:
  - /home/conda/envs/

System-wide conda environments

There are several system-wide conda environments. These contain numerous software packages, and once officially released, these environments will not change. That means that any code you write using a specific environment, you can be assured that this code will continue to work in that environment.

Note

We only provide Python 3 environments. In case you really need Python 2, please see Private conda environments below how to create and use your own environments.

We aim to release two environments per year, to provide you with the most up-to-date software stack possible. The environments will be called lamos_YYYY.N, where YYYY is the year, and N is the release number of that year.

The following environments are available:

Name (conda)

Name (JupyterHub)

Python version

Package list

lamos_2020.1

LAMOS v2020.1

3.7.3

view

lamos_2019.1

LAMOS v2019.1

3.7.1

view

lamos_2018.1

LAMOS v2018.1

3.6.7

view

These environments are available both on the command line (e.g., run the command conda activate lamos_2020.1 or module load conda/lamos_2020.1 to activate the lamos_2020.1 environment), and in JupyterHub.

Conda and the Lmod module system

You can switch between your conda environments either using the conda command (as usual) or you can use the module command provided by Lmod. For example, in order to activate the lamos_2020.1 environment, you can run

module load conda/lamos_2020.1

This will automatically unload any other Python module so that you can be sure to know which Python you are using. The full list of conda environments available for loading this way can be obtained by running module avail as explained in Software on Aether.

Private conda environments

As you know it from working on any other computer, you can create conda environments in your $HOME directory. It is recommended to place all your private environments into the folder $HOME/.conda/envs. This is most easily done by putting the following code in your $HOME/.condarc file:

envs_dirs:
   - ~/.conda/envs

You’ll also need to add the following to $HOME/.condarc:

pkgs_dirs:
  - ~/.conda/pkgs

In order for the integration with JupyterHub to work, your environment must at least contain the packages ipython and notebook. For example, you can create an environment like this:

$ conda create -n my_env ipython notebook

At this point, the new environment my_env is available on the command line, and you can activate it with a simple conda activate my_env.

The Spyder editor

Note

Spyder is a graphical editor, so it needs a graphical user interface. This means that either you have to connect to Aether using the -X or -Y options of ssh, e.g., ssh -Y login2aether, or you use X2go.

You can work with the Spyder editor on Aether. Spyder is installed in its own conda environment, so you need to activate the appropriate environment before you can launch Spyder:

conda activate spyder
spyder

The spyder environment does not contain any useful Python modules for your numerical work. This means that you have to select which conda environment you want to use from within Spyder. This is usually done by setting the Python interpreter from the Tools -> Preferences menu item. You will want to set this to the python binary of the conda environment you want to use. For example, you can set the interpreter to /home/conda/envs/lamos_2020.1/bin/python in order to use the conda environment lamos_2020.1.