Rocky Environments

From NIMBioS

About

Rocky uses Lmod to easily set up environments for your projects. By default your Rocky session has a minimal of software/utilities available to you. By loading modules, environment variables and paths are set to give you easy access to not only language utilities and libraries but also specific versions of those.

To use lmod, you will use the module command.


Loading Modules

By default, support for R is not loaded.

[test_user@rocky7 ~]$ Rscript
-bash: Rscript: command not found

By loading the R module, we now have access to R language tools.

[test_user@rocky7 ~]$ module load R
[test_user@rocky7 ~]$ Rscript
Usage: Rscript [options] file [args]
   or: Rscript [options] -e expr [-e expr2 ...] [args]
A binary front-end to R, for use in scripting applications.


Explore Modules

The module command has a few different parameters to help you find what is available.

module avail [name] List available modules with optional partial name search.
module keyword <keyword> Search module names and descriptions for <keyword> and list them.
module spider <name> Search module names and list them with all versions available.
module help <modulename> Describe a module and all included extensions.


[test_user@rocky7 ~]$ module avail octave

------------------------ /apps/current/modules/all ------------------------
   Octave/5.1.0-foss-2019b    
   Octave/6.2.0-foss-2020b
   Octave/7.1.0-foss-2021b (D)


[test_user@rocky7 ~]$ module spider Python
------------
  Python:
------------
    Description:
      Python is a programming language that lets you work more quickly and integrate your systems more effectively.

     Versions:
        Python/2.7.15-foss-2018b
        Python/2.7.15-GCCcore-8.2.0
        Python/2.7.16-GCCcore-8.3.0
        Python/2.7.18-GCCcore-9.3.0
        Python/2.7.18-GCCcore-10.2.0
        Python/2.7.18-GCCcore-10.3.0-bare
        Python/2.7.18-GCCcore-11.2.0-bare
        Python/2.7.18-GCCcore-11.2.0
        Python/2.7.18-GCCcore-11.3.0-bare
        Python/3.7.2-GCCcore-8.2.0
        Python/3.7.4-GCCcore-8.3.0
        Python/3.8.2-GCCcore-9.3.0
        Python/3.8.6-GCCcore-10.2.0
        Python/3.9.5-GCCcore-10.3.0-bare
        Python/3.9.5-GCCcore-10.3.0
        Python/3.9.6-GCCcore-11.2.0-bare
        Python/3.9.6-GCCcore-11.2.0
        Python/3.10.4-GCCcore-11.3.0-bare
        Python/3.10.4-GCCcore-11.3.0
        Python/3.10.8-GCCcore-12.2.0-bare
        Python/3.10.8-GCCcore-12.2.0
        Python/3.11.2-GCCcore-12.2.0-bare


Module Versions

We can load a specific version of python.

[test_user@rocky7 ~]$ module load Python/2.7.18-GCCcore-11.3.0-bare 
[test_user@rocky7 ~]$ python --version
Python 2.7.18

If we switch to a different version of python, Lmod will take care of all loaded modules that need to switch with it.

[test_user@rocky7 ~]$ module load Python/3.11.2-GCCcore-12.2.0-bare 

The following have been reloaded with a version change:
  1) GCCcore/11.3.0 => GCCcore/12.2.0
  2) Python/2.7.18-GCCcore-11.3.0-bare => Python/3.11.2-GCCcore-12.2.0-bare
  3) SQLite/3.38.3-GCCcore-11.3.0 => SQLite/3.39.4-GCCcore-12.2.0
  4) Tcl/8.6.12-GCCcore-11.3.0 => Tcl/8.6.12-GCCcore-12.2.0
  5) binutils/2.38-GCCcore-11.3.0 => binutils/2.39-GCCcore-12.2.0
  6) bzip2/1.0.8-GCCcore-11.3.0 => bzip2/1.0.8-GCCcore-12.2.0
  7) libreadline/8.1.2-GCCcore-11.3.0 => libreadline/8.2-GCCcore-12.2.0
  8) ncurses/6.3-GCCcore-11.3.0 => ncurses/6.3-GCCcore-12.2.0
  9) zlib/1.2.12-GCCcore-11.3.0 => zlib/1.2.12-GCCcore-12.2.0

[test_user@rocky7 ~]$ python --version
Python 3.11.2


Managing Loaded Modules

The module command has parameters to help you manage which modules are loaded.

module list List all currently loaded modules.
module unload <module> Unload a specific module.
module purge Unload all loaded modules.