Modules are the way Research Computing provides a lot of software without it all conflicting with each other. Modules are also the way we provide multiple versions of the same software.

Getting to Know Modules

After logging on to a computer managed by Research Computing you will be able to use the module command. module works by manipulating your environment to give you access to the software. The following is a list of subcommands for module that will allow to take full advantage of module. Note:  [module] is the name of the module you want to load.

module avail  [module]
Lists all the available modules with their version in a formatted list. Specifying the module will list the multiple versions of the module available. Notice (default) next to some modules, this indicates that if you load the module without specifying which version, this version will be loaded.
module whatis [module]
Outputs a brief description of the module specified. Note: if no module is specified, all the modules will be listed
module load [module]
Loads the specified module. A version can also be specified, see the demonstration below.
module unload [module]
Unloads the specified module.
module list
Lists all the currently loaded modules.
module help
Explains how to use the module command, includes a list of all available command.
module help [module]
Get help information for the specified module. Many modules do not have very much information however.
module show [module]
Shows information about the module and the changes the module will make to your environment.

 

A Demonstration of module

The following is a demonstration of the module commands to give you an idea of how the commands listed above behave. For this demonstration we will be trying to load the newest version of Python available on our system (3.7.6).

  1. We will check to see if a version of module is already available

    [abc1234@computer ~]$ python -V
    Python 2.7.17
  2. So now that we know that version currently loaded for Python is not version we want, we look to see if that version is available:

    [abc1234@computer ~]$ module avail python
    -------- /sw/workstations/modules/linux-ubuntu18.04-ivybridge --------

    python/3.7.6/gcc-7.5.0-gaggxq2 python/3.7.6/gcc-7.5.0-qqeutn6  python/3.7.6/gcc-7.5.0-wmidruk

    module avail would have worked just as well to find which versions of Python are available. We recommend taking a look at all the modules to see what is available to you when you are first getting started.   

  3. Now that we know it exists, we  are ready to load the module:

    [abc1234@computer ~]$ module load python/3.7.6/gcc-7.5.0-wmidruk

    Note: If we saw (default) next to version of python we wanted to load we could have just typed module load python and that would have loaded the version Research Computing recommends. We encourage you to load the default version unless you know you need another version.

  4. Now we can check that the module was installed: 

    [abc1234@computer ~]$ module list
    Currently Loaded Modulefiles
      1) python/3.7.6/gcc-7.5.0-wmidruk
  5. To make sure the version was updated we can check the version again:

    [abc1234@computer ~]$ python -V
    Python 3.7.6
  6. Now let’s say we are done using that version of Python or we loaded the wrong one and  we want to change it. We need to unload it:

    [abc1234@computer ~]$ module unload python/3.7.6/gcc-7.5.0-wmidruk
  7. Now if we run python -V  we will see python is once again 2.7.17. If we run module list we will see python/3.7.6… is gone, but not the modules loaded with it. Those can be removed easily by using purge command:
    [abc1234@computer ~]$ module purge

Tricky Modules

Sometimes modules are not explicitly listed in module avail. For example, idl, which is used by many imaging scientists does not look to be available. This is because it is contained in another module, envi. The following demonstrates this:

[abc1234@computer ~]$ which idl
[abc1234@computer ~]$
[abc1234@computer ~]$ module load envi
[abc1234@computer ~]$ which idl
/sw/workstations/apps/linux-ubuntu18.04-ivybridge/envi/5.1/gcc-7.5.0/ad4qd2pfrfi3u2fzmpyiwbyhslwo2kyw/idl/bin/idl

The which command here is useful to see if you can run a program without trying to open it.

    Modules and Scripts

    When you are using modules you must take caution when writing scripts that define the interpreter in the file. For example in a Python script the first line is commonly:

    #!/usr/bin/python

    If you are using modules and decide to use a version of Python that is not the default, such as 3.7.6, this line will not point to that interpreter, but rather the default. Instead use:

    #!/usr/bin/env python

    This will point to the version of Python you loaded into your environment.