Skip to content
VLASIFY™
TutorialHPC, GPU & Linux

Installing scientific software on Linux: packages, Spack, conda and containers

Updated · Scientifically reviewed by Priyank Srivastava, PhD on

Short answer

Use the simplest method that gives the versions you need: distribution packages for common tools, conda (or mamba) for Python-centred stacks, Spack for compiled HPC software with many dependency and compiler choices, environment modules to switch between versions, and Apptainer or Docker containers for portable, reproducible environments. Avoid mixing methods in one environment, record exact versions, and build performance-critical codes against the cluster's own MPI and GPU libraries.

Who this is for

Researchers and administrators installing simulation codes, compilers and libraries on workstations, servers and clusters.

Software

Spack ≥ 0.22Miniforge (conda/mamba) current releaseApptainer ≥ 1.2

Prerequisites

  • A Linux machine or cluster account, with a C/C++/Fortran compiler (gcc --version).
  • Enough space in a project or home directory (scientific stacks easily reach tens of gigabytes).
  • On a cluster, check what is already provided: module avail or module spider <name>.

Choosing the method

MethodBest forWatch out for
Distribution packages (apt, dnf)Common tools on your own machineOld versions; needs root
conda / mamba (conda-forge)Python stacks, data analysis, MLLarge environments; not tuned to cluster MPI
SpackCompiled HPC codes with many dependencies and variantsFirst builds take time
Environment modules (Lmod)Switching versions on shared systemsProvided by administrators or Spack
Apptainer / DockerPortable, reproducible environmentsHost MPI and GPU driver compatibility
Build from source (CMake)Codes not packaged anywhere; custom optionsManual dependency management

Example: a Python environment with conda

# After installing Miniforge
mamba create -n sim python=3.12 numpy scipy matplotlib h5py
mamba activate sim
python -c "import numpy, scipy, h5py; print(numpy.__version__)"
mamba env export --from-history > environment.yml

Example: an HPC library stack with Spack

git clone --depth=2 https://github.com/spack/spack.git
. spack/share/spack/setup-env.sh
spack compiler find
spack external find openmpi cmake
spack install hdf5 +mpi ^openmpi
spack load hdf5

spack external find reuses the system MPI and tools instead of rebuilding them, which is preferable on clusters whose MPI is tuned for the interconnect.

Example: a portable container with Apptainer

apptainer pull docker://ubuntu:24.04
apptainer exec ubuntu_24.04.sif cat /etc/os-release
apptainer exec --nv ubuntu_24.04.sif nvidia-smi

Container definitions make an environment rebuildable; see scientific code reproducibility.

Verify

  • Run the code’s own test suite (ctest, make check or pytest) after installation.
  • Check which libraries are actually used: ldd $(which your_program) should show the intended MPI and HDF5, not a mix.
  • Run a small, known case and compare with reference output.

Troubleshooting

  • Wrong MPI picked up: which mpirun and mpirun --version must match the MPI your code was built with; see MPI installation.
  • Compiler too old for C++17/20: load a newer GCC module or install one with Spack (spack install gcc).
  • conda environment conflicts: create a fresh environment with all packages in one command rather than adding packages one by one.
  • GPU not visible in the container: use --nv (NVIDIA) or --rocm (AMD) and confirm the host driver works first.

Assumptions and limitations

  • Commands are examples for common setups; follow each code’s own installation guide, for example WarpX installation.
  • Spack and conda versions change frequently; flags shown are stable but check the current documentation.
  • Licensed software has its own installation requirements not covered here.

Frequently asked questions

Should I use sudo to install software on a cluster?+

You will not have it, and do not need it. conda, Spack and source builds install into your home or project directory. Ask administrators for system-wide changes such as drivers.

Why does my code fail with "error while loading shared libraries"?+

The program cannot find a library it was linked against at run time. Load the same modules or activate the same environment used to build it, or check the library path with ldd on the executable.

Can I use pip inside conda?+

Yes, but install as much as possible with conda first, then pip only for packages not available in conda, and keep that environment separate. Mixing can produce conflicting binary libraries.

Is a container slower?+

For CPU code, typically negligibly. For multi-node MPI and GPUs, containers must be built or run against compatible host MPI and driver versions; Apptainer supports GPU access with the --nv option and documents MPI approaches.

References

  1. Spack documentation · Spack project
  2. Gamblin et al., The Spack package manager: bringing order to HPC software chaos, SC15 · Peer-reviewed article
  3. Apptainer user guide · Apptainer project
  4. conda-forge documentation · conda-forge
  5. Lmod: environment modules · Lmod project

Want this set up and verified for you?

We install, configure and validate scientific software on your workstation, cluster or cloud, and train your team to run it.

Services listed on this page are available today. Products marked “early access” or “in development” on our platform page are not yet generally available.

Spotted an error or an outdated command? Tell us. We correct verified issues promptly.

Related guides

How Vlasify can help

Get a Quote