Cookies on this website

We use cookies to ensure that we give you the best experience on our website. If you click 'Accept all cookies' we'll assume that you are happy to receive all cookies and you won't see this message again. If you click 'Reject all non-essential cookies' only necessary cookies providing core functionality such as security, network management, and accessibility will be enabled. Click 'Find out more' for information on how to change your cookie settings.

Enabling optional software packages using the Shell Modules system

Introduction

Shell modules are a method for configuring your terminal login session such that it can use different software packages (possibly different versions). By using the modules we can minimise the amount of extra locations searched whenever you start a program so speeding up logins and program launching and reducing the likelihood of bad interactions between software packages.

The module Command​​

The ​module command is used to load/unload modules.​

​Ava​​ilable mod​​ules

​To see a list of available software packages use:

$ module avail
---------------------------------------- /opt/fmrib/etc/ShellModules ---------------------------------------
MATLAB/2012a                    MATLAB/2015b                    freesurfer/6.0.0                MATLAB/2014a
MATLAB/current                  freesurfer/freesurfer-5.3.0     freesurfer/current              MATLAB/2014b
fmrib-python                    freesurfer/freesurfer-5.3.0-HCP fsl/5.x-FMRIB                   MATLAB/2015a
fmrib-python3                   mrtrix3                         fsl/current

You will also see a section /usr/share/Modules/modulefiles - this area contains modules provided by the Linux OS and in general modules listed here are not of interest.

Loadi​ng​​​​ modules

To configure your shell for a particular software pack​age simply load the module (add is a synonym for load):

$ module load freesurfer

At this point your shell should be able to find and run any of the packages programs/tools.

Loading a specific version of a package

Where multiple versions of a package exist, these will usually appear as package/version. Loading using just the package name will always result in the version listed last (alpha-numerically) being loaded. To load a specific version simply use it's full name, e.g.:

$ module load MATLAB/2015b

To select the 2015b version of Matlab.  The generic version name, current, will always select the latest recommended version of this software package.

If you would like a module to always be loaded when you login to the cluster then add the relevant command to your .local_profile file:

$ module load foo/1.2.3

If you need to load a specific module in a script, use the following (bash) snippet:

$MODULESHOME/init/bash
module load foo

Unloadi​​ng modules 

​To remove a package from your environment (perhaps because it conflicts with another package) you ​​​use unload (or the synonym rm):

​​module unload freesurfer/5.3.0

To unlo​ad all loaded modules use

$ module purge​​

Listing current​​​ly loaded modules

To display ​​a list of currently loaded modules use:

$ module list

Switching versions​ 

If ​​you wish to switch the version of a particular package then a switch command is provided: 

$ module switch freesurfer/5.3.0 freesurfer/6.0.0