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:isc23

and then set Spack up like this:

git clone --depth=100 --branch=releases/v0.20 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 -------------------
zlib@1.2.13

-- linux-ubuntu22.04-x86_64_v3 / gcc@11.3.0 ---------------------
autoconf@2.69			    cmake@3.26.3     gmake@4.4.1    libbsd@0.11.7	  libmd@1.0.4	     m4@1.4.19	      openssh@9.3p1   python@3.10.10  trilinos@13.0.1	      zlib@1.2.13
automake@1.16.5 		    diffutils@3.9    hdf5@1.14.1-2  libedit@3.1-20210216  libpciaccess@0.17  mpich@4.1.1      openssl@1.1.1t  readline@8.2    util-linux-uuid@2.38.1  zstd@1.5.5
berkeley-db@18.1.40		    expat@2.5.0      hdf5@1.14.1-2  libevent@2.1.12	  libsigsegv@2.14    ncurses@6.4      perl@5.36.0     sqlite@3.40.1   util-macros@1.19.3
bison@3.8.2			    findutils@4.9.0  hdf5@1.14.1-2  libfabric@1.18.0	  libtool@2.4.7      numactl@2.0.14   pigz@2.7	      tar@1.34	      xz@5.4.1
bzip2@1.0.8			    gdbm@1.23	     hwloc@2.9.1    libffi@3.4.4	  libxcrypt@4.4.33   openblas@0.3.23  pkgconf@1.9.5   tcl@8.6.12      yaksa@0.2
ca-certificates-mozilla@2023-01-10  gettext@0.21.1   krb5@1.20.1    libiconv@1.17	  libxml2@2.10.3     openmpi@4.1.5    pmix@4.2.3      tcl@8.6.12      zlib@1.2.8
==> 57 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. 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 -------------------
zlib@1.2.13

-- linux-ubuntu22.04-x86_64_v3 / gcc@11.3.0 ---------------------
autoconf@2.69			    cmake@3.26.3     gmake@4.4.1    libbsd@0.11.7	  libmd@1.0.4	     m4@1.4.19	      openssh@9.3p1   python@3.10.10  trilinos@13.0.1	      zlib@1.2.13
automake@1.16.5 		    diffutils@3.9    hdf5@1.14.1-2  libedit@3.1-20210216  libpciaccess@0.17  mpich@4.1.1      openssl@1.1.1t  readline@8.2    util-linux-uuid@2.38.1  zstd@1.5.5
berkeley-db@18.1.40		    expat@2.5.0      hdf5@1.14.1-2  libevent@2.1.12	  libsigsegv@2.14    ncurses@6.4      perl@5.36.0     sqlite@3.40.1   util-macros@1.19.3
bison@3.8.2			    findutils@4.9.0  hdf5@1.14.1-2  libfabric@1.18.0	  libtool@2.4.7      numactl@2.0.14   pigz@2.7	      tar@1.34	      xz@5.4.1
bzip2@1.0.8			    gdbm@1.23	     hwloc@2.9.1    libffi@3.4.4	  libxcrypt@4.4.33   openblas@0.3.23  pkgconf@1.9.5   tcl@8.6.12      yaksa@0.2
ca-certificates-mozilla@2023-01-10  gettext@0.21.1   krb5@1.20.1    libiconv@1.17	  libxml2@2.10.3     openmpi@4.1.5    pmix@4.2.3      tcl@8.6.12      zlib@1.2.8
==> 57 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
 -   vcj3xxs  trilinos@13.0.1%gcc@11.3.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~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=Release cxxstd=14 generator=make gotype=long_long arch=linux-ubuntu22.04-x86_64_v3
[+]  ofsadgm	  ^cmake@3.26.3%gcc@11.3.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	      ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	      ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4		  ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  guaj3kb	  ^gmake@4.4.1%gcc@11.3.0~guile build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  h7l4t7l	  ^hwloc@2.9.1%gcc@11.3.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
[+]  ajkyiz5	      ^libpciaccess@0.17%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  qkvj7am		  ^libtool@2.4.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmmxgx4		  ^util-macros@1.19.3%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki	      ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce		  ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a		  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  mh73nkp	      ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  eaq3ss4	  ^openblas@0.3.23%gcc@11.3.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	      ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz		  ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg		  ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic		      ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3		  ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff		      ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  6rh6mid	  ^openmpi@4.1.5%gcc@11.3.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  dwr5rmx	      ^numactl@2.0.14%gcc@11.3.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  t4nuen3		  ^autoconf@2.69%gcc@11.3.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  oa3w4kf		  ^automake@1.16.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  llbjfk2		  ^m4@1.4.19%gcc@11.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  okig24f		      ^libsigsegv@2.14%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zhdviyj	      ^openssh@9.3p1%gcc@11.3.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  a2oph6k		  ^krb5@1.20.1%gcc@11.3.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  iavvoed		      ^bison@3.8.2%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx		      ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a			  ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo			      ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo			      ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  3gz2afa		  ^libedit@3.1-20210216%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7		  ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  uh4fmi5	      ^pmix@4.2.3%gcc@11.3.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmjxzds		  ^libevent@2.1.12%gcc@11.3.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	      ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3

==> Concretized tcl
[+]  6afnoet  tcl@8.6.12%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	  ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3

[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/ncurses-6.4-4dokmxjlgawyprrnkewx3aiwppdbwbts
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/zlib-1.2.13-mntflxrgekkm5lbpbl5r66lh2ieted4y
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gmake-4.4.1-guaj3kbmbrdgqupr5u3zd42ga3kong7l
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libpciaccess-0.17-ajkyiz5txltunmwxkrwz3xs6ymqaafnf
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libiconv-1.17-7wr75cescbtfyjppbbvswfpurs3gtxyf
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/xz-5.4.1-4kpkw5anjs35mccxgsw24ooonnpk7pkx
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/openblas-0.3.23-eaq3ss4yhjrjr2adhblf3r7qlowfs46r
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/numactl-2.0.14-dwr5rmxxc4lav5ob4ylar5tu3rugjwkv
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/bzip2-1.0.8-dca2qygvz7nc6q6ci2ikw7ltc2v4pryo
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/zstd-1.5.5-qoo4rlopj4vqbc6k633cu3tzawtfjjvh
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libxcrypt-4.4.33-6oeb4y7sqnhpsqtr33bvbdsl2ekblcwz
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libedit-3.1-20210216-3gz2afaph66ogjiulkaek2mksnpxhtwu
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pigz-2.7-aln73eomrjghrlg6q2ida2rr4ylvg2cp
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/openssl-1.1.1t-w2by2b2vepifq7xzrf527sjpw5mjluyu
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libxml2-2.10.3-pcbenkircucqrjzgyud6xzgxfptjz6x6
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/tar-1.34-e77cf6ahyuvzxeaojxrc5meo7cbwfbxo
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/cmake-3.26.3-ofsadgmnqqs6fuj3wyl6bnk7obprvonx
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libevent-2.1.12-pmjxzdssnbkv25jedy5shyhzsnj26ins
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/hwloc-2.9.1-h7l4t7laxg7kqchvcy42xtyev4kxjbti
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gettext-0.21.1-p4obvgx4436lyrtjhu3xvosfkyjpgi7o
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pmix-4.2.3-uh4fmi5i7bajcqtiuae7qaii7yha7lnp
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/krb5-1.20.1-a2oph6kjqh6feyfmkozogvu7ghzx2dfo
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/openssh-9.3p1-zhdviyjva24bkvbxlqnswcecrp5gjvv5
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/openmpi-4.1.5-6rh6midoapu7noq62iqyhph3zdcr4pzl
==> Installing trilinos-13.0.1-vcj3xxsgn44r35f6pmd7q66u5livfg6f
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-trilinos-13.0.1-vcj3xxsgn44r35f6pmd7q66u5livfg6f.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/trilinos-13.0.1/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-trilinos-13.0.1-vcj3xxsgn44r35f6pmd7q66u5livfg6f.spack
==> Extracting trilinos-13.0.1-vcj3xxsgn44r35f6pmd7q66u5livfg6f from binary cache
==> trilinos: Successfully installed trilinos-13.0.1-vcj3xxsgn44r35f6pmd7q66u5livfg6f
  Search: 0.00s.  Fetch: 0.54s.  Install: 1.83s.  Total: 2.37s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/trilinos-13.0.1-vcj3xxsgn44r35f6pmd7q66u5livfg6f
==> 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.3.0 ---------------------
autoconf@2.69	     bzip2@1.0.8			 gdbm@1.23	 krb5@1.20.1	       libpciaccess@0.17  libxml2@2.10.3  openblas@0.3.23  perl@5.36.0	  readline@8.2	   util-macros@1.19.3
automake@1.16.5      ca-certificates-mozilla@2023-01-10  gettext@0.21.1  libedit@3.1-20210216  libsigsegv@2.14	  m4@1.4.19	  openmpi@4.1.5    pigz@2.7	  tar@1.34	   xz@5.4.1
berkeley-db@18.1.40  cmake@3.26.3			 gmake@4.4.1	 libevent@2.1.12       libtool@2.4.7	  ncurses@6.4	  openssh@9.3p1    pkgconf@1.9.5  tcl@8.6.12	   zlib@1.2.13
bison@3.8.2	     diffutils@3.9			 hwloc@2.9.1	 libiconv@1.17	       libxcrypt@4.4.33   numactl@2.0.14  openssl@1.1.1t   pmix@4.2.3	  trilinos@13.0.1  zstd@1.5.5
==> 40 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
 -   nmr6gj7  scr@2.0.0%gcc@11.3.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
[+]  ofsadgm	  ^cmake@3.26.3%gcc@11.3.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	      ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	      ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4		  ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   ozmcx3f	  ^dtcmp@1.1.4%gcc@11.3.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   bqzp3nr	      ^lwgrp@1.0.5%gcc@11.3.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  guaj3kb	  ^gmake@4.4.1%gcc@11.3.0~guile build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   apmbmtm	  ^libyogrt@1.33%gcc@11.3.0~static build_system=autotools scheduler=slurm arch=linux-ubuntu22.04-x86_64_v3
 -   7eoxkum	      ^slurm@23-02-1-1%gcc@11.3.0~gtk~hdf5~hwloc~mariadb~pmix+readline~restd build_system=autotools sysconfdir=PREFIX/etc arch=linux-ubuntu22.04-x86_64_v3
 -   4cec7ab		  ^curl@8.0.1%gcc@11.3.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2~nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu22.04-x86_64_v3
 -   biylwnz		  ^glib@2.76.1%gcc@11.3.0~libmount build_system=generic patches=fa31180 tracing=none arch=linux-ubuntu22.04-x86_64_v3
 -   drq53yd		      ^elfutils@0.189%gcc@11.3.0~debuginfod+nls build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo			  ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx		      ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a			  ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo			      ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  t7yjn4d		      ^libffi@3.4.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce		      ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
 -   2gwxhkc		      ^meson@1.1.0%gcc@11.3.0 build_system=python_pip patches=0f0b1bd arch=linux-ubuntu22.04-x86_64_v3
 -   diwpepn			  ^py-pip@23.0%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   2wmu4ow			  ^py-setuptools@67.6.0%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   az4gd3r			  ^py-wheel@0.37.1%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   pr5vcse		      ^ninja@1.11.1%gcc@11.3.0+re2c build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   nntqchv			  ^re2c@2.2%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   ddple3k		      ^pcre2@10.42%gcc@11.3.0~jit+multibyte build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  wd4batz		      ^python@3.10.10%gcc@11.3.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,7d40923,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  ctxzisf			  ^expat@2.5.0%gcc@11.3.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rr7ondv			      ^libbsd@0.11.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ksnahtg				  ^libmd@1.0.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ismbqj3			  ^sqlite@3.40.1%gcc@11.3.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lyay7bs			  ^util-linux-uuid@2.38.1%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   i3zj5z5		  ^json-c@0.16%gcc@11.3.0~ipo build_system=cmake build_type=Release generator=make arch=linux-ubuntu22.04-x86_64_v3
 -   44utbap		  ^lz4@1.9.4%gcc@11.3.0 build_system=makefile libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
 -   4blixi3		  ^munge@0.5.15%gcc@11.3.0 build_system=autotools localstatedir=PREFIX/var arch=linux-ubuntu22.04-x86_64_v3
 -   6hrkhfo		      ^libgcrypt@1.10.2%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   5cg5zz6			  ^libgpg-error@1.47%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   6lk2khk			      ^gawk@5.2.1%gcc@11.3.0~nls build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   7kxi3rr				  ^gmp@6.2.1%gcc@11.3.0+cxx build_system=autotools libs=shared,static patches=69ad2e2 arch=linux-ubuntu22.04-x86_64_v3
 -   aiys7vc				  ^mpfr@4.2.0%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
 -   5wwl7c6				      ^autoconf-archive@2023.02.20%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   tcpqkls				      ^texinfo@7.0.3%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff		  ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  6rh6mid	  ^openmpi@4.1.5%gcc@11.3.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  h7l4t7l	      ^hwloc@2.9.1%gcc@11.3.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
[+]  ajkyiz5		  ^libpciaccess@0.17%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmmxgx4		      ^util-macros@1.19.3%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki		  ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a		      ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  dwr5rmx	      ^numactl@2.0.14%gcc@11.3.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  t4nuen3		  ^autoconf@2.69%gcc@11.3.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  oa3w4kf		  ^automake@1.16.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  qkvj7am		  ^libtool@2.4.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  llbjfk2		  ^m4@1.4.19%gcc@11.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic		      ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  okig24f		      ^libsigsegv@2.14%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zhdviyj	      ^openssh@9.3p1%gcc@11.3.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  a2oph6k		  ^krb5@1.20.1%gcc@11.3.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  iavvoed		      ^bison@3.8.2%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  3gz2afa		  ^libedit@3.1-20210216%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7		  ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	      ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz		  ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg		  ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3		  ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mh73nkp	      ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  uh4fmi5	      ^pmix@4.2.3%gcc@11.3.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmjxzds		  ^libevent@2.1.12%gcc@11.3.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
 -   ujblfrg	  ^pdsh@2.31%gcc@11.3.0+ssh+static_modules build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	  ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3

==> Concretized trilinos
[+]  vcj3xxs  trilinos@13.0.1%gcc@11.3.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~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=Release cxxstd=14 generator=make gotype=long_long arch=linux-ubuntu22.04-x86_64_v3
[+]  ofsadgm	  ^cmake@3.26.3%gcc@11.3.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	      ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	      ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4		  ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  guaj3kb	  ^gmake@4.4.1%gcc@11.3.0~guile build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  h7l4t7l	  ^hwloc@2.9.1%gcc@11.3.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
[+]  ajkyiz5	      ^libpciaccess@0.17%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  qkvj7am		  ^libtool@2.4.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmmxgx4		  ^util-macros@1.19.3%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki	      ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce		  ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a		  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  mh73nkp	      ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  eaq3ss4	  ^openblas@0.3.23%gcc@11.3.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	      ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz		  ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg		  ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic		      ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3		  ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff		      ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  6rh6mid	  ^openmpi@4.1.5%gcc@11.3.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  dwr5rmx	      ^numactl@2.0.14%gcc@11.3.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  t4nuen3		  ^autoconf@2.69%gcc@11.3.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  oa3w4kf		  ^automake@1.16.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  llbjfk2		  ^m4@1.4.19%gcc@11.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  okig24f		      ^libsigsegv@2.14%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zhdviyj	      ^openssh@9.3p1%gcc@11.3.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  a2oph6k		  ^krb5@1.20.1%gcc@11.3.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  iavvoed		      ^bison@3.8.2%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx		      ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a			  ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo			      ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo			      ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  3gz2afa		  ^libedit@3.1-20210216%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7		  ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  uh4fmi5	      ^pmix@4.2.3%gcc@11.3.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmjxzds		  ^libevent@2.1.12%gcc@11.3.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	      ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3

[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/ncurses-6.4-4dokmxjlgawyprrnkewx3aiwppdbwbts
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/zlib-1.2.13-mntflxrgekkm5lbpbl5r66lh2ieted4y
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libpciaccess-0.17-ajkyiz5txltunmwxkrwz3xs6ymqaafnf
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libiconv-1.17-7wr75cescbtfyjppbbvswfpurs3gtxyf
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/xz-5.4.1-4kpkw5anjs35mccxgsw24ooonnpk7pkx
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/numactl-2.0.14-dwr5rmxxc4lav5ob4ylar5tu3rugjwkv
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/bzip2-1.0.8-dca2qygvz7nc6q6ci2ikw7ltc2v4pryo
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/zstd-1.5.5-qoo4rlopj4vqbc6k633cu3tzawtfjjvh
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libxcrypt-4.4.33-6oeb4y7sqnhpsqtr33bvbdsl2ekblcwz
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gmake-4.4.1-guaj3kbmbrdgqupr5u3zd42ga3kong7l
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pkgconf-1.9.5-mh73nkpzo36xqeaagdrh3qppvmn6zdn6
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libsigsegv-2.14-okig24f4hxju4we3kmbfzfwu3egktfhh
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libffi-3.4.4-t7yjn4d3p5uzsaofqiee5ltsppqyrfkd
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libmd-1.0.4-ksnahtgqoi6mxfk4obbcbo3zxigejzad
==> Installing re2c-2.2-nntqchvizwrlghtuoiig2lipofs7knex
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-re2c-2.2-nntqchvizwrlghtuoiig2lipofs7knex.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/re2c-2.2/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-re2c-2.2-nntqchvizwrlghtuoiig2lipofs7knex.spack
==> Extracting re2c-2.2-nntqchvizwrlghtuoiig2lipofs7knex from binary cache
==> re2c: Successfully installed re2c-2.2-nntqchvizwrlghtuoiig2lipofs7knex
  Search: 0.00s.  Fetch: 0.30s.  Install: 0.27s.  Total: 0.57s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/re2c-2.2-nntqchvizwrlghtuoiig2lipofs7knex
==> Installing pcre2-10.42-ddple3kwuks2s5immfvx2gtob7jhxvyc
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-pcre2-10.42-ddple3kwuks2s5immfvx2gtob7jhxvyc.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pcre2-10.42/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-pcre2-10.42-ddple3kwuks2s5immfvx2gtob7jhxvyc.spack
==> Extracting pcre2-10.42-ddple3kwuks2s5immfvx2gtob7jhxvyc from binary cache
==> pcre2: Successfully installed pcre2-10.42-ddple3kwuks2s5immfvx2gtob7jhxvyc
  Search: 0.00s.  Fetch: 0.04s.  Install: 0.11s.  Total: 0.15s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pcre2-10.42-ddple3kwuks2s5immfvx2gtob7jhxvyc
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/berkeley-db-18.1.40-7sohpazzvalaxarn3pxs4du7qrcde7vf
==> Installing lz4-1.9.4-44utbaplglf2rrkgrdwf4asogf5e2vtb
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-lz4-1.9.4-44utbaplglf2rrkgrdwf4asogf5e2vtb.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/lz4-1.9.4/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-lz4-1.9.4-44utbaplglf2rrkgrdwf4asogf5e2vtb.spack
==> Extracting lz4-1.9.4-44utbaplglf2rrkgrdwf4asogf5e2vtb from binary cache
==> lz4: Successfully installed lz4-1.9.4-44utbaplglf2rrkgrdwf4asogf5e2vtb
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.04s.  Total: 0.05s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/lz4-1.9.4-44utbaplglf2rrkgrdwf4asogf5e2vtb
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libtool-2.4.7-qkvj7amqg5545llggv4k4jkgslrncfdu
==> Installing autoconf-archive-2023.02.20-5wwl7c6vegyg3sxhaocr3ptbv7mz7kvq
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-autoconf-archive-2023.02.20-5wwl7c6vegyg3sxhaocr3ptbv7mz7kvq.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/autoconf-archive-2023.02.20/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-autoconf-archive-2023.02.20-5wwl7c6vegyg3sxhaocr3ptbv7mz7kvq.spack
==> Extracting autoconf-archive-2023.02.20-5wwl7c6vegyg3sxhaocr3ptbv7mz7kvq from binary cache
==> autoconf-archive: Successfully installed autoconf-archive-2023.02.20-5wwl7c6vegyg3sxhaocr3ptbv7mz7kvq
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.14s.  Total: 0.15s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/autoconf-archive-2023.02.20-5wwl7c6vegyg3sxhaocr3ptbv7mz7kvq
==> Installing pdsh-2.31-ujblfrglbhbykq54qybsin3avgypifmz
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-pdsh-2.31-ujblfrglbhbykq54qybsin3avgypifmz.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pdsh-2.31/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-pdsh-2.31-ujblfrglbhbykq54qybsin3avgypifmz.spack
==> Extracting pdsh-2.31-ujblfrglbhbykq54qybsin3avgypifmz from binary cache
==> pdsh: Successfully installed pdsh-2.31-ujblfrglbhbykq54qybsin3avgypifmz
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.03s.  Total: 0.05s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pdsh-2.31-ujblfrglbhbykq54qybsin3avgypifmz
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/readline-8.2-tddm2ffpgbcwobqdzn57di2n7oeqxryv
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pigz-2.7-aln73eomrjghrlg6q2ida2rr4ylvg2cp
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/openssl-1.1.1t-w2by2b2vepifq7xzrf527sjpw5mjluyu
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/util-linux-uuid-2.38.1-lyay7bsm6wfyevxpj65l3fi3u7pkuuey
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libedit-3.1-20210216-3gz2afaph66ogjiulkaek2mksnpxhtwu
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libxml2-2.10.3-pcbenkircucqrjzgyud6xzgxfptjz6x6
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/m4-1.4.19-llbjfk2fqzzlgbnubr345ym5mg2nrcfu
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libbsd-0.11.7-rr7ondvgxygut6gn2askjyleklwvkr7g
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/sqlite-3.40.1-ismbqj3jqkptdvbhcleb352y55pozdn4
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gdbm-1.23-ba4juc3qtagyyn5vkmuxzentr6qrtzmr
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/tar-1.34-e77cf6ahyuvzxeaojxrc5meo7cbwfbxo
==> Installing curl-8.0.1-4cec7ab4dxhtyznes72yvafcidzq2bpe
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-curl-8.0.1-4cec7ab4dxhtyznes72yvafcidzq2bpe.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/curl-8.0.1/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-curl-8.0.1-4cec7ab4dxhtyznes72yvafcidzq2bpe.spack
==> Extracting curl-8.0.1-4cec7ab4dxhtyznes72yvafcidzq2bpe from binary cache
==> curl: Successfully installed curl-8.0.1-4cec7ab4dxhtyznes72yvafcidzq2bpe
  Search: 0.00s.  Fetch: 0.02s.  Install: 0.14s.  Total: 0.16s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/curl-8.0.1-4cec7ab4dxhtyznes72yvafcidzq2bpe
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/cmake-3.26.3-ofsadgmnqqs6fuj3wyl6bnk7obprvonx
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libevent-2.1.12-pmjxzdssnbkv25jedy5shyhzsnj26ins
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/hwloc-2.9.1-h7l4t7laxg7kqchvcy42xtyev4kxjbti
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/expat-2.5.0-ctxzisf3p7lxvki2jbrqs4kd7w5ixjrl
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/perl-5.36.0-j5tavdsri7znb4h7q57mu67bnx54p2fb
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gettext-0.21.1-p4obvgx4436lyrtjhu3xvosfkyjpgi7o
==> Installing json-c-0.16-i3zj5z5uocqlmpxmzpvq7cefktec5gb2
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-json-c-0.16-i3zj5z5uocqlmpxmzpvq7cefktec5gb2.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/json-c-0.16/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-json-c-0.16-i3zj5z5uocqlmpxmzpvq7cefktec5gb2.spack
==> Extracting json-c-0.16-i3zj5z5uocqlmpxmzpvq7cefktec5gb2 from binary cache
==> json-c: Successfully installed json-c-0.16-i3zj5z5uocqlmpxmzpvq7cefktec5gb2
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.04s.  Total: 0.05s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/json-c-0.16-i3zj5z5uocqlmpxmzpvq7cefktec5gb2
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/pmix-4.2.3-uh4fmi5i7bajcqtiuae7qaii7yha7lnp
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/autoconf-2.69-t4nuen3izojzz42zd4numq2dbswdl7uq
==> Installing elfutils-0.189-drq53ydwufjbingfsh57s2rpuxldkrgs
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-elfutils-0.189-drq53ydwufjbingfsh57s2rpuxldkrgs.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/elfutils-0.189/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-elfutils-0.189-drq53ydwufjbingfsh57s2rpuxldkrgs.spack
==> Extracting elfutils-0.189-drq53ydwufjbingfsh57s2rpuxldkrgs from binary cache
==> elfutils: Successfully installed elfutils-0.189-drq53ydwufjbingfsh57s2rpuxldkrgs
  Search: 0.00s.  Fetch: 0.15s.  Install: 0.31s.  Total: 0.46s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/elfutils-0.189-drq53ydwufjbingfsh57s2rpuxldkrgs
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/krb5-1.20.1-a2oph6kjqh6feyfmkozogvu7ghzx2dfo
==> Installing texinfo-7.0.3-tcpqklsvbozob5vqvf4nkc3z7rood77q
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-texinfo-7.0.3-tcpqklsvbozob5vqvf4nkc3z7rood77q.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/texinfo-7.0.3/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-texinfo-7.0.3-tcpqklsvbozob5vqvf4nkc3z7rood77q.spack
==> Extracting texinfo-7.0.3-tcpqklsvbozob5vqvf4nkc3z7rood77q from binary cache
==> texinfo: Successfully installed texinfo-7.0.3-tcpqklsvbozob5vqvf4nkc3z7rood77q
  Search: 0.00s.  Fetch: 0.02s.  Install: 0.25s.  Total: 0.27s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/texinfo-7.0.3-tcpqklsvbozob5vqvf4nkc3z7rood77q
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/python-3.10.10-wd4batzcpqxg3ydksn6nstqdqshvq3sv
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/automake-1.16.5-oa3w4kfggbgkzhefkp3dtnd4oxk3gni7
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/openssh-9.3p1-zhdviyjva24bkvbxlqnswcecrp5gjvv5
==> Installing ninja-1.11.1-pr5vcsej7s6a6ojvkb32idw6atnmigle
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-ninja-1.11.1-pr5vcsej7s6a6ojvkb32idw6atnmigle.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/ninja-1.11.1/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-ninja-1.11.1-pr5vcsej7s6a6ojvkb32idw6atnmigle.spack
==> Extracting ninja-1.11.1-pr5vcsej7s6a6ojvkb32idw6atnmigle from binary cache
==> ninja: Successfully installed ninja-1.11.1-pr5vcsej7s6a6ojvkb32idw6atnmigle
  Search: 0.00s.  Fetch: 0.04s.  Install: 0.11s.  Total: 0.15s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/ninja-1.11.1-pr5vcsej7s6a6ojvkb32idw6atnmigle
==> Installing py-pip-23.0-diwpepn3cohpgytb5potg426er54diuw
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-py-pip-23.0-diwpepn3cohpgytb5potg426er54diuw.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/py-pip-23.0/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-py-pip-23.0-diwpepn3cohpgytb5potg426er54diuw.spack
==> Extracting py-pip-23.0-diwpepn3cohpgytb5potg426er54diuw from binary cache
==> py-pip: Successfully installed py-pip-23.0-diwpepn3cohpgytb5potg426er54diuw
  Search: 0.00s.  Fetch: 0.05s.  Install: 0.34s.  Total: 0.39s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/py-pip-23.0-diwpepn3cohpgytb5potg426er54diuw
==> Installing gmp-6.2.1-7kxi3rr3qduvmao43tjigamo2eqdme4q
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-gmp-6.2.1-7kxi3rr3qduvmao43tjigamo2eqdme4q.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gmp-6.2.1/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-gmp-6.2.1-7kxi3rr3qduvmao43tjigamo2eqdme4q.spack
==> Extracting gmp-6.2.1-7kxi3rr3qduvmao43tjigamo2eqdme4q from binary cache
==> gmp: Successfully installed gmp-6.2.1-7kxi3rr3qduvmao43tjigamo2eqdme4q
  Search: 0.00s.  Fetch: 0.02s.  Install: 0.06s.  Total: 0.08s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gmp-6.2.1-7kxi3rr3qduvmao43tjigamo2eqdme4q
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/openmpi-4.1.5-6rh6midoapu7noq62iqyhph3zdcr4pzl
==> Installing py-setuptools-67.6.0-2wmu4ow6txsimph3pgi55wva7asxntug
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-py-setuptools-67.6.0-2wmu4ow6txsimph3pgi55wva7asxntug.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/py-setuptools-67.6.0/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-py-setuptools-67.6.0-2wmu4ow6txsimph3pgi55wva7asxntug.spack
==> Extracting py-setuptools-67.6.0-2wmu4ow6txsimph3pgi55wva7asxntug from binary cache
==> py-setuptools: Successfully installed py-setuptools-67.6.0-2wmu4ow6txsimph3pgi55wva7asxntug
  Search: 0.00s.  Fetch: 0.03s.  Install: 0.18s.  Total: 0.22s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/py-setuptools-67.6.0-2wmu4ow6txsimph3pgi55wva7asxntug
==> Installing py-wheel-0.37.1-az4gd3rkotr3ugsjmbujk5ez47mx5g4z
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-py-wheel-0.37.1-az4gd3rkotr3ugsjmbujk5ez47mx5g4z.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/py-wheel-0.37.1/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-py-wheel-0.37.1-az4gd3rkotr3ugsjmbujk5ez47mx5g4z.spack
==> Extracting py-wheel-0.37.1-az4gd3rkotr3ugsjmbujk5ez47mx5g4z from binary cache
==> py-wheel: Successfully installed py-wheel-0.37.1-az4gd3rkotr3ugsjmbujk5ez47mx5g4z
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.06s.  Total: 0.07s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/py-wheel-0.37.1-az4gd3rkotr3ugsjmbujk5ez47mx5g4z
==> Installing mpfr-4.2.0-aiys7vci7zwuci5phi5yje7ql3des4jw
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-mpfr-4.2.0-aiys7vci7zwuci5phi5yje7ql3des4jw.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/mpfr-4.2.0/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-mpfr-4.2.0-aiys7vci7zwuci5phi5yje7ql3des4jw.spack
==> Extracting mpfr-4.2.0-aiys7vci7zwuci5phi5yje7ql3des4jw from binary cache
==> mpfr: Successfully installed mpfr-4.2.0-aiys7vci7zwuci5phi5yje7ql3des4jw
  Search: 0.00s.  Fetch: 0.04s.  Install: 0.12s.  Total: 0.16s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/mpfr-4.2.0-aiys7vci7zwuci5phi5yje7ql3des4jw
==> Installing lwgrp-1.0.5-bqzp3nrmbrtlu3jhbrcaasb4hw7gayl6
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-lwgrp-1.0.5-bqzp3nrmbrtlu3jhbrcaasb4hw7gayl6.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/lwgrp-1.0.5/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-lwgrp-1.0.5-bqzp3nrmbrtlu3jhbrcaasb4hw7gayl6.spack
==> Extracting lwgrp-1.0.5-bqzp3nrmbrtlu3jhbrcaasb4hw7gayl6 from binary cache
==> lwgrp: Successfully installed lwgrp-1.0.5-bqzp3nrmbrtlu3jhbrcaasb4hw7gayl6
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.07s.  Total: 0.08s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/lwgrp-1.0.5-bqzp3nrmbrtlu3jhbrcaasb4hw7gayl6
==> Installing meson-1.1.0-2gwxhkcbexjwdvt27rjgdy73j6je7fkk
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-meson-1.1.0-2gwxhkcbexjwdvt27rjgdy73j6je7fkk.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/meson-1.1.0/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-meson-1.1.0-2gwxhkcbexjwdvt27rjgdy73j6je7fkk.spack
==> Extracting meson-1.1.0-2gwxhkcbexjwdvt27rjgdy73j6je7fkk from binary cache
==> meson: Successfully installed meson-1.1.0-2gwxhkcbexjwdvt27rjgdy73j6je7fkk
  Search: 0.00s.  Fetch: 0.04s.  Install: 0.19s.  Total: 0.22s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/meson-1.1.0-2gwxhkcbexjwdvt27rjgdy73j6je7fkk
==> Installing gawk-5.2.1-6lk2khkbulgzyi4dhcp454zctpwz332m
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-gawk-5.2.1-6lk2khkbulgzyi4dhcp454zctpwz332m.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gawk-5.2.1/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-gawk-5.2.1-6lk2khkbulgzyi4dhcp454zctpwz332m.spack
==> Extracting gawk-5.2.1-6lk2khkbulgzyi4dhcp454zctpwz332m from binary cache
==> gawk: Successfully installed gawk-5.2.1-6lk2khkbulgzyi4dhcp454zctpwz332m
  Search: 0.00s.  Fetch: 0.02s.  Install: 0.11s.  Total: 0.13s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/gawk-5.2.1-6lk2khkbulgzyi4dhcp454zctpwz332m
==> Installing dtcmp-1.1.4-ozmcx3fcxtqqialr5brolr5fvwbuuc4b
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-dtcmp-1.1.4-ozmcx3fcxtqqialr5brolr5fvwbuuc4b.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/dtcmp-1.1.4/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-dtcmp-1.1.4-ozmcx3fcxtqqialr5brolr5fvwbuuc4b.spack
==> Extracting dtcmp-1.1.4-ozmcx3fcxtqqialr5brolr5fvwbuuc4b from binary cache
==> dtcmp: Successfully installed dtcmp-1.1.4-ozmcx3fcxtqqialr5brolr5fvwbuuc4b
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.08s.  Total: 0.09s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/dtcmp-1.1.4-ozmcx3fcxtqqialr5brolr5fvwbuuc4b
==> Installing glib-2.76.1-biylwnz5lq6533ffue236twgqe4u2djx
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-glib-2.76.1-biylwnz5lq6533ffue236twgqe4u2djx.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/glib-2.76.1/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-glib-2.76.1-biylwnz5lq6533ffue236twgqe4u2djx.spack
==> Extracting glib-2.76.1-biylwnz5lq6533ffue236twgqe4u2djx from binary cache
==> glib: Successfully installed glib-2.76.1-biylwnz5lq6533ffue236twgqe4u2djx
  Search: 0.00s.  Fetch: 0.09s.  Install: 0.33s.  Total: 0.42s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/glib-2.76.1-biylwnz5lq6533ffue236twgqe4u2djx
==> Installing libgpg-error-1.47-5cg5zz6ivyudwmilucxq3s5guu5e5jyf
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-libgpg-error-1.47-5cg5zz6ivyudwmilucxq3s5guu5e5jyf.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libgpg-error-1.47/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-libgpg-error-1.47-5cg5zz6ivyudwmilucxq3s5guu5e5jyf.spack
==> Extracting libgpg-error-1.47-5cg5zz6ivyudwmilucxq3s5guu5e5jyf from binary cache
==> libgpg-error: Successfully installed libgpg-error-1.47-5cg5zz6ivyudwmilucxq3s5guu5e5jyf
  Search: 0.00s.  Fetch: 0.02s.  Install: 0.07s.  Total: 0.09s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libgpg-error-1.47-5cg5zz6ivyudwmilucxq3s5guu5e5jyf
==> Installing libgcrypt-1.10.2-6hrkhfo4tolc75h4rnmr5j5qp3wonr5o
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-libgcrypt-1.10.2-6hrkhfo4tolc75h4rnmr5j5qp3wonr5o.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libgcrypt-1.10.2/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-libgcrypt-1.10.2-6hrkhfo4tolc75h4rnmr5j5qp3wonr5o.spack
==> Extracting libgcrypt-1.10.2-6hrkhfo4tolc75h4rnmr5j5qp3wonr5o from binary cache
==> libgcrypt: Successfully installed libgcrypt-1.10.2-6hrkhfo4tolc75h4rnmr5j5qp3wonr5o
  Search: 0.00s.  Fetch: 0.03s.  Install: 0.09s.  Total: 0.12s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libgcrypt-1.10.2-6hrkhfo4tolc75h4rnmr5j5qp3wonr5o
==> Installing munge-0.5.15-4blixi3ewhybj7qlqltayqk566pnc53w
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-munge-0.5.15-4blixi3ewhybj7qlqltayqk566pnc53w.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/munge-0.5.15/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-munge-0.5.15-4blixi3ewhybj7qlqltayqk566pnc53w.spack
==> Extracting munge-0.5.15-4blixi3ewhybj7qlqltayqk566pnc53w from binary cache
==> munge: Successfully installed munge-0.5.15-4blixi3ewhybj7qlqltayqk566pnc53w
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.07s.  Total: 0.08s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/munge-0.5.15-4blixi3ewhybj7qlqltayqk566pnc53w
==> Installing slurm-23-02-1-1-7eoxkumqxv4jsrirvku65jgxduelddl5
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-slurm-23-02-1-1-7eoxkumqxv4jsrirvku65jgxduelddl5.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/slurm-23-02-1-1/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-slurm-23-02-1-1-7eoxkumqxv4jsrirvku65jgxduelddl5.spack
==> Extracting slurm-23-02-1-1-7eoxkumqxv4jsrirvku65jgxduelddl5 from binary cache
==> slurm: Successfully installed slurm-23-02-1-1-7eoxkumqxv4jsrirvku65jgxduelddl5
  Search: 0.00s.  Fetch: 0.94s.  Install: 4.68s.  Total: 5.62s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/slurm-23-02-1-1-7eoxkumqxv4jsrirvku65jgxduelddl5
==> Installing libyogrt-1.33-apmbmtmuovth3t6xdgjpgywlbvpdzk4e
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-libyogrt-1.33-apmbmtmuovth3t6xdgjpgywlbvpdzk4e.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libyogrt-1.33/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-libyogrt-1.33-apmbmtmuovth3t6xdgjpgywlbvpdzk4e.spack
==> Extracting libyogrt-1.33-apmbmtmuovth3t6xdgjpgywlbvpdzk4e from binary cache
==> libyogrt: Successfully installed libyogrt-1.33-apmbmtmuovth3t6xdgjpgywlbvpdzk4e
  Search: 0.00s.  Fetch: 0.01s.  Install: 0.10s.  Total: 0.11s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/libyogrt-1.33-apmbmtmuovth3t6xdgjpgywlbvpdzk4e
==> Installing scr-2.0.0-nmr6gj7ol4gjojpzwx3ogsfzzzds3bim
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-scr-2.0.0-nmr6gj7ol4gjojpzwx3ogsfzzzds3bim.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/scr-2.0.0/linux-ubuntu22.04-x86_64_v3-gcc-11.3.0-scr-2.0.0-nmr6gj7ol4gjojpzwx3ogsfzzzds3bim.spack
==> Extracting scr-2.0.0-nmr6gj7ol4gjojpzwx3ogsfzzzds3bim from binary cache
==> scr: Successfully installed scr-2.0.0-nmr6gj7ol4gjojpzwx3ogsfzzzds3bim
  Search: 0.00s.  Fetch: 0.02s.  Install: 0.33s.  Total: 0.35s
[+] /home/spack/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-11.3.0/scr-2.0.0-nmr6gj7ol4gjojpzwx3ogsfzzzds3bim
==> 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.3.0 ---------------------
autoconf@2.69			    curl@8.0.1	    glib@2.76.1 	  libevent@2.1.12    libtool@2.4.7     mpfr@4.2.0	openssl@1.1.1t	py-setuptools@67.6.0  tar@1.34
autoconf-archive@2023.02.20	    diffutils@3.9   gmake@4.4.1 	  libffi@3.4.4	     libxcrypt@4.4.33  munge@0.5.15	pcre2@10.42	py-wheel@0.37.1       texinfo@7.0.3
automake@1.16.5 		    dtcmp@1.1.4     gmp@6.2.1		  libgcrypt@1.10.2   libxml2@2.10.3    ncurses@6.4	pdsh@2.31	python@3.10.10	      trilinos@13.0.1
berkeley-db@18.1.40		    elfutils@0.189  hwloc@2.9.1 	  libgpg-error@1.47  libyogrt@1.33     ninja@1.11.1	perl@5.36.0	re2c@2.2	      util-linux-uuid@2.38.1
bison@3.8.2			    expat@2.5.0     json-c@0.16 	  libiconv@1.17      lwgrp@1.0.5       numactl@2.0.14	pigz@2.7	readline@8.2	      util-macros@1.19.3
bzip2@1.0.8			    gawk@5.2.1	    krb5@1.20.1 	  libmd@1.0.4	     lz4@1.9.4	       openblas@0.3.23	pkgconf@1.9.5	scr@2.0.0	      xz@5.4.1
ca-certificates-mozilla@2023-01-10  gdbm@1.23	    libbsd@0.11.7	  libpciaccess@0.17  m4@1.4.19	       openmpi@4.1.5	pmix@4.2.3	slurm@23-02-1-1       zlib@1.2.13
cmake@3.26.3			    gettext@0.21.1  libedit@3.1-20210216  libsigsegv@2.14    meson@1.1.0       openssh@9.3p1	py-pip@23.0	sqlite@3.40.1	      zstd@1.5.5
==> 72 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.3.0 ---------------------
    vcj3xxs trilinos@13.0.1

==> 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.3.0 ---------------------
autoconf@2.69			    curl@8.0.1	    glib@2.76.1 	  libevent@2.1.12    libtool@2.4.7     mpfr@4.2.0	openssl@1.1.1t	py-setuptools@67.6.0  tar@1.34
autoconf-archive@2023.02.20	    diffutils@3.9   gmake@4.4.1 	  libffi@3.4.4	     libxcrypt@4.4.33  munge@0.5.15	pcre2@10.42	py-wheel@0.37.1       texinfo@7.0.3
automake@1.16.5 		    dtcmp@1.1.4     gmp@6.2.1		  libgcrypt@1.10.2   libxml2@2.10.3    ncurses@6.4	pdsh@2.31	python@3.10.10	      trilinos@13.0.1
berkeley-db@18.1.40		    elfutils@0.189  hwloc@2.9.1 	  libgpg-error@1.47  libyogrt@1.33     ninja@1.11.1	perl@5.36.0	re2c@2.2	      util-linux-uuid@2.38.1
bison@3.8.2			    expat@2.5.0     json-c@0.16 	  libiconv@1.17      lwgrp@1.0.5       numactl@2.0.14	pigz@2.7	readline@8.2	      util-macros@1.19.3
bzip2@1.0.8			    gawk@5.2.1	    krb5@1.20.1 	  libmd@1.0.4	     lz4@1.9.4	       openblas@0.3.23	pkgconf@1.9.5	scr@2.0.0	      xz@5.4.1
ca-certificates-mozilla@2023-01-10  gdbm@1.23	    libbsd@0.11.7	  libpciaccess@0.17  m4@1.4.19	       openmpi@4.1.5	pmix@4.2.3	slurm@23-02-1-1       zlib@1.2.13
cmake@3.26.3			    gettext@0.21.1  libedit@3.1-20210216  libsigsegv@2.14    meson@1.1.0       openssh@9.3p1	py-pip@23.0	sqlite@3.40.1	      zstd@1.5.5
==> 72 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.3.0 ---------------------
autoconf@2.69			    curl@8.0.1	    glib@2.76.1 	  libevent@2.1.12    libtool@2.4.7     mpfr@4.2.0	openssl@1.1.1t	py-setuptools@67.6.0  tar@1.34
autoconf-archive@2023.02.20	    diffutils@3.9   gmake@4.4.1 	  libffi@3.4.4	     libxcrypt@4.4.33  munge@0.5.15	pcre2@10.42	py-wheel@0.37.1       texinfo@7.0.3
automake@1.16.5 		    dtcmp@1.1.4     gmp@6.2.1		  libgcrypt@1.10.2   libxml2@2.10.3    ncurses@6.4	pdsh@2.31	python@3.10.10	      trilinos@13.0.1
berkeley-db@18.1.40		    elfutils@0.189  hwloc@2.9.1 	  libgpg-error@1.47  libyogrt@1.33     ninja@1.11.1	perl@5.36.0	re2c@2.2	      util-linux-uuid@2.38.1
bison@3.8.2			    expat@2.5.0     json-c@0.16 	  libiconv@1.17      lwgrp@1.0.5       numactl@2.0.14	pigz@2.7	readline@8.2	      util-macros@1.19.3
bzip2@1.0.8			    gawk@5.2.1	    krb5@1.20.1 	  libmd@1.0.4	     lz4@1.9.4	       openblas@0.3.23	pkgconf@1.9.5	scr@2.0.0	      xz@5.4.1
ca-certificates-mozilla@2023-01-10  gdbm@1.23	    libbsd@0.11.7	  libpciaccess@0.17  m4@1.4.19	       openmpi@4.1.5	pmix@4.2.3	slurm@23-02-1-1       zlib@1.2.13
cmake@3.26.3			    gettext@0.21.1  libedit@3.1-20210216  libsigsegv@2.14    meson@1.1.0       openssh@9.3p1	py-pip@23.0	sqlite@3.40.1	      zstd@1.5.5
==> 72 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.3.0 ---------------------
autoconf@2.69	     bzip2@1.0.8			 gdbm@1.23	 krb5@1.20.1	       libpciaccess@0.17  libxml2@2.10.3  openblas@0.3.23  perl@5.36.0	  readline@8.2	   util-macros@1.19.3
automake@1.16.5      ca-certificates-mozilla@2023-01-10  gettext@0.21.1  libedit@3.1-20210216  libsigsegv@2.14	  m4@1.4.19	  openmpi@4.1.5    pigz@2.7	  tar@1.34	   xz@5.4.1
berkeley-db@18.1.40  cmake@3.26.3			 gmake@4.4.1	 libevent@2.1.12       libtool@2.4.7	  ncurses@6.4	  openssh@9.3p1    pkgconf@1.9.5  tcl@8.6.12	   zlib@1.2.13
bison@3.8.2	     diffutils@3.9			 hwloc@2.9.1	 libiconv@1.17	       libxcrypt@4.4.33   numactl@2.0.14  openssl@1.1.1t   pmix@4.2.3	  trilinos@13.0.1  zstd@1.5.5
==> 40 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
[+]  dgw2szm  trilinos@13.0.1%gcc@11.3.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~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=Release cxxstd=14 generator=make gotype=long_long arch=linux-ubuntu22.04-x86_64_v3
[+]  ofsadgm	  ^cmake@3.26.3%gcc@11.3.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	      ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	      ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4		  ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  guaj3kb	  ^gmake@4.4.1%gcc@11.3.0~guile build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  qr4bdox	  ^hdf5@1.14.1-2%gcc@11.3.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
[+]  mh73nkp	      ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	      ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  h7l4t7l	  ^hwloc@2.9.1%gcc@11.3.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
[+]  ajkyiz5	      ^libpciaccess@0.17%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  qkvj7am		  ^libtool@2.4.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmmxgx4		  ^util-macros@1.19.3%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki	      ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce		  ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a		  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  3mapxl5	  ^mpich@4.1.1%gcc@11.3.0~argobots~cuda+fortran+hwloc+hydra+libxml2+pci~rocm+romio~slurm~two_level_namespace~vci~verbs+wrapperrpath build_system=autotools datatype-engine=auto device=ch4 netmod=ofi pmi=pmi arch=linux-ubuntu22.04-x86_64_v3
[+]  ek3dt7p	      ^findutils@4.9.0%gcc@11.3.0 build_system=autotools patches=440b954 arch=linux-ubuntu22.04-x86_64_v3
[+]  exb2qlz	      ^libfabric@1.18.0%gcc@11.3.0~debug~kdreg build_system=autotools fabrics=sockets,tcp,udp arch=linux-ubuntu22.04-x86_64_v3
[+]  zcymzur	      ^yaksa@0.2%gcc@11.3.0~cuda~rocm build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  t4nuen3		  ^autoconf@2.69%gcc@11.3.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  oa3w4kf		  ^automake@1.16.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  llbjfk2		  ^m4@1.4.19%gcc@11.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic		      ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  okig24f		      ^libsigsegv@2.14%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  wd4batz		  ^python@3.10.10%gcc@11.3.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,7d40923,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  ctxzisf		      ^expat@2.5.0%gcc@11.3.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rr7ondv			  ^libbsd@0.11.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ksnahtg			      ^libmd@1.0.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx		      ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a			  ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo			      ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo			      ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  t7yjn4d		      ^libffi@3.4.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7		      ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff		      ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ismbqj3		      ^sqlite@3.40.1%gcc@11.3.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lyay7bs		      ^util-linux-uuid@2.38.1%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  eaq3ss4	  ^openblas@0.3.23%gcc@11.3.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	      ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz		  ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg		  ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3		  ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3

==> Concretized tcl
[+]  6afnoet  tcl@8.6.12%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	  ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile 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
$ spack install --add python
==> Concretized python
[+]  wd4batz  python@3.10.10%gcc@11.3.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,7d40923,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg	  ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic	      ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ctxzisf	  ^expat@2.5.0%gcc@11.3.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rr7ondv	      ^libbsd@0.11.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ksnahtg		  ^libmd@1.0.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3	  ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx	  ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce	      ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki	      ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a	      ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo		  ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo		  ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  t7yjn4d	  ^libffi@3.4.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7	  ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	      ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz		  ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	  ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	  ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4	      ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  mh73nkp	  ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff	  ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ismbqj3	  ^sqlite@3.40.1%gcc@11.3.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lyay7bs	  ^util-linux-uuid@2.38.1%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a	  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	  ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3

==> All of the packages are already installed
==> Updating view at /tmp/spack-vcyder7f/.spack-env/view
$ spack install --add py-numpy@1.20 2>&1 | tail -n1
. 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-vcyder7f
$ spack concretize -f
==> Concretized python
 -   veukjrw  python@3.9.8%gcc@11.3.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,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg	  ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic	      ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ctxzisf	  ^expat@2.5.0%gcc@11.3.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rr7ondv	      ^libbsd@0.11.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ksnahtg		  ^libmd@1.0.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3	  ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx	  ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce	      ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki	      ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a	      ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo		  ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo		  ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  t7yjn4d	  ^libffi@3.4.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7	  ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	      ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz		  ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	  ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	  ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4	      ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  mh73nkp	  ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff	  ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ismbqj3	  ^sqlite@3.40.1%gcc@11.3.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lyay7bs	  ^util-linux-uuid@2.38.1%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a	  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	  ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3

==> Concretized py-numpy@1.20
 -   ofv5kha  py-numpy@1.20.3%gcc@11.3.0+blas+lapack build_system=python_pip patches=802970a,873745d arch=linux-ubuntu22.04-x86_64_v3
[+]  eaq3ss4	  ^openblas@0.3.23%gcc@11.3.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	      ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz		  ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
 -   edgyet5	  ^py-cython@0.29.33%gcc@11.3.0 build_system=python_pip patches=71de066 arch=linux-ubuntu22.04-x86_64_v3
 -   c4ua5tu	  ^py-pip@23.0%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   woysmgw	  ^py-setuptools@59.4.0%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   dwc7cdk	  ^py-wheel@0.37.1%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
 -   veukjrw	  ^python@3.9.8%gcc@11.3.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,f2fd060 arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg	      ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic		  ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ctxzisf	      ^expat@2.5.0%gcc@11.3.0+libbsd build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  rr7ondv		  ^libbsd@0.11.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ksnahtg		      ^libmd@1.0.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3	      ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx	      ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce		  ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki		  ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a		  ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo		      ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo		      ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  t7yjn4d	      ^libffi@3.4.4%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7	      ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	      ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	      ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4		  ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  mh73nkp	      ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff	      ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  ismbqj3	      ^sqlite@3.40.1%gcc@11.3.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  lyay7bs	      ^util-linux-uuid@2.38.1%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a	      ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	      ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3

==> Updating view at /tmp/spack-vcyder7f/.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=
PKG_CONFIG_PATH=/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/lib/pkgconfig:/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/share/pkgconfig:/home/spack/spack/var/spack/environments/myproject2/.spack-env/view/lib64/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)/include
$ mpirun -n 4 ./a.out
Hello world from rank 3
Hello world from rank 1
Hello world from rank 2
Hello world from rank 0
zlib version: 1.2.13

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
==> In environment myproject2
==> Root specs
scr

==> Installed packages
-- linux-ubuntu22.04-x86_64_v3 / gcc@11.3.0 ---------------------
zlib@1.2.13
==> 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 openmpi
[+]  6rh6mid  openmpi@4.1.5%gcc@11.3.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  h7l4t7l	  ^hwloc@2.9.1%gcc@11.3.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
[+]  ajkyiz5	      ^libpciaccess@0.17%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmmxgx4		  ^util-macros@1.19.3%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki	      ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce		  ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a		  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	      ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  dwr5rmx	  ^numactl@2.0.14%gcc@11.3.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  t4nuen3	      ^autoconf@2.69%gcc@11.3.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  oa3w4kf	      ^automake@1.16.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  qkvj7am	      ^libtool@2.4.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  llbjfk2	      ^m4@1.4.19%gcc@11.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic		  ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  okig24f		  ^libsigsegv@2.14%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zhdviyj	  ^openssh@9.3p1%gcc@11.3.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  a2oph6k	      ^krb5@1.20.1%gcc@11.3.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  iavvoed		  ^bison@3.8.2%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx		  ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a		      ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo			  ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo			  ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  3gz2afa	      ^libedit@3.1-20210216%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7	      ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	      ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4		  ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	  ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz	      ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg	      ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3	      ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff		  ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  mh73nkp	  ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  uh4fmi5	  ^pmix@4.2.3%gcc@11.3.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmjxzds	      ^libevent@2.1.12%gcc@11.3.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	  ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu22.04-x86_64_v3

==> Concretized trilinos
[+]  vcj3xxs  trilinos@13.0.1%gcc@11.3.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~thyra+tpetra~trilinoscouplings~wrapper~x11~zoltan~zoltan2 build_system=cmake build_type=Release cxxstd=14 generator=make gotype=long_long arch=linux-ubuntu22.04-x86_64_v3
[+]  ofsadgm	  ^cmake@3.26.3%gcc@11.3.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu22.04-x86_64_v3
[+]  4dokmxj	      ^ncurses@6.4%gcc@11.3.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  w2by2b2	      ^openssl@1.1.1t%gcc@11.3.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu22.04-x86_64_v3
[+]  5pxkrf4		  ^ca-certificates-mozilla@2023-01-10%gcc@11.3.0 build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  guaj3kb	  ^gmake@4.4.1%gcc@11.3.0~guile build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  h7l4t7l	  ^hwloc@2.9.1%gcc@11.3.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
[+]  ajkyiz5	      ^libpciaccess@0.17%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  qkvj7am		  ^libtool@2.4.7%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmmxgx4		  ^util-macros@1.19.3%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pcbenki	      ^libxml2@2.10.3%gcc@11.3.0~python build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  7wr75ce		  ^libiconv@1.17%gcc@11.3.0 build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  4kpkw5a		  ^xz@5.4.1%gcc@11.3.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  mh73nkp	      ^pkgconf@1.9.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  eaq3ss4	  ^openblas@0.3.23%gcc@11.3.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile symbol_suffix=none threads=none arch=linux-ubuntu22.04-x86_64_v3
[+]  j5tavds	      ^perl@5.36.0%gcc@11.3.0+cpanm+open+shared+threads build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  7sohpaz		  ^berkeley-db@18.1.40%gcc@11.3.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu22.04-x86_64_v3
[+]  dca2qyg		  ^bzip2@1.0.8%gcc@11.3.0~debug~pic+shared build_system=generic arch=linux-ubuntu22.04-x86_64_v3
[+]  zdl3dic		      ^diffutils@3.9%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  ba4juc3		  ^gdbm@1.23%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  tddm2ff		      ^readline@8.2%gcc@11.3.0 build_system=autotools patches=bbf97f1 arch=linux-ubuntu22.04-x86_64_v3
[+]  6rh6mid	  ^openmpi@4.1.5%gcc@11.3.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker~orterunprefix+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu22.04-x86_64_v3
[+]  dwr5rmx	      ^numactl@2.0.14%gcc@11.3.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu22.04-x86_64_v3
[+]  t4nuen3		  ^autoconf@2.69%gcc@11.3.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu22.04-x86_64_v3
[+]  oa3w4kf		  ^automake@1.16.5%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  llbjfk2		  ^m4@1.4.19%gcc@11.3.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu22.04-x86_64_v3
[+]  okig24f		      ^libsigsegv@2.14%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  zhdviyj	      ^openssh@9.3p1%gcc@11.3.0+gssapi build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  a2oph6k		  ^krb5@1.20.1%gcc@11.3.0+shared build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  iavvoed		      ^bison@3.8.2%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  p4obvgx		      ^gettext@0.21.1%gcc@11.3.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  e77cf6a			  ^tar@1.34%gcc@11.3.0 build_system=autotools zip=pigz arch=linux-ubuntu22.04-x86_64_v3
[+]  aln73eo			      ^pigz@2.7%gcc@11.3.0 build_system=makefile arch=linux-ubuntu22.04-x86_64_v3
[+]  qoo4rlo			      ^zstd@1.5.5%gcc@11.3.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu22.04-x86_64_v3
[+]  3gz2afa		  ^libedit@3.1-20210216%gcc@11.3.0 build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  6oeb4y7		  ^libxcrypt@4.4.33%gcc@11.3.0~obsolete_api build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  uh4fmi5	      ^pmix@4.2.3%gcc@11.3.0~docs+pmi_backwards_compatibility~python~restful build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  pmjxzds		  ^libevent@2.1.12%gcc@11.3.0+openssl build_system=autotools arch=linux-ubuntu22.04-x86_64_v3
[+]  mntflxr	      ^zlib@1.2.13%gcc@11.3.0+optimize+pic+shared build_system=makefile 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:

$ head -30 spack.lock
{
  "_meta": {
    "file-type": "spack-lockfile",
    "lockfile-version": 4,
    "specfile-version": 3
  },
  "spack": {
    "version": "0.20.0",
    "type": "git",
    "commit": "e493ab31c6f81a9e415a4b0e0e2263374c61e758"
  },
  "roots": [
    {
      "hash": "6rh6midoapu7noq62iqyhph3zdcr4pzl",
      "spec": "openmpi"
    },
    {
      "hash": "vcj3xxsgn44r35f6pmd7q66u5livfg6f",
      "spec": "trilinos"
    }
  ],
  "concrete_specs": {
    "6rh6midoapu7noq62iqyhph3zdcr4pzl": {
      "name": "openmpi",
      "version": "4.1.5",
      "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.3.0 ---------------------
autoconf@2.69	     bzip2@1.0.8			 gdbm@1.23	 krb5@1.20.1	       libpciaccess@0.17  libxml2@2.10.3  openblas@0.3.23  perl@5.36.0	  readline@8.2	      xz@5.4.1
automake@1.16.5      ca-certificates-mozilla@2023-01-10  gettext@0.21.1  libedit@3.1-20210216  libsigsegv@2.14	  m4@1.4.19	  openmpi@4.1.5    pigz@2.7	  tar@1.34	      zlib@1.2.13
berkeley-db@18.1.40  cmake@3.26.3			 gmake@4.4.1	 libevent@2.1.12       libtool@2.4.7	  ncurses@6.4	  openssh@9.3p1    pkgconf@1.9.5  trilinos@13.0.1     zstd@1.5.5
bison@3.8.2	     diffutils@3.9			 hwloc@2.9.1	 libiconv@1.17	       libxcrypt@4.4.33   numactl@2.0.14  openssl@1.1.1t   pmix@4.2.3	  util-macros@1.19.3
==> 39 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