Skip to content

Install Spack on GCG

What is Spack?

Spack is a package management tool which allows you to install multiple versions of software in a way that does not reuqire root.

How to install Spack

Start a terminal on the cluster using OpenOnDemand. Run the following command from your home directory. You can alternatively install Spack in a lab directory if you want to make it available for multiple users.

git clone -c feature.manyFiles=true --depth=2 https://github.com/spack/spack.git

Run the following command to set up spack for your shell. You will have to re-run this command every time you start a new terminal shell.

source ./spack/share/spack/setup-env.sh

[Optional] If you want to to automatically run this command every time you start a new shell, you can add it to your .bashrc file:

Type nano ~/.bashrc and add the following snippet to the end of the file:

# Setup Spack for shell environment
source ~/spack/share/spack/setup-env.sh

Then exit the nano editor (Type CMD+S to save, then CMD-X to exit).

To make the .bashrc changes take place, open a new shell.

Test Spack

To test that Spack is setup in the current shell, try running a Spack command:

E.g.

spack help

Install a package with Spack

You can browse Spack pacakges online at https://packages.spack.io/

Lets install HDF5:

spack install hdf5

This may take a while (minutes to hours) depending on the complexity of the software, since Spack builds software from source.