Environment Modules (New cluster)
Enabling optional software packages using the Environment Modules system
Introduction
Environment modules are a method for configuring your terminal such that it can use different software packages (and potentially specific versions of a software package). By using these modules you can ensure that only the correct software and dependent libraries are accessed, potentially speeding up loading and reducing the likelihood of bad interactions between software packages.
The module
Command
The module
command is used to manage environment modules, and has many options, the most useful of which are detailed below. For all the available commands see the Lmod user guide.
Available modules
To see a list of available software packages use:
$ module avail
...
---------------- /cvmfs/fsl.fmrib.ox.ac.uk/el9/modules ----------------
fsl/4.1.9 fsl_sub/2.8.3 (L)
fsl/5.0.9 fsl_sub_config/1.0.0
fsl/5.0.11 fsl_sub_config/1.0.1
fsl/6.0.7.3 (D) fsl_sub_config/1.0.2 (L,D)
---------------- /cvmfs/matlab.fmrib.ox.ac.uk/modules -----------------
MATLAB/R2012a MATLAB_MCR/R2012a MATLAB_MCR/R2019b
MATLAB/R2014b MATLAB_MCR/R2012b MATLAB_MCR/R2023a
MATLAB/R2023b (D) MATLAB_MCR/R2014b MATLAB_MCR/R2023b (D)
...
The example above is truncated, so you will typically see much more than this. Software packages are groups into broad categories, based on their file system location, so you can see above, the FSL modules and MATLAB modules are grouped together.
To get a terse list try:
module overview
This only displays the software name (with the number of versions in parenthesis).
Loading modules
To configure your shell for a particular software package 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 with the '(D)' next to it being loaded. To load a specific version simply use it's full name, e.g.:
$ module load MATLAB/2023b
To select the 2023b version of MATLAB.
If you would like a module to always be loaded when you login to the cluster then see the Lmod login modules instructions.
Unloading 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/7.4.0
To unload all loaded modules use
$ module purge
Listing currently 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/6.0.0 freesurfer/7.4.0