Skip to content

Installation of Spack

Janko Boehm edited this page Jan 26, 2025 · 6 revisions

If Spack is not already present in the above directory, clone Spack from Github:

git clone https://github.com/spack/spack.git $software_ROOT/spack

We check out verison v0.23.0 of Spack (the current version):

cd $software_ROOT/spack
git checkout v0.23.0
cd $software_ROOT

Spack requires a couple of standard system packages to be present. For example, on an Ubuntu machines they can be installed by the following commands (which typically require sudo privilege)

sudo apt update

For 20.04 LTS and 22.04 LTS do:

sudo apt install build-essential ca-certificates coreutils curl environment-modules gfortran git gpg lsb-release python3 python3-distutils python3-venv unzip zip

From 24.04 LTS do:

sudo apt install build-essential ca-certificates coreutils curl environment-modules gfortran git gpg lsb-release python3 python3-setuptools python3-venv unzip zip

To be able to use spack from the command line, run the setup script:

. $software_ROOT/spack/share/spack/setup-env.sh

Note, this script needs to be executed again if you open a new terminal session (preferably set it automatically by adding the line to your .profile file).

Finally, Spack needs to boostrap clingo. This can be done by concretizing any spec, for example

spack spec zlib

Note: If you experience connection timeouts due to a slow internet connection you can set in the following file the variable connect_timeout to a larger value.

vim $software_ROOT/spack/etc/spack/defaults/config.yaml

How to uninstall Spack

Note that Spack can be uninstalled by just deleting its directory and its configuration files. Be CAREFUL to do that, since it will delete your Spack setup. Typically you do NOT want to do that now, so the code is commented out. It can be useful if your Spack installation is broken:

#cd
#rm $software_ROOT/spack/ -rf
#rm .spack -rf