| layout | single | ||
|---|---|---|---|
| title | Finding and installing products using Spack | ||
| permalink | /spack-installation/ | ||
| classes | wide | ||
| sidebar |
|
{% include e4s-page-actions.html %}
Spack is a flexible package manager designed for scientific software. It supports multiple compiler versions, dependency resolution, build variants, and installation into isolated environments. This guide provides step-by-step instructions on how to search for, inspect, and install libraries and tools using Spack.
Spack contains packages for all of the products listed in the E4S 25.06 Full Release category. General instructions for building software with Spack can be found at the Spack website. Questions concerning building those packages are deferred to the associated package development team.
Some quickstart instructions are below.
git clone https://github.com/spack/spack.git
cd spack. share/spack/setup-env.shTo load Spack automatically on startup, add the above line to your shell profile (e.g., ~/.bashrc, ~/.zshrc).
Keeping Spack up to date ensures access to the latest package recipes:
spack update
spack install --refreshspack search <name_or_keyword>Example:
spack search mpispack search kokkosspack listspack list --tag e4sspack info <package>This displays:
- Description
- Available versions
- Variants (options)
- Dependencies
- Maintainers
Example:
spack info hdf5spack versions <package>Most scientific software has optional features. Use + to enable and ~ to disable features.
Example: Enable MPI and threading in HDF5
spack install hdf5 +mpi +threadsafeExample: Disable shared libraries
spack install trilinos ~sharedspack compilersspack compiler findspack install kokkos %gcc@12.2.0Spack resolves dependencies automatically. To view the dependency tree:
spack spec <package>Example:
spack spec kokkos +cudaspack install <package>#E# 8.2 Install a specific version
spack install fftw@3.3.10spack install petsc +mpi +debug %gcc@11.3.0spack find
spack find -d # include dependenciesspack load <package>spack unload <package>Spack environments let you manage sets of packages together.
spack env create myenv
spack env activate myenvspack add trilinos +mpi
spack add kokkos +cuda
spack installspack findspack env deactivateTo see available prebuilt binaries:
spack buildcache listSpack will use binaries automatically if available.
| Issue | Solution |
|---|---|
| Build failed | spack -d install <pkg> for debug output |
| Wrong compiler used | Specify %compiler explicitly |
| Dependency mismatch | Check with spack spec <pkg> |
| Clean build | spack clean --all |
-
Search by tags:
spack list --tags=math
-
Find reverse dependencies:
spack dependents <package>
-
Get help:
spack help spack help install
# Find a package
spack search <name>
# Inspect it
spack info <name>
# Customize & verify
spack spec <name +options %compiler@version>
# Install
spack install <name +options %compiler@version>
# Load for use
spack load <name>- Official documentation: https://spack.readthedocs.io
- Package index: https://packages.spack.io
- Tutorials: https://spack.io/tutorials
- GitHub: https://github.com/spack/spack
Spack makes it easy to discover, configure, and install complex scientific software stacks. By understanding how to search for packages, inspect build options, control compilers and dependencies, and manage environments, you can consistently build powerful and reproducible software configurations.