Environment Modules (software)
Environment Modules | |
---|---|
![]() | |
Stable release | 5.6.0
/ July 31, 2025 |
Repository | |
Written in | Tcl |
Operating system | Unix-like |
License | GNU General Public License#Version 2 |
Website | modules |
The Environment Modules system is a software tool designed to help users dynamically modify their shell environment. It provides a mechanism for managing and switching between sets of environment variable settings, often used to configure different software packages, compilers, and libraries.
Overview
[edit]Environment Modules allows users to dynamically configure their shell environment without permanently altering login scripts. This is especially useful in high-performance computing (HPC) environments where users may need to access multiple versions of the same application. Users load and unload scripts called modulefiles to modify environment variables such as PATH or LD_LIBRARY_PATH.
Environment Modules is shell independent and supports all major Unix shells (Bash, ksh, Zsh, Fish, sh, tcsh, and csh), Windows shells (CMD.EXE and PowerShell) and several Scripting languages (Perl, Python, Ruby, Tcl, CMake and R)
Environment Modules handles all kind of items part of shell environment, including environment variable, shell alias, shell function and command-line completion.
History
[edit]Environment Modules was first developed in the early 1990s[1] by John L. Furlani at Sun Microsystems. Version 1 was developed as pure shell scripts. With version 2 Environment Modules became a C program evaluating modulefiles written in Tcl.
In the mid 1990s Peter W. Osel at Siemens and Jens Hamisch at Strawberry released the 3.0beta version[2]. R.K. Owen at the National Energy Research Scientific Computing Center (NERSC) took over the project in the late 1990s and ported it to Linux. He released version 3.1 in 2000 under the GNU General Public License (GPL)[3].
During the 2000s, Environment Modules gained traction in the high-performance computing (HPC) world and started to be used at the largest computing centers[4][5]. Environment Modules was specified as a Baseline Configuration requirement of the DoD High Performance Computing Modernization Program (HPCMP)[6].
In 2004, Mark Lakata of MIPS Technologies developed a pure Tcl reimplementation of Environment Modules[7]. Maintenance of this alternative version was later continued by Kent Mein at the University of Minnesota.
In 2008, Robert McLay of the Texas Advanced Computing Center (TACC) introduced Lmod[8], an alternative implementation project of Environment Modules written in Lua.
After the release of version 3.2.10 in December 2012, development of the C implementation of Environment Modules was discontinued. In the following years, the Lmod project grew in popularity within the HPC community.
In 2017, stewardship of the Environment Modules project was transferred to Xavier Delaruelle of the French Alternative Energies and Atomic Energy Commission (CEA). He released version 4, based on the pure Tcl implementation, which was adapted to maintain compatibility with the earlier C version[9]. Since then, new features have been introduced regularly to enhance usability and extend functionality[10].
Architecture
[edit]Environment Modules provides the command modulecmd.tcl along with a shell function or alias named module[11]. The command interprets modulefiles[12], scripts written in Tcl that define environment modifications, and produces the corresponding shell code. The shell function or alias then evaluates this code to update the current shell session accordingly.
A modulefile typically modifies environment variables such as PATH, MANPATH, or LD_LIBRARY_PATH. The example below shows a simple modulefile for a sample software package:
#%Module
module-whatis {Example software version 1.2}
set root /usr/local/example-1.2
prepend-path PATH $root/bin
prepend-path LD_LIBRARY_PATH $root/lib
append-path MANPATH $root/man
Modulefiles are organized into directories known as modulepaths. These modulepaths can be centrally managed to provide system-wide access or placed in personal directories for user-specific configurations.
Users can:
- Load a modulefile (i.e., apply environment changes defined) using module load
- Unload a modulefile (i.e., undo its environment changes) with module unload
- Switch between modulefiles using module switch
- View available modulefiles with module avail
- Display content of a modulefile using module display
- List currently loaded modulefiles with module list
- Save currently loaded modulefiles in a collection using module save
- Restore environment described by a collection with module restore
- Enable a modulepath with module use
Usage examples
[edit]Create sample modulefiles in a user-specific modulepath:
$ mkdir -p $HOME/privatemodules/test
$ echo '#%Module' >$HOME/privatemodules/test/1.0
$ echo '#%Module' >$HOME/privatemodules/test/2.0
$ module use $HOME/privatemodules
Viewing available modules:
$ module avail
-------------------------- /home/user/privatemodules ---------------------------
test/1.0 test/2.0
------------------------ /usr/share/Modules/modulefiles ------------------------
dot module-git module-info modules null use.own
Loading a module:
$ module load test/2.0
List loaded modules:
$ module list
Currently Loaded Modulefiles:
1) test/2.0
Switching versions:
$ module switch test/2.0 test/1.0
Unloading all loaded modules:
$ module purge
Define a default version for sample test module:
$ echo '#%Module' >$HOME/privatemodules/test/.modulerc
$ echo 'module-version test/1.0 default' >>$HOME/privatemodules/test/.modulerc
Load default test module:
$ module load test
$ module list
Currently Loaded Modulefiles:
1) test/1.0
Availability
[edit]Environment Modules is distributed by a wide range of Linux and Unix operating systems[13]. It is available under the package name environment-modules in Debian, Ubuntu, Red Hat Enterprise Linux and Fedora. The software is also packaged for macOS through the Homebrew project, and a version is available for Windows systems. Where pre-packaged distributions are not provided, the project supplies source code and documentation to support manual installation and configuration [14][15].
References
[edit]- ^ Furlani, John L. (September 30 โ October 3, 1991). "Modules: Providing a Flexible User Environment" (PDF). Proceedings of the Fifth Large Installation Systems Administration Conference (LISA V). San Diego, CA: 141โ152. Retrieved 9 February 2014.
- ^ "Module 3.0 Beta 1 is out". SourceForge. 4 October 1996.
- ^ "Modules 3.1.0 almost ready". SourceForge. 28 June 2000.
- ^ "NICS User Support Kraken Modules Description". The National Institute for Computational Sciences (NICS). Oak Ridge National Laboratory - Department of Energy. 22 May 2011. Archived from the original on 22 February 2014. Retrieved 9 February 2014.
- ^ "NERSC Modules Software Environment". The National Energy Research Scientific Computing Center (NERSC). Office of Science - Department of Energy. 2014-02-07. Archived from the original on 7 November 2012. Retrieved 3 September 2025.
- ^ "Use of Modules for Accessing Multiple Versions of Software". Baseline Configuration. DoD High Performance Computing Modernization Program (HPCMP). 20 Mar 2008. Archived from the original on 22 February 2014. Retrieved 9 February 2014.
- ^ "pure TCL implementation of module". SourceForge. 29 October 2002.
- ^ "Announcing Lmod: A new module system". SourceForge. 16 October 2008.
- ^ "Modules 4.0.0 released". SourceForge. 16 October 2017.
- ^ "New features". Read the Docs. 31 July 2025.
- ^ "module". Read the Docs. 31 July 2025.
- ^ "modulefile". Read the Docs. 31 July 2025.
- ^ "Versions for environment-modules". Repology. Retrieved 4 September 2025.
- ^ "Installing Modules on Unix". Read the Docs. 31 July 2025.
- ^ "Installing Modules on Windows". Read the Docs. 31 July 2025.
External links
[edit]- Official website
- modules on GitHub
- 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.
- PennState Environment Modules User Guide
- Drag your design environment kicking and screaming into the '90s with Modules! - SNUB Boston 2001 - Erich Whitney, Axiowave Networks, Mark Sprague, ATI Research
- Xsede Software Environments. The Extreme Science and Engineering Discovery Environment โ National Science Foundation
- cmod โ Alternative C implementation developed in the 1990s
- Lmod โ Lua-based module system
- Spack โ Flexible package manager for HPC software
- EasyBuild โ Software build and installation framework to manage software on HPC systems