What are Environment Modules?
Typically users initialize their environment when they log in by
setting environment information for every application they will reference
during the session. The Environment Modules package is a tool that simplify
shell initialization and lets users easily modify their environment during
the session with modulefiles.
Each modulefile contains the information needed to configure the shell for
an application. Once the Modules package is initialized, the environment
can be modified on a per-module basis using the module command which
interprets modulefiles. Typically modulefiles instruct the module command
to alter or set shell environment variables such as PATH, MANPATH, etc.
modulefiles may be shared by many users on a system and users may have
their own collection to supplement or replace the shared modulefiles.
Modules can be loaded and unloaded dynamically
and atomically, in an
clean fashion. All popular shells are supported, including
bash, ksh, zsh, sh, csh,
tcsh, fish, cmd, pwsh as well as some
scripting languages such as perl, ruby, tcl,
python, cmake and R.
Modules are useful in managing different versions of applications.
Modules can also be bundled into metamodules that will load an entire
suite of different applications.
Quick examples
Here is an example of loading a module on a Linux machine under bash.
$ module load gcc/12.4
$ which gcc
/usr/local/gcc/12.4.0/linux-x86_64/bin/gcc
Now we'll switch to a different version of the module
$ module switch gcc/14
$ which gcc
/usr/local/gcc/14.2.0/linux-x86_64/bin/gcc
And now we'll unload the module altogether
$ module unload gcc
$ which gcc
gcc not found
Now we'll log into a different machine, using a different shell (tcsh).
% module load gcc/14.2
% which gcc
/usr/local/gcc/14.2.0/linux-aarch64/bin/gcc
Note that the command line is exactly the same, but the path has
automatically configured to the correct architecture.
Get started with Modules
Download latest version of Modules. Learn how to install it on Unix or how to install it on Windows. You may alternatively automatically retrieve and install Modules with your preferred package manager as Environment Modules is widely available. An overlook on the new functionalities introduced by each version is available in the New features guide. Release notes provides the full list of changes added in each version. The Changes document gives an in-depth view of the modified behaviors and new features between major versions.
Reference manual page for the module(1) and ml(1) commands and for modulefile(4) script provide details on all supported options. A cookbook of recipes describes how to use the various features of Modules and how to extend the module command to achieve specific needs. If you have questions, comments or development suggestions for the Modules community, please read the CONTRIBUTING guide.
Publications
- Marc Joos, Xavier Delaruelle,
Environment Modules: why this old idea is still useful today and what's next,
FOSDEM'25, Bruxelles, February 1-2, 2025.
- Xavier Delaruelle,
Modules 5,
7th EasyBuild User Meeting, January 24-28, 2022.
- Xavier Delaruelle,
Modules: Provides dynamic modification of a user’s environment,
FOSDEM'19, Bruxelles, February 2-3, 2019.
- Xavier Delaruelle,
Modules: Automatic and consistent handling of modulefile dependencies,
4th EasyBuild User Meeting, Louvain-la-Neuve, January 30 - February 1, 2019.
- Xavier Delaruelle,
Modules v4: Pushing forward user environment management,
FOSDEM'18, Bruxelles, February 3-4, 2018.
- Xavier Delaruelle,
Modules v4: Yes, Environment Modules project is not dead,
3rd EasyBuild User Meeting, Amsterdam, January 30 - February 1, 2018.
- Brock Palen and Jeff Squyres speak with R. K. Owen,
RCE 60: Modules,
Research, Computing and Engineering (RCE) Podcast,
September 20, 2011.
- Erich Whitney, Mark Sprague,
Drag Your Design Environment Kicking and Screaming into the 90's With Modules!,
Synopsys Users' Group, Boston MA, 2001.
- John L. Furlani, Peter W. Osel,
Abstract Yourself With Modules,
Proceedings of the Tenth Large Installation Systems Administration Conference (LISA X), pp.193-204,
Chicago, IL, September 29 - October 4, 1996.
- Richard Elling, Matthew Long,
user-setup: A system for Custom Configuration of User Environments, or Helping Users Help Themselves,
Proceedings of the Sixth Systems Administration Conference (LISA VI), pp. 215-223,
Long Beach, CA, October 19-23, 1992.
- John L. Furlani,
Modules: Providing a Flexible User Environment,
Proceedings of the Fifth Large Installation Systems Administration Conference (LISA V), pp. 141-152,
San Diego, CA, September 30 - October 3, 1991.
Related tools
-
EasyBuild is a software build and
installation framework that allows you to manage (scientific) software on
High Performance Computing (HPC) systems in an efficient way.
-
Spack is a package manager for supercomputers,
Linux, and macOS. It makes installing scientific software easy. Spack isn’t
tied to a particular language; you can build a software stack in Python or R,
link to libraries written in C, C++, or Fortran, and easily swap compilers
or target specific microarchitectures.
-
Singularity
Registry HPC (SHPC) is a versatile framework designed to streamline
the deployment and management of scientific applications on High Performance
Computing (HPC) systems. SHPC allows to install containers as modules.
-
Env2 is a Perl script
to convert environment variables between scripting languages. For example,
convert a csh setup script to bash or the other way around. Supports bash,
csh, ksh, modulecmd, perl, plist,
sh, tclsh, tcsh, vim, yaml
and zsh. This package is written and maintained by David C. Black.
-
Software Collections is a
Red Hat project that enables you to build and concurrently install multiple
RPM versions of the same components on your system, without impacting the
system versions of the RPM packages installed from your distribution. Once
installed a software collection is enabled with the scl command
that relies on Modules for the user environment setup.
Reference installations