Skip to content

Installing Environment Modules without root permissions

This short guide will explain how to install the standard Environment Modules software package without root permissions on a Linux or Mac OS X system, together with Tcl on which it depends.

Tcl

  1. Go to https://www.tcl-lang.org and download the latest Tcl sources. At the time of writing, the latest available Tcl version was 8.6.14, which can be downloaded from here. The remainder of these commands will assume Tcl v8.6.14 is being installed, you may need to adjust them accordingly.

  2. Unpack the Tcl source tarball:

    tar xfvz tcl8.6.14-src.tar.gz
    
  3. Pick a location where you will install Tcl. It should be a directory you have write permissions on. My suggestion would be to use something like $HOME/.local/Tcl.

  4. Go to the unix subdirectory of the unpacked Tcl directory, and run the configure script using the --prefix option:

    cd tcl8.6.14/unix
    ./configure --prefix=$HOME/.local/Tcl
    

    If you're building Tcl and Environment Modules on Mac, you should run configure in the tcl8.6.14/macosx directory instead.

  5. Next, build Tcl using the make command. If the system you are building on has multiple cores, running make in parallel will speed up the build. Just use the -j option, and pass it a degree of parallelism (just use the number of cores your system has available), e.g.:

    make -j 4
    
  6. The final step consists of installing Tcl to the directory specified in step 4. To do this, simply run:

    make install
    

All done! Now you are ready to build the Environment Modules package, which requires Tcl.

Environment Modules

  1. Download the latest source tarball for the Environment Modules tools from https://modules.sourceforge.net. At the time of writing, the latest available version is 5.4.0 which can be downloaded from here.

  2. Unpack the downloaded source tarball:

    tar xfvz modules-5.4.0.tar.gz
    
  3. Configure the build, again use --prefix to specify where to install the Environment Modules tool in the end. If you needed to install Tcl by hand as outlined in the previous section, you'll also need to specify where it was installed using the --with-tcl option:

    cd modules-5.4.0
    ./configure --prefix=$HOME/.local/environment-modules --with-tcl=$HOME/.local/Tcl/lib
    
  4. Build with make:

    make
    
  5. Install:

    make install
    

Alright, now just one more thing...

Set up your environment

Because you've installed Environment Modules and Tcl in a non-default location, you need to make sure your environment is setup up correctly to use them.

To make a long story short, these are the commands you need to execute:

export PATH=$HOME/.local/environment-modules/bin:$PATH
export LD_LIBRARY_PATH=$HOME/.local/Tcl/lib:$LD_LIBRARY_PATH
# adjust line below if you're using a shell other than bash, check with 'echo $SHELL'
source $HOME/.local/environment-modules/init/bash

Tip

Add these three lines in your .bashrc file, that way they'll be executed every time you log in.