Tutorial setup

If you have not done the prior sections, you’ll need to start the docker image:

docker run -it ghcr.io/spack/tutorial:sc23

and then set Spack up like this:

git clone --depth=100 --branch=releases/v0.21 https://github.com/spack/spack
. spack/share/spack/setup-env.sh
spack tutorial -y
spack bootstrap now
spack compiler find

See the Basic Installation Tutorial for full details on setup. For more help, join us in the #tutorial channel on Slack – get an invitation at slack.spack.io

Environments Tutorial

We’ve covered how to install, remove, and list packages with Spack using the commands:

This section of the tutorial introduces Spack Environments, which allow you to work with independent groups of packages separately, in a reproducible way. In some ways, Spack environments are similar to virtual environments in other systems (e.g., Python venv), but they are based around file formats (spack.yaml and spack.lock) that can be shared easily and re-used by others across systems.

Administering properly configured software involving lots of packages and/or varying configuration requirements (e.g., different implementations of mpi) for multiple projects and efforts can be overwhelming. Spack environments allow you to readily:

  • establish standard software requirements for your project(s);

  • set up run environments for users;

  • support your usual development environment(s);

  • set up packages for CI/CD;

  • reproduce builds (approximately or exactly) on other machines; and

  • much more.

This tutorial introduces the basics of creating and using environments, then explains how to expand, configure, and build software in them. We will start with the command line interface, then cover editing key environment file directly. We will describe the difference between Spack-managed and independent environments, then finish with a section on reproducible builds.

Environment Basics

Let’s look at the output of spack find at this point in the tutorial.

$ spack find
-- linux-ubuntu22.04-x86_64_v3 / clang@14.0.0 -------------------
gmake@4.4.1  zlib-ng@2.1.4

-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
autoconf@2.69			    libbsd@0.11.7	  openssl@3.1.3
automake@1.16.5			    libedit@3.1-20210216  perl@5.38.0
berkeley-db@18.1.40		    libevent@2.1.12	  pigz@2.7
bison@3.8.2			    libfabric@1.19.0	  pkgconf@1.9.5
bzip2@1.0.8			    libffi@3.4.4	  pmix@5.0.1
ca-certificates-mozilla@2023-05-30  libiconv@1.17	  python@3.11.6
cmake@3.27.7			    libmd@1.0.4		  readline@8.2
curl@8.4.0			    libpciaccess@0.17	  sqlite@3.43.2
diffutils@3.9			    libsigsegv@2.14	  tar@1.34
expat@2.5.0			    libtool@2.4.7	  tcl@8.6.12
findutils@4.9.0			    libxcrypt@4.4.35	  tcl@8.6.12
gdbm@1.23			    libxml2@2.10.3	  trilinos@14.4.0
gettext@0.22.3			    m4@1.4.19		  util-linux-uuid@2.38.1
gmake@4.4.1			    mpich@4.1.2		  util-macros@1.19.3
hdf5@1.14.3			    ncurses@6.4		  xz@5.4.1
hdf5@1.14.3			    nghttp2@1.57.0	  yaksa@0.3
hdf5@1.14.3			    numactl@2.0.14	  zlib-ng@2.0.7
hwloc@2.9.1			    openblas@0.3.24	  zlib-ng@2.0.7
kokkos@4.1.00			    openmpi@4.1.6	  zlib-ng@2.1.4
krb5@1.20.1			    openssh@9.5p1	  zstd@1.5.5
==> 62 installed packages

This is a complete, but cluttered list of the installed packages and their dependencies. It contains packages built with both openmpi and mpich, as well as multiple variants of other packages, like hdf5 and zlib-ng. The query mechanism we learned about with spack find can help, but it would be nice if we could start from a clean slate without losing what we’ve already installed.

Creating and activating environments

The spack env command can help. Let’s create a new environment called myproject:

$ spack env create myproject
==> Created environment 'myproject' in /home/spack/spack/var/spack/environments/myproject
==> You can activate this environment with:
==>   spack env activate myproject

An environment is like a virtualized Spack instance that you can use to aggregate package installations for a project or other purpose. It has an associated view, which is a single prefix where all packages from the environment are linked.

You can see the environments we’ve created so far using the spack env list command:

$ spack env list
==> 1 environments
    myproject

Now let’s activate our environment. You can use spack env activate command:

$ spack env activate myproject

You can also use the spacktivate alias for short.

Note

If you use the -p option for spack env activate, Spack will prepend the environment name to the prompt. This is a handy way to be reminded if and which environment you are in.

Once you activate an environment, spack find only shows what is in the current environment. We just created this environment, so it does not contain any installed packages.

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

The output from spack find is now slightly different. It tells you that you’re in the myproject environment, so there is no need to panic when you see that none of the previously installed packages are available. It also states that there are no root specs. We’ll get back to what that means later.

If you only want to check what environment you are in, you can use spack env status:

$ spack env status
==> In environment myproject

If you want to leave this environment, you can use spack env deactivate or the despacktivate alias for short.

After deactivating, we can see everything installed in this Spack instance:

$ despacktivate	   # short alias for 'spack env deactivate'
$ spack env status
==> No active environment
$ spack find
-- linux-ubuntu22.04-x86_64_v3 / clang@14.0.0 -------------------
gmake@4.4.1  zlib-ng@2.1.4

-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
autoconf@2.69			    libbsd@0.11.7	  openssl@3.1.3
automake@1.16.5			    libedit@3.1-20210216  perl@5.38.0
berkeley-db@18.1.40		    libevent@2.1.12	  pigz@2.7
bison@3.8.2			    libfabric@1.19.0	  pkgconf@1.9.5
bzip2@1.0.8			    libffi@3.4.4	  pmix@5.0.1
ca-certificates-mozilla@2023-05-30  libiconv@1.17	  python@3.11.6
cmake@3.27.7			    libmd@1.0.4		  readline@8.2
curl@8.4.0			    libpciaccess@0.17	  sqlite@3.43.2
diffutils@3.9			    libsigsegv@2.14	  tar@1.34
expat@2.5.0			    libtool@2.4.7	  tcl@8.6.12
findutils@4.9.0			    libxcrypt@4.4.35	  tcl@8.6.12
gdbm@1.23			    libxml2@2.10.3	  trilinos@14.4.0
gettext@0.22.3			    m4@1.4.19		  util-linux-uuid@2.38.1
gmake@4.4.1			    mpich@4.1.2		  util-macros@1.19.3
hdf5@1.14.3			    ncurses@6.4		  xz@5.4.1
hdf5@1.14.3			    nghttp2@1.57.0	  yaksa@0.3
hdf5@1.14.3			    numactl@2.0.14	  zlib-ng@2.0.7
hwloc@2.9.1			    openblas@0.3.24	  zlib-ng@2.0.7
kokkos@4.1.00			    openmpi@4.1.6	  zlib-ng@2.1.4
krb5@1.20.1			    openssh@9.5p1	  zstd@1.5.5
==> 62 installed packages

Notice that we are no longer in an environment and all our packages are still installed.

Installing packages

Now that we understand how creation and activation work, let’s go back to myproject and install a couple of packages, specifically, tcl and trilinos.

Try the usual install command first:

$ spack env activate myproject
$ spack install tcl
==> Error: Cannot install 'tcl' because no matching specs are in the current environment. You can add specs to the environment with 'spack add tcl', or as part of the install command with 'spack install --add tcl'

Environments are special in that you must add specs to them before installing. spack add allows us to do queue up several specs to be installed together. Let’s try it:

$ spack add tcl
==> Adding tcl to environment myproject
$ spack add trilinos
==> Adding trilinos to environment myproject
$ spack find
==> In environment myproject
==> Root specs
tcl   trilinos

==> 0 installed packages

Now, tcl and trilinos have been registered as root specs in this environment. That is because we explicitly asked for them to be installed, so they are the roots of the combined graph of all packages we’ll install.

Now, let’s install:

$ spack install
==> Concretized trilinos
 -   46nzgyj  trilinos@14.4.0%gcc@11.4.0~adelus~adios2+amesos+amesos2+anasazi+aztec~basker+belos~boost~chaco~complex~cuda~cuda_rdc~debug~dtk+epetra+epetraext~epetraextbtf~epetraextexperimental~epetraextgraphreorderings~exodus+explicit_template_instantiation~float+fortran~gtest~hdf5~hypre+ifpack+ifpack2~intrepid~intrepid2~ipo~isorropia+kokkos~mesquite~minitensor+ml+mpi+muelu~mumps~nox~openmp~panzer~phalanx~piro~python~rocm~rocm_rdc~rol~rythmos+sacado~scorec~shards+shared~shylu~stk~stokhos~stratimikos~strumpack~suite-sparse~superlu~superlu-dist~teko~tempus~test~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=Release cxxstd=17 generator=make gotype=long_long arch=linux-ubuntu22.04-x86_64_v3
[+]  kd6xihn	  ^cmake@3.27.7%gcc@11.4.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  ijsmc3j	      ^curl@8.4.0%gcc@11.4.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu22.04-x86_64_v3
[+]  my64owh		  ^nghttp2@1.57.0%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr		  ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u		      ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	      ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	      ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	  ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  dyrsjed	  ^hwloc@2.9.1%gcc@11.4.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  af4bqq6	      ^libpciaccess@0.17%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rgag55h		  ^libtool@2.4.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  b7j7735		  ^util-macros@1.19.3%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv	      ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4		  ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq		  ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	      ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  66qtu3e	  ^kokkos@4.1.00%gcc@11.4.0~aggressive_vectorization~compiler_warnings~cuda~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~examples~hpx~hpx_async_dispatch~hwloc~ipo~memkind~numactl~openmp~openmptarget~pic~rocm+serial+shared~sycl~tests~threads~tuning~wrapper build_system=cmake build_type=Release cxxstd=17 generator=make intel_gpu_arch=none arch=linux-ubuntu22.04-x86_64_v3
[+]  ksqcyto	  ^openblas@0.3.24%gcc@11.4.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	      ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq		  ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf		  ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3		      ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw		  ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj		      ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  z4iqm7n	  ^openmpi@4.1.6%gcc@11.4.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~internal-pmix~java~legacylaunchers~lustre~memchecker~openshmem~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  mbwdizy	      ^numactl@2.0.14%gcc@11.4.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  mnfnoa5		  ^autoconf@2.69%gcc@11.4.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  d3cncgl		  ^automake@1.16.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  jnv5nut		  ^m4@1.4.19%gcc@11.4.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  zuopqri		      ^libsigsegv@2.14%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zjwxy3z	      ^openssh@9.5p1%gcc@11.4.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tjiqlym		  ^krb5@1.20.1%gcc@11.4.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lza42n2		      ^bison@3.8.2%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  cws3eft		      ^findutils@4.9.0%gcc@11.4.0 build_system=autotools patches=440b954 arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo		      ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo			  ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo			      ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm			      ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  s4kq4wo		  ^libedit@3.1-20210216%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g		  ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  fhkyvm3	      ^pmix@5.0.1%gcc@11.4.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  wpvxxka		  ^libevent@2.1.12%gcc@11.4.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> Concretized tcl
[+]  tt2hv6r  tcl@8.6.12%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	  ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	  ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/nghttp2-1.57.0-my64owhngq5r4nl2lpysh2skvrq3nlo5
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/zlib-ng-2.1.4-5xcetrvs3fzd7k27dw5duyxitnsy4uvh
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/ncurses-6.4-qqlh6asufg6vhjnkbhwxl3jmocyolykt
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gmake-4.4.1-znvoaniggvauzxv4yobchqt4g7tyjuc7
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/bzip2-1.0.8-4oz3kpfibmlvfizzivudj7pnzm2w7ce7
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/openssl-3.1.3-35j7wvrf3jovxokjkzdrpv265sfrjwga
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/xz-5.4.1-axxqoeqv4lckdxrkvdp6f376ndmade4c
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libpciaccess-0.17-af4bqq6hwe23ojn7i3o2n7ws2b7wu64m
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/openblas-0.3.24-ksqcytobbocswt2qcw3q3tgmeu4acph6
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/numactl-2.0.14-mbwdizyinycylldk4lrjvq2y474cd5bk
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libedit-3.1-20210216-s4kq4wo6ii3vt3s354agguqm462yu32q
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/kokkos-4.1.00-66qtu3ee26xv4pfrumw6t3d7o7gxqq6f
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libiconv-1.17-ivn4eq42mmvco5l3drcxjzbmpto5nfi2
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pigz-2.7-catlxmodt7sirns2di5pod576omq32hk
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/zstd-1.5.5-jkznmrmqdgtpzvs42qxljrjs6m6f6aho
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libxcrypt-4.4.35-hezcx7ggdisbf6oqol5ucfch7emlggqk
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/curl-8.4.0-ijsmc3jx2cjmdy2svodqqkeimkooheod
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libevent-2.1.12-wpvxxkafb3j7uc465iekvpyhew3brhl7
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libxml2-2.10.3-67qoxbv3pyyep745wytvlgnnosn6pwnr
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/tar-1.34-vdb3ozocdu73c4gl45gnzcjgscfye6mg
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/cmake-3.27.7-kd6xihnhlzyfwafeilow6t2mvolyryor
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/hwloc-2.9.1-dyrsjedv3fxwdi3sutxieq2rcz4etdib
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gettext-0.22.3-y26lmloj3u6romzd6j3xdfiib7gnkbga
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pmix-5.0.1-fhkyvm3nsv5cjxhfszdx2y3rieh274vn
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/krb5-1.20.1-tjiqlymlbmjxyyvwlkumu4qq65nuqr3w
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/openssh-9.5p1-zjwxy3znkrc3yslkm3eoyewet5bxacjc
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/openmpi-4.1.6-z4iqm7nipxsdam3chio7r74ob3cznoof
==> Installing trilinos-14.4.0-46nzgyjf7brdinl7hi5iyyinm6au54mz [28/28]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-trilinos-14.4.0-46nzgyjf7brdinl7hi5iyyinm6au54mz.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/trilinos-14.4.0/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-trilinos-14.4.0-46nzgyjf7brdinl7hi5iyyinm6au54mz.spack
==> Extracting trilinos-14.4.0-46nzgyjf7brdinl7hi5iyyinm6au54mz from binary cache
==> trilinos: Successfully installed trilinos-14.4.0-46nzgyjf7brdinl7hi5iyyinm6au54mz
  Search: 0.00s.  Fetch: 0.23s.	 Install: 1.78s.  Extract: 1.64s.  Relocate: 0.11s.  Total: 2.00s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/trilinos-14.4.0-46nzgyjf7brdinl7hi5iyyinm6au54mz
==> Updating view at /home/spack/spack/var/spack/environments/myproject/.spack-env/view

We see that tcl and the dependencies of trilinos are already installed, and that trilinos was newly installed. We also see that the environment’s view was updated to include the new installations.

Now confirm the contents of the environment using spack find:

$ spack find
==> In environment myproject
==> Root specs
tcl   trilinos

==> Installed packages
-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
autoconf@2.69			    krb5@1.20.1		  openssh@9.5p1
automake@1.16.5			    libedit@3.1-20210216  openssl@3.1.3
berkeley-db@18.1.40		    libevent@2.1.12	  perl@5.38.0
bison@3.8.2			    libiconv@1.17	  pigz@2.7
bzip2@1.0.8			    libpciaccess@0.17	  pkgconf@1.9.5
ca-certificates-mozilla@2023-05-30  libsigsegv@2.14	  pmix@5.0.1
cmake@3.27.7			    libtool@2.4.7	  readline@8.2
curl@8.4.0			    libxcrypt@4.4.35	  tar@1.34
diffutils@3.9			    libxml2@2.10.3	  tcl@8.6.12
findutils@4.9.0			    m4@1.4.19		  trilinos@14.4.0
gdbm@1.23			    ncurses@6.4		  util-macros@1.19.3
gettext@0.22.3			    nghttp2@1.57.0	  xz@5.4.1
gmake@4.4.1			    numactl@2.0.14	  zlib-ng@2.1.4
hwloc@2.9.1			    openblas@0.3.24	  zstd@1.5.5
kokkos@4.1.00			    openmpi@4.1.6
==> 44 installed packages

We can see that the roots and all their dependencies have been installed.

Creating an environment incrementally

As a short-hand, you can use the install --add flag to accomplish the same thing in one step:

$ spack install --add tcl trilinos

This both adds the specs to the environment and installs them.

You can also add and install specs to an environment incrementally. For example:

$ spack install --add tcl
$ spack install --add trilinos

If you create environments incrementally, Spack ensures that already installed roots are not re-concretized. So, adding specs to an environment at a later point in time will not cause existing packages to rebuild.

Do note however that incrementally creating an environment can give you different package versions from an environment created all at once. We will cover this after we’ve discussed different concretization strategies.

Further, there are two other advantages of concretizing and installing an environment all at once:

  • If you have a number of specs that can be installed together, adding them first and installing them together enables them to share dependencies and reduces total installation time.

  • You can launch all builds in parallel by taking advantage of Spack’s install-level build parallelism.

Using packages

Environments provide a convenient way for using installed packages. Running spack env activate gives you everything in the environment on your PATH. Otherwise, you would need to use spack load or module load for each package in order to set up the environment for the package (and its dependencies).

When you install packages into an environment, they are, by default, linked into a single prefix, or view. Activating the environment with spack env activate results in subdirectories from the view being added to PATH, MANPATH, CMAKE_PREFIX_PATH, and other environment variables. This makes the environment easier to use.

Let’s try it out. We just installed tcl into our myproject environment. Tcl includes a shell-like application called tclsh. You can see the path to tclsh using which:

$ which tclsh
/home/spack/spack/var/spack/environments/myproject/.spack-env/view/bin/tclsh

Notice its path includes the name of our environment and a view subdirectory.

You can now run tclsh like you would any other program that is in your path:

$ tclsh
% echo "hello world!"
hello world!
% exit

Uninstalling packages

We can uninstall packages from an environment without affecting other environments. This is possible since, while Spack shares common installations, environments only link to those installations.

Let’s demonstrate this feature by creating another environment. Suppose myproject requires trilinos but we have another project that has it installed but no longer requires it.

Start by creating a myproject2 environment with the installed packages scr and trilinos.

$ spack env create myproject2
==> Created environment 'myproject2' in /home/spack/spack/var/spack/environments/myproject2
==> You can activate this environment with:
==>   spack env activate myproject2
$ spack env activate myproject2
$ spack add scr trilinos
==> Adding scr to environment myproject2
==> Adding trilinos to environment myproject2
$ spack install
==> Concretized scr
 -   rbtcwee  scr@2.0.0%gcc@11.4.0+dtcmp~fortran~ipo+libyogrt async_api=NONE build_system=cmake build_type=Release cache_base=/dev/shm cntl_base=/dev/shm copy_config=none file_lock=FLOCK generator=make resource_manager=SLURM scr_config=scr.conf arch=linux-ubuntu22.04-x86_64_v3
[+]  kd6xihn	  ^cmake@3.27.7%gcc@11.4.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  ijsmc3j	      ^curl@8.4.0%gcc@11.4.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu22.04-x86_64_v3
[+]  my64owh		  ^nghttp2@1.57.0%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr		  ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u		      ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	      ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   xmpw57x	  ^dtcmp@1.1.4%gcc@11.4.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   aexcyce	      ^lwgrp@1.0.5%gcc@11.4.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	  ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   wanayzr	  ^libyogrt@1.33%gcc@11.4.0~static build_system=autotools scheduler=slurm arch=linux-ubuntu22.04-x86_64_v3
 -   ayvcsie	      ^slurm@23-02-4-1%gcc@11.4.0~cgroup~gtk~hdf5~hwloc~mariadb~nvml~pam~pmix+readline~restd~rsmi build_system=autotools sysconfdir=PREFIX/etc arch=linux-ubuntu22.04-x86_64_v3
 -   iebre2x		  ^glib@2.78.0%gcc@11.4.0~libmount~strip build_system=meson buildtype=release default_library=shared patches=2c25d7b tracing=none arch=linux-ubuntu22.04-x86_64_v3
 -   xnvt4js		      ^elfutils@0.189%gcc@11.4.0~debuginfod+exeprefix+nls build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm			  ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo		      ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo			  ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo			      ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  ra2t3ha		      ^libffi@3.4.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4		      ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
 -   bisaeec		      ^meson@1.2.2%gcc@11.4.0 build_system=python_pip patches=0f0b1bd,ae59765 arch=linux-ubuntu22.04-x86_64_v3
 -   g5rag64			  ^py-pip@23.1.2%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   e4rc5s3			  ^py-setuptools@68.0.0%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   e7tv4cz			  ^py-wheel@0.41.2%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   7xzsee6		      ^ninja@1.11.1%gcc@11.4.0+re2c build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   cxbojc6			  ^re2c@2.2%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   bhevh4b		      ^pcre2@10.42%gcc@11.4.0~jit+multibyte build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ybsi7tl		      ^python@3.11.6%gcc@11.4.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=13fa8bf,b0615b2,ebdca64,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  demnlle			  ^expat@2.5.0%gcc@11.4.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  nrlj4tj			      ^libbsd@0.11.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  kg5ets2				  ^libmd@1.0.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  m2h5dly			  ^sqlite@3.43.2%gcc@11.4.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  thv4zdp			  ^util-linux-uuid@2.38.1%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   sfnsfpy		  ^json-c@0.16%gcc@11.4.0~ipo build_system=cmake build_type=Release generator=make arch=linux-ubuntu22.04-x86_64_v3
 -   7b736zq		  ^lz4@1.9.4%gcc@11.4.0+pic build_system=makefile libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
 -   efyihx2		  ^munge@0.5.15%gcc@11.4.0 build_system=autotools localstatedir=PREFIX/var arch=linux-ubuntu22.04-x86_64_v3
 -   e4gmq7v		      ^libgcrypt@1.10.2%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   dtmcfvh			  ^libgpg-error@1.47%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   t4xydm4			      ^gawk@5.2.2%gcc@11.4.0~nls build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   2fyiqrp				  ^gmp@6.2.1%gcc@11.4.0+cxx build_system=autotools libs=shared,static patches=69ad2e2 arch=linux-ubuntu22.04-x86_64_v3
 -   qpadvjw				  ^mpfr@4.2.0%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
 -   4wbogd6				      ^autoconf-archive@2023.02.20%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   km6pqxp				      ^texinfo@7.0.3%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj		  ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  z4iqm7n	  ^openmpi@4.1.6%gcc@11.4.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~internal-pmix~java~legacylaunchers~lustre~memchecker~openshmem~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  dyrsjed	      ^hwloc@2.9.1%gcc@11.4.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  af4bqq6		  ^libpciaccess@0.17%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  b7j7735		      ^util-macros@1.19.3%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv		  ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq		      ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  mbwdizy	      ^numactl@2.0.14%gcc@11.4.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  mnfnoa5		  ^autoconf@2.69%gcc@11.4.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  d3cncgl		  ^automake@1.16.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rgag55h		  ^libtool@2.4.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  jnv5nut		  ^m4@1.4.19%gcc@11.4.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3		      ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zuopqri		      ^libsigsegv@2.14%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zjwxy3z	      ^openssh@9.5p1%gcc@11.4.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tjiqlym		  ^krb5@1.20.1%gcc@11.4.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lza42n2		      ^bison@3.8.2%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  cws3eft		      ^findutils@4.9.0%gcc@11.4.0 build_system=autotools patches=440b954 arch=linux-ubuntu22.04-x86_64_v3
[+]  s4kq4wo		  ^libedit@3.1-20210216%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g		  ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	      ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq		  ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf		  ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw		  ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	      ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  fhkyvm3	      ^pmix@5.0.1%gcc@11.4.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  wpvxxka		  ^libevent@2.1.12%gcc@11.4.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   ier6vff	  ^pdsh@2.31%gcc@11.4.0+ssh+static_modules build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	  ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> Concretized trilinos
[+]  46nzgyj  trilinos@14.4.0%gcc@11.4.0~adelus~adios2+amesos+amesos2+anasazi+aztec~basker+belos~boost~chaco~complex~cuda~cuda_rdc~debug~dtk+epetra+epetraext~epetraextbtf~epetraextexperimental~epetraextgraphreorderings~exodus+explicit_template_instantiation~float+fortran~gtest~hdf5~hypre+ifpack+ifpack2~intrepid~intrepid2~ipo~isorropia+kokkos~mesquite~minitensor+ml+mpi+muelu~mumps~nox~openmp~panzer~phalanx~piro~python~rocm~rocm_rdc~rol~rythmos+sacado~scorec~shards+shared~shylu~stk~stokhos~stratimikos~strumpack~suite-sparse~superlu~superlu-dist~teko~tempus~test~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=Release cxxstd=17 generator=make gotype=long_long arch=linux-ubuntu22.04-x86_64_v3
[+]  kd6xihn	  ^cmake@3.27.7%gcc@11.4.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  ijsmc3j	      ^curl@8.4.0%gcc@11.4.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu22.04-x86_64_v3
[+]  my64owh		  ^nghttp2@1.57.0%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr		  ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u		      ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	      ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	      ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	  ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  dyrsjed	  ^hwloc@2.9.1%gcc@11.4.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  af4bqq6	      ^libpciaccess@0.17%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rgag55h		  ^libtool@2.4.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  b7j7735		  ^util-macros@1.19.3%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv	      ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4		  ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq		  ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	      ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  66qtu3e	  ^kokkos@4.1.00%gcc@11.4.0~aggressive_vectorization~compiler_warnings~cuda~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~examples~hpx~hpx_async_dispatch~hwloc~ipo~memkind~numactl~openmp~openmptarget~pic~rocm+serial+shared~sycl~tests~threads~tuning~wrapper build_system=cmake build_type=Release cxxstd=17 generator=make intel_gpu_arch=none arch=linux-ubuntu22.04-x86_64_v3
[+]  ksqcyto	  ^openblas@0.3.24%gcc@11.4.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	      ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq		  ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf		  ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3		      ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw		  ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj		      ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  z4iqm7n	  ^openmpi@4.1.6%gcc@11.4.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~internal-pmix~java~legacylaunchers~lustre~memchecker~openshmem~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  mbwdizy	      ^numactl@2.0.14%gcc@11.4.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  mnfnoa5		  ^autoconf@2.69%gcc@11.4.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  d3cncgl		  ^automake@1.16.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  jnv5nut		  ^m4@1.4.19%gcc@11.4.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  zuopqri		      ^libsigsegv@2.14%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zjwxy3z	      ^openssh@9.5p1%gcc@11.4.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tjiqlym		  ^krb5@1.20.1%gcc@11.4.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lza42n2		      ^bison@3.8.2%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  cws3eft		      ^findutils@4.9.0%gcc@11.4.0 build_system=autotools patches=440b954 arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo		      ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo			  ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo			      ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm			      ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  s4kq4wo		  ^libedit@3.1-20210216%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g		  ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  fhkyvm3	      ^pmix@5.0.1%gcc@11.4.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  wpvxxka		  ^libevent@2.1.12%gcc@11.4.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/nghttp2-1.57.0-my64owhngq5r4nl2lpysh2skvrq3nlo5
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/zlib-ng-2.1.4-5xcetrvs3fzd7k27dw5duyxitnsy4uvh
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/ncurses-6.4-qqlh6asufg6vhjnkbhwxl3jmocyolykt
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gmake-4.4.1-znvoaniggvauzxv4yobchqt4g7tyjuc7
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/bzip2-1.0.8-4oz3kpfibmlvfizzivudj7pnzm2w7ce7
==> Installing re2c-2.2-cxbojc654subbjuafzr5hpmcywcnasqp [6/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-re2c-2.2-cxbojc654subbjuafzr5hpmcywcnasqp.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/re2c-2.2/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-re2c-2.2-cxbojc654subbjuafzr5hpmcywcnasqp.spack
==> Extracting re2c-2.2-cxbojc654subbjuafzr5hpmcywcnasqp from binary cache
==> re2c: Successfully installed re2c-2.2-cxbojc654subbjuafzr5hpmcywcnasqp
  Search: 0.00s.  Fetch: 0.13s.	 Install: 0.26s.  Extract: 0.23s.  Relocate: 0.02s.  Total: 0.39s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/re2c-2.2-cxbojc654subbjuafzr5hpmcywcnasqp
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/openssl-3.1.3-35j7wvrf3jovxokjkzdrpv265sfrjwga
==> Installing autoconf-archive-2023.02.20-4wbogd6h4jop5ktv44amjnwgadxs4x7s [8/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-autoconf-archive-2023.02.20-4wbogd6h4jop5ktv44amjnwgadxs4x7s.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/autoconf-archive-2023.02.20/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-autoconf-archive-2023.02.20-4wbogd6h4jop5ktv44amjnwgadxs4x7s.spack
==> Extracting autoconf-archive-2023.02.20-4wbogd6h4jop5ktv44amjnwgadxs4x7s from binary cache
==> autoconf-archive: Successfully installed autoconf-archive-2023.02.20-4wbogd6h4jop5ktv44amjnwgadxs4x7s
  Search: 0.00s.  Fetch: 0.02s.	 Install: 0.13s.  Extract: 0.11s.  Relocate: 0.01s.  Total: 0.15s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/autoconf-archive-2023.02.20-4wbogd6h4jop5ktv44amjnwgadxs4x7s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libsigsegv-2.14-zuopqrik4y7vhqq2isjnr6mbixyks4uk
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/numactl-2.0.14-mbwdizyinycylldk4lrjvq2y474cd5bk
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libmd-1.0.4-kg5ets2yozvitt2jh3zemld7y3l3zjbl
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/zstd-1.5.5-jkznmrmqdgtpzvs42qxljrjs6m6f6aho
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libiconv-1.17-ivn4eq42mmvco5l3drcxjzbmpto5nfi2
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/xz-5.4.1-axxqoeqv4lckdxrkvdp6f376ndmade4c
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libtool-2.4.7-rgag55hxbjmkoqpx4gnr2golz2zfyvnt
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/readline-8.2-xxgqlmjyegrwwuq2pq4zaq7y6qojp3mz
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pkgconf-1.9.5-zjgtpdofa5acoyfs62cczvdj3gjngy3y
==> Installing lz4-1.9.4-7b736zqpihd37tovanu7vkpew7xuj3di [18/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-lz4-1.9.4-7b736zqpihd37tovanu7vkpew7xuj3di.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/lz4-1.9.4/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-lz4-1.9.4-7b736zqpihd37tovanu7vkpew7xuj3di.spack
==> Extracting lz4-1.9.4-7b736zqpihd37tovanu7vkpew7xuj3di from binary cache
==> lz4: Successfully installed lz4-1.9.4-7b736zqpihd37tovanu7vkpew7xuj3di
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.03s.  Extract: 0.02s.  Relocate: 0.01s.  Total: 0.04s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/lz4-1.9.4-7b736zqpihd37tovanu7vkpew7xuj3di
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pigz-2.7-catlxmodt7sirns2di5pod576omq32hk
==> Installing pcre2-10.42-bhevh4b6clcn2ygvpcpghagarv56ujwp [20/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-pcre2-10.42-bhevh4b6clcn2ygvpcpghagarv56ujwp.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pcre2-10.42/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-pcre2-10.42-bhevh4b6clcn2ygvpcpghagarv56ujwp.spack
==> Extracting pcre2-10.42-bhevh4b6clcn2ygvpcpghagarv56ujwp from binary cache
==> pcre2: Successfully installed pcre2-10.42-bhevh4b6clcn2ygvpcpghagarv56ujwp
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.09s.  Extract: 0.08s.  Relocate: 0.01s.  Total: 0.10s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pcre2-10.42-bhevh4b6clcn2ygvpcpghagarv56ujwp
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libxcrypt-4.4.35-hezcx7ggdisbf6oqol5ucfch7emlggqk
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libffi-3.4.4-ra2t3ha2gt2svq4tygpxxjvdwd4naz3h
==> Installing pdsh-2.31-ier6vffxkh5ejrzpsqyp2k2aydpfdsya [23/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-pdsh-2.31-ier6vffxkh5ejrzpsqyp2k2aydpfdsya.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pdsh-2.31/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-pdsh-2.31-ier6vffxkh5ejrzpsqyp2k2aydpfdsya.spack
==> Extracting pdsh-2.31-ier6vffxkh5ejrzpsqyp2k2aydpfdsya from binary cache
==> pdsh: Successfully installed pdsh-2.31-ier6vffxkh5ejrzpsqyp2k2aydpfdsya
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.03s.  Extract: 0.02s.  Relocate: 0.01s.  Total: 0.04s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pdsh-2.31-ier6vffxkh5ejrzpsqyp2k2aydpfdsya
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/berkeley-db-18.1.40-ku7makqmto7yrue2y3duu2phqtnvqd26
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/m4-1.4.19-jnv5nut43juhm7esjn3tvxas6m67zbx4
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libbsd-0.11.7-nrlj4tjdnkqa5cuwg5cs5ln5sduh6ix5
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libevent-2.1.12-wpvxxkafb3j7uc465iekvpyhew3brhl7
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/sqlite-3.43.2-m2h5dlyuaedkfodlyjmslhvmztd7jopi
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gdbm-1.23-m626hzwxamau2a4cbu2hptq477qnufc4
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/util-linux-uuid-2.38.1-thv4zdpqlzulq6dzneomha3i3wdkmmtt
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/curl-8.4.0-ijsmc3jx2cjmdy2svodqqkeimkooheod
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libedit-3.1-20210216-s4kq4wo6ii3vt3s354agguqm462yu32q
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libpciaccess-0.17-af4bqq6hwe23ojn7i3o2n7ws2b7wu64m
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libxml2-2.10.3-67qoxbv3pyyep745wytvlgnnosn6pwnr
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/tar-1.34-vdb3ozocdu73c4gl45gnzcjgscfye6mg
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/expat-2.5.0-demnlleyekfpzroyoll2jcki6wxttwhw
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/perl-5.38.0-dg34i2ae7omo77k6ntqkb6zi76gmeava
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/cmake-3.27.7-kd6xihnhlzyfwafeilow6t2mvolyryor
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/hwloc-2.9.1-dyrsjedv3fxwdi3sutxieq2rcz4etdib
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gettext-0.22.3-y26lmloj3u6romzd6j3xdfiib7gnkbga
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/automake-1.16.5-d3cncglfvi2mpx7ytpfqnleyc233qcej
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/autoconf-2.69-mnfnoa5qnshe7gdq7gnlkwowqxyrymia
==> Installing json-c-0.16-sfnsfpykxyoykjqy3fyk5iadtssg2v7v [43/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-json-c-0.16-sfnsfpykxyoykjqy3fyk5iadtssg2v7v.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/json-c-0.16/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-json-c-0.16-sfnsfpykxyoykjqy3fyk5iadtssg2v7v.spack
==> Extracting json-c-0.16-sfnsfpykxyoykjqy3fyk5iadtssg2v7v from binary cache
==> json-c: Successfully installed json-c-0.16-sfnsfpykxyoykjqy3fyk5iadtssg2v7v
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.03s.  Extract: 0.02s.  Relocate: 0.01s.  Total: 0.04s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/json-c-0.16-sfnsfpykxyoykjqy3fyk5iadtssg2v7v
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/pmix-5.0.1-fhkyvm3nsv5cjxhfszdx2y3rieh274vn
==> Installing texinfo-7.0.3-km6pqxpokzzltdfmos6imx5ema426pbo [45/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-texinfo-7.0.3-km6pqxpokzzltdfmos6imx5ema426pbo.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/texinfo-7.0.3/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-texinfo-7.0.3-km6pqxpokzzltdfmos6imx5ema426pbo.spack
==> Extracting texinfo-7.0.3-km6pqxpokzzltdfmos6imx5ema426pbo from binary cache
==> texinfo: Successfully installed texinfo-7.0.3-km6pqxpokzzltdfmos6imx5ema426pbo
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.21s.  Extract: 0.17s.  Relocate: 0.03s.  Total: 0.22s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/texinfo-7.0.3-km6pqxpokzzltdfmos6imx5ema426pbo
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/python-3.11.6-ybsi7tlnssr3m4h3eqrzq6tyxdcsr2n7
==> Installing elfutils-0.189-xnvt4jsw4zbkvyp5w4zayfavuoe2e7px [47/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-elfutils-0.189-xnvt4jsw4zbkvyp5w4zayfavuoe2e7px.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/elfutils-0.189/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-elfutils-0.189-xnvt4jsw4zbkvyp5w4zayfavuoe2e7px.spack
==> Extracting elfutils-0.189-xnvt4jsw4zbkvyp5w4zayfavuoe2e7px from binary cache
==> elfutils: Successfully installed elfutils-0.189-xnvt4jsw4zbkvyp5w4zayfavuoe2e7px
  Search: 0.00s.  Fetch: 0.03s.	 Install: 0.28s.  Extract: 0.23s.  Relocate: 0.03s.  Total: 0.31s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/elfutils-0.189-xnvt4jsw4zbkvyp5w4zayfavuoe2e7px
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/krb5-1.20.1-tjiqlymlbmjxyyvwlkumu4qq65nuqr3w
==> Installing gmp-6.2.1-2fyiqrpectdqmzxrocihc3d6liwcog7q [49/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-gmp-6.2.1-2fyiqrpectdqmzxrocihc3d6liwcog7q.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gmp-6.2.1/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-gmp-6.2.1-2fyiqrpectdqmzxrocihc3d6liwcog7q.spack
==> Extracting gmp-6.2.1-2fyiqrpectdqmzxrocihc3d6liwcog7q from binary cache
==> gmp: Successfully installed gmp-6.2.1-2fyiqrpectdqmzxrocihc3d6liwcog7q
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.05s.  Extract: 0.04s.  Relocate: 0.01s.  Total: 0.06s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gmp-6.2.1-2fyiqrpectdqmzxrocihc3d6liwcog7q
==> Installing ninja-1.11.1-7xzsee6hu3gdr4d2swaeyi73c6bvypaf [50/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-ninja-1.11.1-7xzsee6hu3gdr4d2swaeyi73c6bvypaf.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/ninja-1.11.1/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-ninja-1.11.1-7xzsee6hu3gdr4d2swaeyi73c6bvypaf.spack
==> Extracting ninja-1.11.1-7xzsee6hu3gdr4d2swaeyi73c6bvypaf from binary cache
==> ninja: Successfully installed ninja-1.11.1-7xzsee6hu3gdr4d2swaeyi73c6bvypaf
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.10s.  Extract: 0.08s.  Relocate: 0.01s.  Total: 0.11s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/ninja-1.11.1-7xzsee6hu3gdr4d2swaeyi73c6bvypaf
==> Installing py-pip-23.1.2-g5rag64qfetapbsrb4nof7rrps5bge3t [51/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-py-pip-23.1.2-g5rag64qfetapbsrb4nof7rrps5bge3t.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/py-pip-23.1.2/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-py-pip-23.1.2-g5rag64qfetapbsrb4nof7rrps5bge3t.spack
==> Extracting py-pip-23.1.2-g5rag64qfetapbsrb4nof7rrps5bge3t from binary cache
==> py-pip: Successfully installed py-pip-23.1.2-g5rag64qfetapbsrb4nof7rrps5bge3t
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.30s.  Extract: 0.28s.  Relocate: 0.01s.  Total: 0.31s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/py-pip-23.1.2-g5rag64qfetapbsrb4nof7rrps5bge3t
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/openssh-9.5p1-zjwxy3znkrc3yslkm3eoyewet5bxacjc
==> Installing mpfr-4.2.0-qpadvjwbtznek4qmw4juuzibprsy6hq2 [53/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-mpfr-4.2.0-qpadvjwbtznek4qmw4juuzibprsy6hq2.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/mpfr-4.2.0/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-mpfr-4.2.0-qpadvjwbtznek4qmw4juuzibprsy6hq2.spack
==> Extracting mpfr-4.2.0-qpadvjwbtznek4qmw4juuzibprsy6hq2 from binary cache
==> mpfr: Successfully installed mpfr-4.2.0-qpadvjwbtznek4qmw4juuzibprsy6hq2
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.10s.  Extract: 0.08s.  Relocate: 0.01s.  Total: 0.11s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/mpfr-4.2.0-qpadvjwbtznek4qmw4juuzibprsy6hq2
==> Installing py-setuptools-68.0.0-e4rc5s3sr6ck6m5rmxcktibbd65ucffw [54/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-py-setuptools-68.0.0-e4rc5s3sr6ck6m5rmxcktibbd65ucffw.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/py-setuptools-68.0.0/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-py-setuptools-68.0.0-e4rc5s3sr6ck6m5rmxcktibbd65ucffw.spack
==> Extracting py-setuptools-68.0.0-e4rc5s3sr6ck6m5rmxcktibbd65ucffw from binary cache
==> py-setuptools: Successfully installed py-setuptools-68.0.0-e4rc5s3sr6ck6m5rmxcktibbd65ucffw
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.15s.  Extract: 0.13s.  Relocate: 0.01s.  Total: 0.16s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/py-setuptools-68.0.0-e4rc5s3sr6ck6m5rmxcktibbd65ucffw
==> Installing py-wheel-0.41.2-e7tv4czck7i64ifn22wzlu4z3o5uptrh [55/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-py-wheel-0.41.2-e7tv4czck7i64ifn22wzlu4z3o5uptrh.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/py-wheel-0.41.2/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-py-wheel-0.41.2-e7tv4czck7i64ifn22wzlu4z3o5uptrh.spack
==> Extracting py-wheel-0.41.2-e7tv4czck7i64ifn22wzlu4z3o5uptrh from binary cache
==> py-wheel: Successfully installed py-wheel-0.41.2-e7tv4czck7i64ifn22wzlu4z3o5uptrh
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.05s.  Extract: 0.03s.  Relocate: 0.01s.  Total: 0.06s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/py-wheel-0.41.2-e7tv4czck7i64ifn22wzlu4z3o5uptrh
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/openmpi-4.1.6-z4iqm7nipxsdam3chio7r74ob3cznoof
==> Installing gawk-5.2.2-t4xydm4ppyli6uphcmirv4kov6qhtamw [57/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-gawk-5.2.2-t4xydm4ppyli6uphcmirv4kov6qhtamw.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gawk-5.2.2/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-gawk-5.2.2-t4xydm4ppyli6uphcmirv4kov6qhtamw.spack
==> Extracting gawk-5.2.2-t4xydm4ppyli6uphcmirv4kov6qhtamw from binary cache
==> gawk: Successfully installed gawk-5.2.2-t4xydm4ppyli6uphcmirv4kov6qhtamw
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.10s.  Extract: 0.07s.  Relocate: 0.02s.  Total: 0.11s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/gawk-5.2.2-t4xydm4ppyli6uphcmirv4kov6qhtamw
==> Installing meson-1.2.2-bisaeecdki5k4gzlpk3et56lqqdmc6ou [58/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-meson-1.2.2-bisaeecdki5k4gzlpk3et56lqqdmc6ou.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/meson-1.2.2/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-meson-1.2.2-bisaeecdki5k4gzlpk3et56lqqdmc6ou.spack
==> Extracting meson-1.2.2-bisaeecdki5k4gzlpk3et56lqqdmc6ou from binary cache
==> meson: Successfully installed meson-1.2.2-bisaeecdki5k4gzlpk3et56lqqdmc6ou
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.17s.  Extract: 0.15s.  Relocate: 0.01s.  Total: 0.18s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/meson-1.2.2-bisaeecdki5k4gzlpk3et56lqqdmc6ou
==> Installing lwgrp-1.0.5-aexcyce223cflx5a6k4cs3xe4git3fr6 [59/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-lwgrp-1.0.5-aexcyce223cflx5a6k4cs3xe4git3fr6.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/lwgrp-1.0.5/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-lwgrp-1.0.5-aexcyce223cflx5a6k4cs3xe4git3fr6.spack
==> Extracting lwgrp-1.0.5-aexcyce223cflx5a6k4cs3xe4git3fr6 from binary cache
==> lwgrp: Successfully installed lwgrp-1.0.5-aexcyce223cflx5a6k4cs3xe4git3fr6
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.06s.  Extract: 0.03s.  Relocate: 0.02s.  Total: 0.07s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/lwgrp-1.0.5-aexcyce223cflx5a6k4cs3xe4git3fr6
==> Installing libgpg-error-1.47-dtmcfvhypl5rdf75lfhigp65skgt3r4e [60/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-libgpg-error-1.47-dtmcfvhypl5rdf75lfhigp65skgt3r4e.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libgpg-error-1.47/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-libgpg-error-1.47-dtmcfvhypl5rdf75lfhigp65skgt3r4e.spack
==> Extracting libgpg-error-1.47-dtmcfvhypl5rdf75lfhigp65skgt3r4e from binary cache
==> libgpg-error: Successfully installed libgpg-error-1.47-dtmcfvhypl5rdf75lfhigp65skgt3r4e
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.06s.  Extract: 0.04s.  Relocate: 0.01s.  Total: 0.07s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libgpg-error-1.47-dtmcfvhypl5rdf75lfhigp65skgt3r4e
==> Installing glib-2.78.0-iebre2xl7gj3yzryuaegzblqb7imy3zb [61/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-glib-2.78.0-iebre2xl7gj3yzryuaegzblqb7imy3zb.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/glib-2.78.0/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-glib-2.78.0-iebre2xl7gj3yzryuaegzblqb7imy3zb.spack
==> Extracting glib-2.78.0-iebre2xl7gj3yzryuaegzblqb7imy3zb from binary cache
==> glib: Successfully installed glib-2.78.0-iebre2xl7gj3yzryuaegzblqb7imy3zb
  Search: 0.00s.  Fetch: 0.02s.	 Install: 0.30s.  Extract: 0.24s.  Relocate: 0.04s.  Total: 0.31s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/glib-2.78.0-iebre2xl7gj3yzryuaegzblqb7imy3zb
==> Installing dtcmp-1.1.4-xmpw57xw7behtaxyvge7azg4uvb5k4td [62/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-dtcmp-1.1.4-xmpw57xw7behtaxyvge7azg4uvb5k4td.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/dtcmp-1.1.4/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-dtcmp-1.1.4-xmpw57xw7behtaxyvge7azg4uvb5k4td.spack
==> Extracting dtcmp-1.1.4-xmpw57xw7behtaxyvge7azg4uvb5k4td from binary cache
==> dtcmp: Successfully installed dtcmp-1.1.4-xmpw57xw7behtaxyvge7azg4uvb5k4td
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.06s.  Extract: 0.03s.  Relocate: 0.02s.  Total: 0.07s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/dtcmp-1.1.4-xmpw57xw7behtaxyvge7azg4uvb5k4td
==> Installing libgcrypt-1.10.2-e4gmq7vzn3ro2t6dgfwooov4iczhwprd [63/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-libgcrypt-1.10.2-e4gmq7vzn3ro2t6dgfwooov4iczhwprd.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libgcrypt-1.10.2/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-libgcrypt-1.10.2-e4gmq7vzn3ro2t6dgfwooov4iczhwprd.spack
==> Extracting libgcrypt-1.10.2-e4gmq7vzn3ro2t6dgfwooov4iczhwprd from binary cache
==> libgcrypt: Successfully installed libgcrypt-1.10.2-e4gmq7vzn3ro2t6dgfwooov4iczhwprd
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.08s.  Extract: 0.05s.  Relocate: 0.01s.  Total: 0.09s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libgcrypt-1.10.2-e4gmq7vzn3ro2t6dgfwooov4iczhwprd
==> Installing munge-0.5.15-efyihx2ojxkclrxz6fvzditnfw3iooue [64/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-munge-0.5.15-efyihx2ojxkclrxz6fvzditnfw3iooue.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/munge-0.5.15/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-munge-0.5.15-efyihx2ojxkclrxz6fvzditnfw3iooue.spack
==> Extracting munge-0.5.15-efyihx2ojxkclrxz6fvzditnfw3iooue from binary cache
==> munge: Successfully installed munge-0.5.15-efyihx2ojxkclrxz6fvzditnfw3iooue
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.06s.  Extract: 0.03s.  Relocate: 0.01s.  Total: 0.07s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/munge-0.5.15-efyihx2ojxkclrxz6fvzditnfw3iooue
==> Installing slurm-23-02-4-1-ayvcsieiqowb47wfopohuz5fg2wx4v23 [65/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-slurm-23-02-4-1-ayvcsieiqowb47wfopohuz5fg2wx4v23.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/slurm-23-02-4-1/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-slurm-23-02-4-1-ayvcsieiqowb47wfopohuz5fg2wx4v23.spack
==> Extracting slurm-23-02-4-1-ayvcsieiqowb47wfopohuz5fg2wx4v23 from binary cache
==> slurm: Successfully installed slurm-23-02-4-1-ayvcsieiqowb47wfopohuz5fg2wx4v23
  Search: 0.00s.  Fetch: 0.15s.	 Install: 2.62s.  Extract: 2.49s.  Relocate: 0.12s.  Total: 2.77s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/slurm-23-02-4-1-ayvcsieiqowb47wfopohuz5fg2wx4v23
==> Installing libyogrt-1.33-wanayzrgtu4c6p6fflkaksm5jcaxhl7i [66/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-libyogrt-1.33-wanayzrgtu4c6p6fflkaksm5jcaxhl7i.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libyogrt-1.33/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-libyogrt-1.33-wanayzrgtu4c6p6fflkaksm5jcaxhl7i.spack
==> Extracting libyogrt-1.33-wanayzrgtu4c6p6fflkaksm5jcaxhl7i from binary cache
==> libyogrt: Successfully installed libyogrt-1.33-wanayzrgtu4c6p6fflkaksm5jcaxhl7i
  Search: 0.00s.  Fetch: 0.15s.	 Install: 0.08s.  Extract: 0.03s.  Relocate: 0.04s.  Total: 0.24s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/libyogrt-1.33-wanayzrgtu4c6p6fflkaksm5jcaxhl7i
==> Installing scr-2.0.0-rbtcwee6sv4wfwduv7prquuylx3ayoqc [67/67]
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-scr-2.0.0-rbtcwee6sv4wfwduv7prquuylx3ayoqc.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/scr-2.0.0/linux-ubuntu22.04-x86_64_v3-gcc-11.4.0-scr-2.0.0-rbtcwee6sv4wfwduv7prquuylx3ayoqc.spack
==> Extracting scr-2.0.0-rbtcwee6sv4wfwduv7prquuylx3ayoqc from binary cache
==> scr: Successfully installed scr-2.0.0-rbtcwee6sv4wfwduv7prquuylx3ayoqc
  Search: 0.00s.  Fetch: 0.01s.	 Install: 0.15s.  Extract: 0.07s.  Relocate: 0.06s.  Total: 0.16s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.4.0/scr-2.0.0-rbtcwee6sv4wfwduv7prquuylx3ayoqc
==> Updating view at /home/spack/spack/var/spack/environments/myproject2/.spack-env/view
$ spack find
==> In environment myproject2
==> Root specs
scr   trilinos

==> Installed packages
-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
autoconf@2.69			    libedit@3.1-20210216  openssh@9.5p1
autoconf-archive@2023.02.20	    libevent@2.1.12	  openssl@3.1.3
automake@1.16.5			    libffi@3.4.4	  pcre2@10.42
berkeley-db@18.1.40		    libgcrypt@1.10.2	  pdsh@2.31
bison@3.8.2			    libgpg-error@1.47	  perl@5.38.0
bzip2@1.0.8			    libiconv@1.17	  pigz@2.7
ca-certificates-mozilla@2023-05-30  libmd@1.0.4		  pkgconf@1.9.5
cmake@3.27.7			    libpciaccess@0.17	  pmix@5.0.1
curl@8.4.0			    libsigsegv@2.14	  py-pip@23.1.2
diffutils@3.9			    libtool@2.4.7	  py-setuptools@68.0.0
dtcmp@1.1.4			    libxcrypt@4.4.35	  py-wheel@0.41.2
elfutils@0.189			    libxml2@2.10.3	  python@3.11.6
expat@2.5.0			    libyogrt@1.33	  re2c@2.2
findutils@4.9.0			    lwgrp@1.0.5		  readline@8.2
gawk@5.2.2			    lz4@1.9.4		  scr@2.0.0
gdbm@1.23			    m4@1.4.19		  slurm@23-02-4-1
gettext@0.22.3			    meson@1.2.2		  sqlite@3.43.2
glib@2.78.0			    mpfr@4.2.0		  tar@1.34
gmake@4.4.1			    munge@0.5.15	  texinfo@7.0.3
gmp@6.2.1			    ncurses@6.4		  trilinos@14.4.0
hwloc@2.9.1			    nghttp2@1.57.0	  util-linux-uuid@2.38.1
json-c@0.16			    ninja@1.11.1	  util-macros@1.19.3
kokkos@4.1.00			    numactl@2.0.14	  xz@5.4.1
krb5@1.20.1			    openblas@0.3.24	  zlib-ng@2.1.4
libbsd@0.11.7			    openmpi@4.1.6	  zstd@1.5.5
==> 75 installed packages

Now we have two environments. The myproject environment has tcl and trilinos while the myproject2 environment has scr and trilinos.

Now let’s try to uninstall trilinos from myproject2 and review the contents of the environment:

$ spack uninstall -y trilinos
==> Refusing to uninstall the following specs
    -- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
    46nzgyj trilinos@14.4.0

==> The following environments still reference these specs:
    myproject

==> Error: There are still dependents.
  use `spack env remove` to remove environments
  use `spack uninstall --force` to override
$ spack find
==> In environment myproject2
==> Root specs
scr   trilinos

==> Installed packages
-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
autoconf@2.69			    libedit@3.1-20210216  openssh@9.5p1
autoconf-archive@2023.02.20	    libevent@2.1.12	  openssl@3.1.3
automake@1.16.5			    libffi@3.4.4	  pcre2@10.42
berkeley-db@18.1.40		    libgcrypt@1.10.2	  pdsh@2.31
bison@3.8.2			    libgpg-error@1.47	  perl@5.38.0
bzip2@1.0.8			    libiconv@1.17	  pigz@2.7
ca-certificates-mozilla@2023-05-30  libmd@1.0.4		  pkgconf@1.9.5
cmake@3.27.7			    libpciaccess@0.17	  pmix@5.0.1
curl@8.4.0			    libsigsegv@2.14	  py-pip@23.1.2
diffutils@3.9			    libtool@2.4.7	  py-setuptools@68.0.0
dtcmp@1.1.4			    libxcrypt@4.4.35	  py-wheel@0.41.2
elfutils@0.189			    libxml2@2.10.3	  python@3.11.6
expat@2.5.0			    libyogrt@1.33	  re2c@2.2
findutils@4.9.0			    lwgrp@1.0.5		  readline@8.2
gawk@5.2.2			    lz4@1.9.4		  scr@2.0.0
gdbm@1.23			    m4@1.4.19		  slurm@23-02-4-1
gettext@0.22.3			    meson@1.2.2		  sqlite@3.43.2
glib@2.78.0			    mpfr@4.2.0		  tar@1.34
gmake@4.4.1			    munge@0.5.15	  texinfo@7.0.3
gmp@6.2.1			    ncurses@6.4		  trilinos@14.4.0
hwloc@2.9.1			    nghttp2@1.57.0	  util-linux-uuid@2.38.1
json-c@0.16			    ninja@1.11.1	  util-macros@1.19.3
kokkos@4.1.00			    numactl@2.0.14	  xz@5.4.1
krb5@1.20.1			    openblas@0.3.24	  zlib-ng@2.1.4
libbsd@0.11.7			    openmpi@4.1.6	  zstd@1.5.5
==> 75 installed packages

We can see that trilinos won’t be uninstalled because it is still referenced in another environment managed by spack. If we want to remove it from the roots list we need to use spack remove:

$ spack remove trilinos
==> trilinos has been removed from /home/spack/spack/var/spack/environments/myproject2/spack.yaml
$ spack find
==> In environment myproject2
==> Root specs
scr

==> Installed packages
-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
autoconf@2.69			    libedit@3.1-20210216  openssh@9.5p1
autoconf-archive@2023.02.20	    libevent@2.1.12	  openssl@3.1.3
automake@1.16.5			    libffi@3.4.4	  pcre2@10.42
berkeley-db@18.1.40		    libgcrypt@1.10.2	  pdsh@2.31
bison@3.8.2			    libgpg-error@1.47	  perl@5.38.0
bzip2@1.0.8			    libiconv@1.17	  pigz@2.7
ca-certificates-mozilla@2023-05-30  libmd@1.0.4		  pkgconf@1.9.5
cmake@3.27.7			    libpciaccess@0.17	  pmix@5.0.1
curl@8.4.0			    libsigsegv@2.14	  py-pip@23.1.2
diffutils@3.9			    libtool@2.4.7	  py-setuptools@68.0.0
dtcmp@1.1.4			    libxcrypt@4.4.35	  py-wheel@0.41.2
elfutils@0.189			    libxml2@2.10.3	  python@3.11.6
expat@2.5.0			    libyogrt@1.33	  re2c@2.2
findutils@4.9.0			    lwgrp@1.0.5		  readline@8.2
gawk@5.2.2			    lz4@1.9.4		  scr@2.0.0
gdbm@1.23			    m4@1.4.19		  slurm@23-02-4-1
gettext@0.22.3			    meson@1.2.2		  sqlite@3.43.2
glib@2.78.0			    mpfr@4.2.0		  tar@1.34
gmake@4.4.1			    munge@0.5.15	  texinfo@7.0.3
gmp@6.2.1			    ncurses@6.4		  trilinos@14.4.0
hwloc@2.9.1			    nghttp2@1.57.0	  util-linux-uuid@2.38.1
json-c@0.16			    ninja@1.11.1	  util-macros@1.19.3
kokkos@4.1.00			    numactl@2.0.14	  xz@5.4.1
krb5@1.20.1			    openblas@0.3.24	  zlib-ng@2.1.4
libbsd@0.11.7			    openmpi@4.1.6	  zstd@1.5.5
==> 75 installed packages

Now, it is no longer a root and will need to be re-added before being installed as part of this environment.

We know trilinos is still needed for the myproject environment, so let’s switch back to confirm that it is still installed in that environment.

$ spack env activate myproject
$ spack find
==> In environment myproject
==> Root specs
tcl   trilinos

==> Installed packages
-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
autoconf@2.69			    krb5@1.20.1		  openssh@9.5p1
automake@1.16.5			    libedit@3.1-20210216  openssl@3.1.3
berkeley-db@18.1.40		    libevent@2.1.12	  perl@5.38.0
bison@3.8.2			    libiconv@1.17	  pigz@2.7
bzip2@1.0.8			    libpciaccess@0.17	  pkgconf@1.9.5
ca-certificates-mozilla@2023-05-30  libsigsegv@2.14	  pmix@5.0.1
cmake@3.27.7			    libtool@2.4.7	  readline@8.2
curl@8.4.0			    libxcrypt@4.4.35	  tar@1.34
diffutils@3.9			    libxml2@2.10.3	  tcl@8.6.12
findutils@4.9.0			    m4@1.4.19		  trilinos@14.4.0
gdbm@1.23			    ncurses@6.4		  util-macros@1.19.3
gettext@0.22.3			    nghttp2@1.57.0	  xz@5.4.1
gmake@4.4.1			    numactl@2.0.14	  zlib-ng@2.1.4
hwloc@2.9.1			    openblas@0.3.24	  zstd@1.5.5
kokkos@4.1.00			    openmpi@4.1.6
==> 44 installed packages

Phew! We see that myproject still has trilinos as a root spec. Spack uses reference counting to ensure that we don’t remove trilinos when it is still needed by myproject.

Note

Trilinos would only have been uninstalled by Spack if it were no longer needed by any environments or their package dependencies.

You can also uninstall a package and remove it from the environment in one go with spack uninstall --remove trilinos.

The spack.yaml file

An environment is more than just a list of root specs. It includes configuration settings that affect the way Spack behaves when the environment is activated. So far, myproject relies on configuration defaults that can be overridden. Here we’ll look at how to add specs and ensure all the packages depending on mpi build with mpich. We can customize the selection of the mpi provider using concretization preferences to change the behavior of the concretizer.

Let’s start by looking at the configuration of our environment using spack config get:

$ spack config get
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs:
  - tcl
  - trilinos
  view: true
  concretizer:
    unify: true

The output shows the special spack.yaml configuration file that Spack uses to store the environment configuration.

There are several important parts of this file:

  • specs:: the list of specs to install

  • view:: this controls whether the environment has a view. You can set it to false to disable view generation.

  • concretizer:unify:: This controls how the specs in the environment are concretized.

The specs list should look familiar; these are the specs we’ve been modifying with spack add.

concretizer:unify:true, the default, means that they are concretized together, so that there is only one version of each package in the environment. Other options for unify are false and when_possible. false means that the specs are concretized independently, so that there may be multiple versions of the same package in the environment. when_possible lies between those options. In this case, Spack will unify as many packages in the environment, but will not fail if it cannot unify all of them.

Editing environment configuration

Note

Before proceeding, make sure your EDITOR environment variable is set to the path of your preferred text editor.

Let’s edit spack.yaml to require mpich as our mpi provider using spack config edit.

You should now have the above file open in your editor. Change it to include the packages:mpi:require entry below:

# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  packages:
    mpi:
      require: [mpich]

  # add package specs to the `specs` list
  specs: [tcl, trilinos]

Note

We introduce this here to show you how environment configuration can affect concretization. Configuration options are covered in much more detail in the configuration tutorial.

We’ve only scratched the surface here by requiring a specific mpi provider for packages depending on mpi. There are many other customizations you can make to an environment. Refer to the links at the end of this section for more information.

Re-concretizing the environment

You may need to re-install packages in the environment after making significant changes to the configuration, such as changing virtual providers. This can be accomplished by forcing Spack to re-concretize the environment and re-install the specs.

For example, the packages installed in our myproject environment are now out of sync with our new configuration since we already installed part of the environment with openmpi. Suppose we want to install everything in myproject with mpich.

Let’s run spack concretize --force (or -f in short) to make Spack re-concretize all the environment’s specs:

$ spack concretize --force
==> Concretized trilinos
[+]  gnrf5ri  trilinos@14.4.0%gcc@11.4.0~adelus~adios2+amesos+amesos2+anasazi+aztec~basker+belos~boost~chaco~complex~cuda~cuda_rdc~debug~dtk+epetra+epetraext~epetraextbtf~epetraextexperimental~epetraextgraphreorderings~exodus+explicit_template_instantiation~float+fortran~gtest+hdf5~hypre+ifpack+ifpack2~intrepid~intrepid2~ipo~isorropia+kokkos~mesquite~minitensor+ml+mpi+muelu~mumps~nox~openmp~panzer~phalanx~piro~python~rocm~rocm_rdc~rol~rythmos+sacado~scorec~shards+shared~shylu~stk~stokhos~stratimikos~strumpack~suite-sparse~superlu~superlu-dist~teko~tempus~test~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=Release cxxstd=17 generator=make gotype=long_long arch=linux-ubuntu22.04-x86_64_v3
[+]  kd6xihn	  ^cmake@3.27.7%gcc@11.4.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  ijsmc3j	      ^curl@8.4.0%gcc@11.4.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu22.04-x86_64_v3
[+]  my64owh		  ^nghttp2@1.57.0%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr		  ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u		      ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	      ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	      ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	  ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  54ik6mv	  ^hdf5@1.14.3%gcc@11.4.0~cxx~fortran+hl~ipo~java~map+mpi+shared~szip~threadsafe+tools api=default build_system=cmake build_type=Release generator=make arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	      ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  dyrsjed	  ^hwloc@2.9.1%gcc@11.4.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  af4bqq6	      ^libpciaccess@0.17%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rgag55h		  ^libtool@2.4.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  b7j7735		  ^util-macros@1.19.3%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv	      ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4		  ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq		  ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  66qtu3e	  ^kokkos@4.1.00%gcc@11.4.0~aggressive_vectorization~compiler_warnings~cuda~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~examples~hpx~hpx_async_dispatch~hwloc~ipo~memkind~numactl~openmp~openmptarget~pic~rocm+serial+shared~sycl~tests~threads~tuning~wrapper build_system=cmake build_type=Release cxxstd=17 generator=make intel_gpu_arch=none arch=linux-ubuntu22.04-x86_64_v3
[+]  l3z27rr	  ^mpich@4.1.2%gcc@11.4.0~argobots~cuda+fortran+hwloc+hydra+libxml2+pci~rocm+romio~slurm~vci~verbs+wrapperrpath build_system=autotools datatype-engine=auto device=ch4 netmod=ofi pmi=pmi arch=linux-ubuntu22.04-x86_64_v3
[+]  cws3eft	      ^findutils@4.9.0%gcc@11.4.0 build_system=autotools patches=440b954 arch=linux-ubuntu22.04-x86_64_v3
[+]  voxng34	      ^libfabric@1.19.0%gcc@11.4.0~debug~kdreg build_system=autotools fabrics=sockets,tcp,udp arch=linux-ubuntu22.04-x86_64_v3
[+]  qrx4ymp	      ^yaksa@0.3%gcc@11.4.0~cuda~rocm build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mnfnoa5		  ^autoconf@2.69%gcc@11.4.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  d3cncgl		  ^automake@1.16.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  jnv5nut		  ^m4@1.4.19%gcc@11.4.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3		      ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zuopqri		      ^libsigsegv@2.14%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ybsi7tl		  ^python@3.11.6%gcc@11.4.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=13fa8bf,b0615b2,ebdca64,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  demnlle		      ^expat@2.5.0%gcc@11.4.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  nrlj4tj			  ^libbsd@0.11.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  kg5ets2			      ^libmd@1.0.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo		      ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo			  ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo			      ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm			      ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  ra2t3ha		      ^libffi@3.4.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g		      ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj		      ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  m2h5dly		      ^sqlite@3.43.2%gcc@11.4.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  thv4zdp		      ^util-linux-uuid@2.38.1%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ksqcyto	  ^openblas@0.3.24%gcc@11.4.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	      ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq		  ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf		  ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw		  ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> Concretized tcl
[+]  tt2hv6r  tcl@8.6.12%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	  ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	  ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> Updating view at /home/spack/spack/var/spack/environments/myproject/.spack-env/view

All the specs are now concrete and ready to be installed with mpich as the MPI implementation.

Re-concretization is sometimes also necessary when creating an environment incrementally with unification enabled. Spack makes sure that already concretized specs in the environment are not modified when adding something new.

Adding and installing specs one by one leads to greedy concretization. When you first install python in an environment, Spack will pick a recent version for it. If you then add py-numpy, it may be in conflict with the python version already installed, and fail to concretize:

$ spack env activate --temp
==> Created and activated temporary environment in /tmp/spack-5jfch4zy
$ spack install --add python
==> Concretized python
[+]  ybsi7tl  python@3.11.6%gcc@11.4.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=13fa8bf,b0615b2,ebdca64,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf	  ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3	      ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  demnlle	  ^expat@2.5.0%gcc@11.4.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	      ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  nrlj4tj	      ^libbsd@0.11.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  kg5ets2		  ^libmd@1.0.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw	  ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo	  ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4	      ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv	      ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo	      ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo		  ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm		  ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  ra2t3ha	  ^libffi@3.4.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g	  ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	      ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq		  ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	  ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr	  ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u	      ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	  ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj	  ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  m2h5dly	  ^sqlite@3.43.2%gcc@11.4.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  thv4zdp	  ^util-linux-uuid@2.38.1%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq	  ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	  ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> All of the packages are already installed
==> Updating view at /tmp/spack-2945ezcs/.spack-env/view
$ spack install --add py-numpy@1.20 2>&1 | tail -n1
    internal_error("version weights must exist and be unique"). Couldn't concretize without changing the existing environment. If you are ok with changing it, try `spack concretize --force`. You could consider setting `concretizer:unify` to `when_possible` or `false` to allow multiple versions of some packages.

The solution is to re-concretize the environment as a whole, which causes python to downgrade to a version compatible with py-numpy:

$ spack add py-numpy@1.20
==> Adding py-numpy@1.20 to environment /tmp/spack-2945ezcs
$ spack concretize -f
==> Concretized python
 -   n6luvwp  python@3.9.12%gcc@11.4.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=0d98e93,4c24573,ebdca64,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf	  ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3	      ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  demnlle	  ^expat@2.5.0%gcc@11.4.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	      ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  nrlj4tj	      ^libbsd@0.11.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  kg5ets2		  ^libmd@1.0.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw	  ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo	  ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4	      ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv	      ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo	      ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo		  ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm		  ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  ra2t3ha	  ^libffi@3.4.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g	  ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	      ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq		  ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	  ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr	  ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u	      ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	  ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj	  ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  m2h5dly	  ^sqlite@3.43.2%gcc@11.4.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  thv4zdp	  ^util-linux-uuid@2.38.1%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq	  ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	  ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> Concretized py-numpy@1.20
 -   kkgor46  py-numpy@1.20.3%gcc@11.4.0 build_system=python_pip patches=802970a,873745d arch=linux-ubuntu22.04-x86_64_v3
[+]  ksqcyto	  ^openblas@0.3.24%gcc@11.4.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	      ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	      ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq		  ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
 -   657n53b	  ^py-cython@0.29.36%gcc@11.4.0 build_system=python_pip patches=c4369ad arch=linux-ubuntu22.04-x86_64_v3
 -   awbjikh	  ^py-pip@23.1.2%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   hb7yuu6	  ^py-setuptools@59.4.0%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   2eivnyi	  ^py-wheel@0.41.2%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   n6luvwp	  ^python@3.9.12%gcc@11.4.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tkinter+uuid+zlib build_system=generic patches=0d98e93,4c24573,ebdca64,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf	      ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3		  ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  demnlle	      ^expat@2.5.0%gcc@11.4.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  nrlj4tj		  ^libbsd@0.11.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  kg5ets2		      ^libmd@1.0.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw	      ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo	      ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4		  ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv		  ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo		  ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo		      ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm		      ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  ra2t3ha	      ^libffi@3.4.4%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g	      ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	      ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr	      ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u		  ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	      ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj	      ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  m2h5dly	      ^sqlite@3.43.2%gcc@11.4.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  thv4zdp	      ^util-linux-uuid@2.38.1%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq	      ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	      ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> Updating view at /tmp/spack-2945ezcs/.spack-env/view

Building in environments

Activated environments allow you to invoke any programs installed in them as if they were installed on the system. In this section we will take advantage of that feature.

Suppose you want to compile some MPI programs. We have an MPI implementation installed in our myproject2 environment, so mpicc is available in our path. We can confirm this using which:

$ spack env activate myproject2
$ spack env status
==> In environment myproject2
$ which mpicc
/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/bin/mpicc

As mentioned before, activating the environment sets a number of environment variables. That includes variables like PATH, MANPATH, and CMAKE_PREFIX_PATH, which allows you to easily find package executables and libraries installed in the environment.

Let’s look specifically at path-related environment variables using env | grep PATH:

$ env | grep PATH=
LD_LIBRARY_PATH=.
PKG_CONFIG_PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/lib64/pkgconfig:/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/lib/pkgconfig:/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/share/pkgconfig:.
ACLOCAL_PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/share/aclocal:.
PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/bin:/home/spack/spack/bin:/opt/spack/view/bin:/root/spack/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MANPATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/share/man:/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/man:.:
CMAKE_PREFIX_PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view:.

We can demonstrate use of these environment settings by building a really simple MPI program.

Let’s create a program called mpi-hello.c that contains the following code:

#include <stdio.h>
#include <mpi.h>
#include <zlib.h>

int main(int argc, char **argv) {
  int rank;
  MPI_Init(&argc, &argv);

  MPI_Comm_rank(MPI_COMM_WORLD, &rank);
  printf("Hello world from rank %d\n", rank);

  if (rank == 0) {
    printf("zlib version: %s\n", ZLIB_VERSION);
  }

  MPI_Finalize();
}

This program includes headers from mpi and zlib. It also prints out a message from each MPI rank and the version of zlib.

Let’s build and run our program:

$ mpicc ./mpi-hello.c -I$(spack location -i zlib-ng)/include
$ mpirun -n 2 ./a.out
Hello world from rank 0
zlib version: 1.3.0.zlib-ng
Hello world from rank 1

Notice that we only needed to pass the include path to the compiler. We also see that Hello world is output for each of the ranks and the version of zlib used to build the program is printed.

We can confirm the version of zlib used to build the program is in our environment using spack find:

$ spack find zlib-ng
==> In environment myproject2
==> Root specs
scr

==> Installed packages
-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
zlib-ng@2.1.4
==> 1 installed package

Note that the reported version does match that of our installation.

Reproducing builds

Spack environments provide users with virtual environments similar to Python venv and Conda environments). The goal is to ensure packages in one environment are kept separate from those of another. These environments can be managed by Spack or independent. In either case, their environment files can be used to reproduce builds by other users and on other machines. Since those files are key to reproducing builds, let’s start with them.

Environment files

There are two key files tracking the contents of environments: spack.yaml and spack.lock. The spack.yaml file holds the environment configuration that we previously edited through spack config edit. The spack.lock file is automatically generated during concretization.

The two files represent two fundamental concepts:

  • spack.yaml: abstract specs and configuration to install; and

  • spack.lock: all fully concrete specs.

These files are intended to be used by developers and administrators to manage the environments in a reproducible way. We will cover their re-use later.

Note

Both environment files can be versioned in repositories, shared, and used to install the same set of software by different users and on other machines.

Managed versus independent environments

Environments are either Spack-managed or independent. Both types of environments are defined by their environment files. So far we have only created managed environments. This section describes their differences.

Managed environments are created using spack env create <name>. They are automatically created in the var/spack/environments subdirectory and can be referenced by their names.

Independent environments can be created in one of two ways. First, the Spack environment file(s) can be placed in any directory (other than var/spack/environments). Alternatively, you can use spack env create -d <directory> to specify the directory (<directory>) in which the files should reside. Independent environments are not named.

Reviewing a managed environment

We created the myproject environment earlier using spack env create myproject so let’s mainly focus on its environment files in this section.

Earlier, when we changed the environment’s configuration using spack config edit, we were actually editing its spack.yaml file. We can move to the directory containing the file using spack cd:

$ spack cd -e myproject
$ pwd
/home/spack/spack/var/spack/environments/myproject
$ ls
spack.lock  spack.yaml

Notice that myproject is a subdirectory of var/spack/environments within the Spack installation making it a managed environment. Consequently, it can be referenced by name. It will also show up when running spack env list:

$ spack env list
==> 2 environments
    myproject  myproject2

which indicates the active environment by highlighting it in green.

We can also see from the listing above that the current environment directory contains both of the environment files: spack.yaml and spack.lock. This is because spack.lock was generated when we concretized the environment.

If we cat the spack.yaml file, we’ll see the same specs and view options previously shown by spack config get:

$ cat spack.yaml
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs:
  - tcl
  - trilinos
  view: true
  concretizer:
    unify: true
  packages:
    mpi:
      require: [mpich]

Creating an independent environment

Environments do not have to be created in or managed by a Spack instance. Rather, their environment files can be placed in any directory. This feature can be quite helpful for use cases such as environment-based software releases and CI/CD.

Let’s create an independent environment from scratch for a simple project:

$ cd
$ mkdir code
$ cd code
$ spack env create -d .
==> Created environment in /home/spack/code
==> You can activate this environment with:
==>   spack env activate /home/spack/code

Notice that the command shows Spack created the environment, updated the view, and printed the command needed to activate it. As we can see in the activation command, since the environment is independent, it must be referenced by its directory path.

Let’s see what really happened with this command by listing the directory contents and looking at the configuration file:

$ ls
spack.yaml
$ cat spack.yaml
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs: []
  view: true
  concretizer:
    unify: true

Notice that Spack created a spack.yaml file in the code directory. Also note that the configuration file has an empty spec list (i.e., []). That list is intended to contain only the root specs of the environment.

We can confirm that it is not a managed environment by running spack env list:

$ spack env list
==> 2 environments
    myproject  myproject2

and noting that the path does not appear in the output.

Now let’s add some specs to the environment. Suppose your project depends on trilinos and openmpi. Add these packages to the spec list using your favorite text editor. The dash syntax for a YAML list is used in our example. Your package should now contain the following entries:

# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs:
  - trilinos
  - openmpi
  view: true
  concretizer:
    unify: true

Now activate the environment and install the packages:

$ spack env activate .
$ spack install
==> Concretized trilinos
[+]  46nzgyj  trilinos@14.4.0%gcc@11.4.0~adelus~adios2+amesos+amesos2+anasazi+aztec~basker+belos~boost~chaco~complex~cuda~cuda_rdc~debug~dtk+epetra+epetraext~epetraextbtf~epetraextexperimental~epetraextgraphreorderings~exodus+explicit_template_instantiation~float+fortran~gtest~hdf5~hypre+ifpack+ifpack2~intrepid~intrepid2~ipo~isorropia+kokkos~mesquite~minitensor+ml+mpi+muelu~mumps~nox~openmp~panzer~phalanx~piro~python~rocm~rocm_rdc~rol~rythmos+sacado~scorec~shards+shared~shylu~stk~stokhos~stratimikos~strumpack~suite-sparse~superlu~superlu-dist~teko~tempus~test~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=Release cxxstd=17 generator=make gotype=long_long arch=linux-ubuntu22.04-x86_64_v3
[+]  kd6xihn	  ^cmake@3.27.7%gcc@11.4.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  ijsmc3j	      ^curl@8.4.0%gcc@11.4.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu22.04-x86_64_v3
[+]  my64owh		  ^nghttp2@1.57.0%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr		  ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u		      ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	      ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	      ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	  ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  dyrsjed	  ^hwloc@2.9.1%gcc@11.4.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  af4bqq6	      ^libpciaccess@0.17%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rgag55h		  ^libtool@2.4.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  b7j7735		  ^util-macros@1.19.3%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv	      ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4		  ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq		  ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	      ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  66qtu3e	  ^kokkos@4.1.00%gcc@11.4.0~aggressive_vectorization~compiler_warnings~cuda~debug~debug_bounds_check~debug_dualview_modify_check~deprecated_code~examples~hpx~hpx_async_dispatch~hwloc~ipo~memkind~numactl~openmp~openmptarget~pic~rocm+serial+shared~sycl~tests~threads~tuning~wrapper build_system=cmake build_type=Release cxxstd=17 generator=make intel_gpu_arch=none arch=linux-ubuntu22.04-x86_64_v3
[+]  ksqcyto	  ^openblas@0.3.24%gcc@11.4.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	      ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq		  ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf		  ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3		      ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw		  ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj		      ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  z4iqm7n	  ^openmpi@4.1.6%gcc@11.4.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~internal-pmix~java~legacylaunchers~lustre~memchecker~openshmem~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  mbwdizy	      ^numactl@2.0.14%gcc@11.4.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  mnfnoa5		  ^autoconf@2.69%gcc@11.4.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  d3cncgl		  ^automake@1.16.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  jnv5nut		  ^m4@1.4.19%gcc@11.4.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  zuopqri		      ^libsigsegv@2.14%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zjwxy3z	      ^openssh@9.5p1%gcc@11.4.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tjiqlym		  ^krb5@1.20.1%gcc@11.4.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lza42n2		      ^bison@3.8.2%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  cws3eft		      ^findutils@4.9.0%gcc@11.4.0 build_system=autotools patches=440b954 arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo		      ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo			  ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo			      ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm			      ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  s4kq4wo		  ^libedit@3.1-20210216%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g		  ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  fhkyvm3	      ^pmix@5.0.1%gcc@11.4.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  wpvxxka		  ^libevent@2.1.12%gcc@11.4.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> Concretized openmpi
[+]  z4iqm7n  openmpi@4.1.6%gcc@11.4.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~internal-pmix~java~legacylaunchers~lustre~memchecker~openshmem~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  znvoani	  ^gmake@4.4.1%gcc@11.4.0~guile build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  dyrsjed	  ^hwloc@2.9.1%gcc@11.4.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  af4bqq6	      ^libpciaccess@0.17%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  b7j7735		  ^util-macros@1.19.3%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  67qoxbv	      ^libxml2@2.10.3%gcc@11.4.0+pic~python+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ivn4eq4		  ^libiconv@1.17%gcc@11.4.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  axxqoeq		  ^xz@5.4.1%gcc@11.4.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  qqlh6as	      ^ncurses@6.4%gcc@11.4.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mbwdizy	  ^numactl@2.0.14%gcc@11.4.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  mnfnoa5	      ^autoconf@2.69%gcc@11.4.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  d3cncgl	      ^automake@1.16.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rgag55h	      ^libtool@2.4.7%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  jnv5nut	      ^m4@1.4.19%gcc@11.4.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  ueheij3		  ^diffutils@3.9%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zuopqri		  ^libsigsegv@2.14%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zjwxy3z	  ^openssh@9.5p1%gcc@11.4.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tjiqlym	      ^krb5@1.20.1%gcc@11.4.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lza42n2		  ^bison@3.8.2%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  cws3eft		  ^findutils@4.9.0%gcc@11.4.0 build_system=autotools patches=440b954 arch=linux-ubuntu22.04-x86_64_v3
[+]  y26lmlo		  ^gettext@0.22.3%gcc@11.4.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  vdb3ozo		      ^tar@1.34%gcc@11.4.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  catlxmo			  ^pigz@2.7%gcc@11.4.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  jkznmrm			  ^zstd@1.5.5%gcc@11.4.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  s4kq4wo	      ^libedit@3.1-20210216%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  hezcx7g	      ^libxcrypt@4.4.35%gcc@11.4.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-ubuntu22.04-x86_64_v3
[+]  35j7wvr	      ^openssl@3.1.3%gcc@11.4.0~docs+shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  ct4al4u		  ^ca-certificates-mozilla@2023-05-30%gcc@11.4.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  dg34i2a	  ^perl@5.38.0%gcc@11.4.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ku7makq	      ^berkeley-db@18.1.40%gcc@11.4.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  4oz3kpf	      ^bzip2@1.0.8%gcc@11.4.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  m626hzw	      ^gdbm@1.23%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  xxgqlmj		  ^readline@8.2%gcc@11.4.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  zjgtpdo	  ^pkgconf@1.9.5%gcc@11.4.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  fhkyvm3	  ^pmix@5.0.1%gcc@11.4.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  wpvxxka	      ^libevent@2.1.12%gcc@11.4.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  5xcetrv	  ^zlib-ng@2.1.4%gcc@11.4.0+compat+opt build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> All of the packages are already installed
==> Updating view at /home/spack/code/.spack-env/view

Notice that Spack concretized the specs before installing them and their dependencies. It also updated the environment’s view. Since we already installed all these packages outside of the environment, their links were simply added to it.

Updating an installed environment

Spack supports tweaking an environment even after the initial specs are installed. You are free to add and remove specs just as you would outside of the environment using the command line interface as before.

For example, let’s add hdf5 and look at our file:

$ spack add hdf5@5.5.1
==> Adding hdf5@5.5.1 to environment /home/spack/code
$ cat spack.yaml
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs:
  - trilinos
  - openmpi
  - hdf5@5.5.1
  view: true
  concretizer:
    unify: true

Notice that spack add added the package to our active environment and it appears in the configuration file’s spec list.

Note

You’ll need to run spack install to install added packages in your environment because spack add only adds it to the configuration.

Now use spack remove to remove the spec from the configuration:

$ spack remove hdf5
==> hdf5 has been removed from /home/spack/code/spack.yaml
$ cat spack.yaml
# This is a Spack Environment file.
#
# It describes a set of packages to be installed, along with
# configuration settings.
spack:
  # add package specs to the `specs` list
  specs:
  - trilinos
  - openmpi
  view: true
  concretizer:
    unify: true

and we see that the spec was removed from the spec list of our environment.

Note

You can also edit the spack.yaml file directly instead of using the spack add and spack remove commands.

Reviewing spack.lock

Now let’s turn our attention from the abstract to the concrete.

Our focus so far has been on the abstract environment configuration represented by the spack.yaml file. Once that file is concretized, Spack generates a corresponding spack.lock file representing the full concretized state of the environment.

This file is intended to be a machine-readable representation of the information needed to reproduce the build of an environment. As such, it is written in json, which is less readable than yaml.

Let’s look at the top 30 lines of our current environment:

$ jq < spack.lock | head -30
{
  "_meta": {
    "file-type": "spack-lockfile",
    "lockfile-version": 5,
    "specfile-version": 4
  },
  "spack": {
    "version": "0.21.0",
    "type": "git",
    "commit": "65d3221a9c436e77af9e802e543c71bd702ff4e2"
  },
  "roots": [
    {
      "hash": "46nzgyjf7brdinl7hi5iyyinm6au54mz",
      "spec": "trilinos"
    },
    {
      "hash": "z4iqm7nipxsdam3chio7r74ob3cznoof",
      "spec": "openmpi"
    }
  ],
  "concrete_specs": {
    "46nzgyjf7brdinl7hi5iyyinm6au54mz": {
      "name": "trilinos",
      "version": "14.4.0",
      "arch": {
	"platform": "linux",
	"platform_os": "ubuntu22.04",
	"target": "x86_64_v3"
      },

While it is still readable, it consists of over 1900 lines of information representing the actual configurations for each of the environment’s packages.

Reproducing an environment

Now that we’ve described the contents of the environment files we can discuss how they can be used to reproduce environments. You may want to do this yourself on a different machine, or use an environment built by someone else. The process is the same in either case.

You can recreate an environment by passing either of the environment files to spack env create. The file you choose depends on whether you want to approximate the build using the abstract specs or an exact build based on the concrete specs.

Using spack.yaml

An approximate build is created using the spack.yaml file. This approach is relevant when we want to build the same specs on a new platform, for example. It allows you to reproduce the environment by preserving the abstract requirements in the file. However, the software may actually build differently in part because the concretizer may choose different dependencies.

Let’s use spack env create to create an abstract environment from the file that we’ll call abstract:

$ spack env create abstract spack.yaml
==> Created environment 'abstract' in /home/spack/spack/var/spack/environments/abstract
==> You can activate this environment with:
==>   spack env activate abstract

Here we see that Spack created a managed environment with the name we provided.

And, since it is a newly created environment, it does not have any installed specs yet as we can see from calling spack find after activating the environment:

$ spack env activate abstract
$ spack find
==> In environment abstract
==> Root specs
openmpi	  trilinos

==> 0 installed packages

Notice that we have the same root specs as were listed in the spack.yaml file.

Using spack.lock

The spack.lock file is used for an exact reproduction of the original build. It can replicate the build because it contains the information for all the decisions made during concretization.

Now let’s create a concrete environment, called concrete, from the file:

$ spack env create concrete spack.lock
==> Created environment 'concrete' in /home/spack/spack/var/spack/environments/concrete
==> You can activate this environment with:
==>   spack env activate concrete
==> Updating view at /home/spack/spack/var/spack/environments/concrete/.spack-env/view

Here we see that Spack again created a managed environment with the provided name.

Since we created the environment from our spack.lock file, not only do we get the same root specs, all of the packages are installed in the environment as we can see from calling spack find after activating the environment:

$ spack env activate concrete
$ spack find
==> In environment concrete
==> Root specs
openmpi	  trilinos

==> Installed packages
-- linux-ubuntu22.04-x86_64_v3 / gcc@11.4.0 ---------------------
autoconf@2.69			    krb5@1.20.1		  openssh@9.5p1
automake@1.16.5			    libedit@3.1-20210216  openssl@3.1.3
berkeley-db@18.1.40		    libevent@2.1.12	  perl@5.38.0
bison@3.8.2			    libiconv@1.17	  pigz@2.7
bzip2@1.0.8			    libpciaccess@0.17	  pkgconf@1.9.5
ca-certificates-mozilla@2023-05-30  libsigsegv@2.14	  pmix@5.0.1
cmake@3.27.7			    libtool@2.4.7	  readline@8.2
curl@8.4.0			    libxcrypt@4.4.35	  tar@1.34
diffutils@3.9			    libxml2@2.10.3	  trilinos@14.4.0
findutils@4.9.0			    m4@1.4.19		  util-macros@1.19.3
gdbm@1.23			    ncurses@6.4		  xz@5.4.1
gettext@0.22.3			    nghttp2@1.57.0	  zlib-ng@2.1.4
gmake@4.4.1			    numactl@2.0.14	  zstd@1.5.5
hwloc@2.9.1			    openblas@0.3.24
kokkos@4.1.00			    openmpi@4.1.6
==> 43 installed packages

Note

Use of spack.lock to reproduce a build (currently) requires you to be on the same type of machine.

More information

This tutorial only scratches the surface of environments and what they can do. For more information, take a look at the Spack resources below.

Setting up and building environments

Using environments

Finding examples of environments