Enabling optional software packages using the Shell Modules system
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.
module command is used to load/unload modules.
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.
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 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
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 unload all loaded modules use
$ module purge
Listing currently loaded modules
To display a list of currently loaded modules use:
$ module list
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