1.3 Installing Packages in an Environment

Once package(s) to be installed are identified, activate the desired Spack environment. $ spack env activate ENV-NAME. Verify you have enough space in your home directory for the installation. $ home-quota will tell you how much space you have remaining. Typically should reserve at least 10GB or more, depending on the size of the installation.

To create a Spack environment, run $ spack env create ENV-NAME. A comprehensive discussion is provided in the official Spack documentation.

Spack commands are environment sensitive. For example, the find command shows only the specs in the active environment if an environment has been activated. Similarly, the install and uninstallcommands act on the active environment.

$ spack find ==> In environment myenv ==> No root specs ==> 0 installed packages

Adding Abstract Specs

An Abstract spec is the user-specified spec before Spack has applied any defaults or dependency information. Users can add abstract specs to an environment using the spack add command.

$ spack env activate myenv $ spack add gmake

The spack addcommand is environment aware. It adds to the currently active environment. All environment aware commands can also be called using the spack -eflag to specify the environment.

Concretizing

Once specs have been added, they can be concretized. See Spack’s concretizing command documentation for more information.

$ spack concretize

You can also check the programs, and packages to be installed using $ spack spec -lI. The first letter after the hyphen is a lowercase “L”, and the second letter is an uppercase “i”.

This command identifies what dependencies Spack needs in order to install your desired packages along with how it will obtain them. Assuming their are no problems, then it will print a list of the packages and their dependencies, where entries that begin with a green [+] have already been installed somewhere in your local Spack installation, while those that begin with a green [^] are referencing the system installation, and those beginning with a gray - will need to be downloaded and installed.

Installing an Environment

In addition to installing individual specs into an environment, these specs can be installed collectively as the entire environment to your local installation directory (~/.spack) or an alternative directory If you’ve specified in your custom configuration.

$ spack install

Once installed, that’s it! The software packages are available via $ spack load or $ module load.

Generating Lmod Moduefiles for an Environment

After software has installed successfully, to generate Lmod modulefiles (if not automatically generated), run $ spack modules lmod refresh