Tutorial setup

If you have not done the prior sections, you’ll need to set Spack up like this:

git clone https://github.com/spack/spack
. spack/share/spack/setup-env.sh
spack tutorial

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 spackpm.herokuapp.com

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-ubuntu18.04-x86_64 / clang@7.0.0 -----------------------
zlib@1.2.13

-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69			    cmake@3.24.3     gdbm@1.23	     hwloc@2.8.0	   libffi@3.4.2       libxml2@2.10.1  numactl@2.0.14   pigz@2.7        tar@1.34 	       util-macros@1.19.3
automake@1.16.5 		    diffutils@3.8    gettext@0.21.1  krb5@1.19.3	   libiconv@1.16      m4@1.4.19       openblas@0.3.21  pkgconf@1.8.0   tcl@8.6.12	       xz@5.2.7
berkeley-db@18.1.40		    expat@2.4.8      gmp@6.2.1	     libbsd@0.11.5	   libmd@1.0.4	      mpc@1.1.0       openmpi@4.1.4    pmix@4.1.2      tcl@8.6.12	       yaksa@0.2
bison@3.8.2			    findutils@4.9.0  hdf5@1.12.2     libedit@3.1-20210216  libpciaccess@0.16  mpfr@3.1.6      openssh@9.1p1    python@3.10.8   texinfo@6.5	       zlib@1.2.8
bzip2@1.0.8			    gawk@5.1.1	     hdf5@1.12.2     libevent@2.1.12	   libsigsegv@2.13    mpich@4.0.2     openssl@1.1.1s   readline@8.1.2  trilinos@13.0.1	       zlib@1.2.13
ca-certificates-mozilla@2022-10-11  gcc@8.4.0	     hdf5@1.12.2     libfabric@1.16.1	   libtool@2.4.7      ncurses@6.3     perl@5.36.0      sqlite@3.39.4   util-linux-uuid@2.38.1  zstd@1.5.2
==> 61 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-ubuntu18.04-x86_64 / clang@7.0.0 -----------------------
zlib@1.2.13

-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69			    cmake@3.24.3     gdbm@1.23	     hwloc@2.8.0	   libffi@3.4.2       libxml2@2.10.1  numactl@2.0.14   pigz@2.7        tar@1.34 	       util-macros@1.19.3
automake@1.16.5 		    diffutils@3.8    gettext@0.21.1  krb5@1.19.3	   libiconv@1.16      m4@1.4.19       openblas@0.3.21  pkgconf@1.8.0   tcl@8.6.12	       xz@5.2.7
berkeley-db@18.1.40		    expat@2.4.8      gmp@6.2.1	     libbsd@0.11.5	   libmd@1.0.4	      mpc@1.1.0       openmpi@4.1.4    pmix@4.1.2      tcl@8.6.12	       yaksa@0.2
bison@3.8.2			    findutils@4.9.0  hdf5@1.12.2     libedit@3.1-20210216  libpciaccess@0.16  mpfr@3.1.6      openssh@9.1p1    python@3.10.8   texinfo@6.5	       zlib@1.2.8
bzip2@1.0.8			    gawk@5.1.1	     hdf5@1.12.2     libevent@2.1.12	   libsigsegv@2.13    mpich@4.0.2     openssl@1.1.1s   readline@8.1.2  trilinos@13.0.1	       zlib@1.2.13
ca-certificates-mozilla@2022-10-11  gcc@8.4.0	     hdf5@1.12.2     libfabric@1.16.1	   libtool@2.4.7      ncurses@6.3     perl@5.36.0      sqlite@3.39.4   util-linux-uuid@2.38.1  zstd@1.5.2
==> 61 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 install tcl
==> Error: Cannot install 'tcl' because it is not in the current environment. You can add it 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 env activate myproject
$ spack install
==> Concretized tcl
[+]  v63n6wx  tcl@8.6.12%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Concretized trilinos
 -   lrg5jy2  trilinos@13.0.1%gcc@7.5.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=RelWithDebInfo cxxstd=14 gotype=long_long arch=linux-ubuntu18.04-x86_64
[+]  jrlhw77	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  uwlw4wr	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4svpf4l	  ^openblas@0.3.21%gcc@7.5.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-ubuntu18.04-x86_64
[+]  4ebutg2	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		      ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ilnrdw5	  ^openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  l566d6c	      ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  qdpipdf		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  l7j5vdr		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e4esedl	      ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  oc246vi		  ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kxbisdg		      ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr		  ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  optdpo7	      ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ule2pil		  ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	      ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Installing environment myproject
==> Waiting for pkgconf-1.8.0-k2lfw6fht6zvsfihvx3avihboi3uv455
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.8.0-k2lfw6fht6zvsfihvx3avihboi3uv455
==> Waiting for ca-certificates-mozilla-2022-10-11-aurd37jjebxaqzs73saip5v6hgfu3foj
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ca-certificates-mozilla-2022-10-11-aurd37jjebxaqzs73saip5v6hgfu3foj
==> Waiting for berkeley-db-18.1.40-53fb72wziswrec6tkbjpowshkul2nsk4
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/berkeley-db-18.1.40-53fb72wziswrec6tkbjpowshkul2nsk4
==> Waiting for libiconv-1.16-ltvovvvjgmlvy4m2pn365cy6p5dysajq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libiconv-1.16-ltvovvvjgmlvy4m2pn365cy6p5dysajq
==> Waiting for zlib-1.2.13-2hfr5rbzefrxf6t6kv4trbsl63puaza6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.13-2hfr5rbzefrxf6t6kv4trbsl63puaza6
==> Waiting for libsigsegv-2.13-e262sf6ptgnmyu7zkflzp3ycbdfqz7hf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.13-e262sf6ptgnmyu7zkflzp3ycbdfqz7hf
==> Waiting for util-macros-1.19.3-ao5w53rpwhgfruk2zrqcehlov5slestd
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-macros-1.19.3-ao5w53rpwhgfruk2zrqcehlov5slestd
==> Waiting for xz-5.2.7-nrwxythffgfumjv7skmgdjtxaunlmqau
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/xz-5.2.7-nrwxythffgfumjv7skmgdjtxaunlmqau
==> Waiting for zstd-1.5.2-fprmzmoubdjdr663rprctp2tuqiv5apu
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zstd-1.5.2-fprmzmoubdjdr663rprctp2tuqiv5apu
==> Waiting for ncurses-6.3-zcuawlif55qhuknvbk4jez7xjcxhnydf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.3-zcuawlif55qhuknvbk4jez7xjcxhnydf
==> Waiting for diffutils-3.8-c3uhkcjt7tagz2djrd6r2b6b3c2tia3s
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/diffutils-3.8-c3uhkcjt7tagz2djrd6r2b6b3c2tia3s
==> Waiting for pigz-2.7-wod35nye4qcrkbopr23zoy5qb3ywp3v3
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pigz-2.7-wod35nye4qcrkbopr23zoy5qb3ywp3v3
==> Waiting for libxml2-2.10.1-4aq5aj2n5u2n3dbrb76pnhoil6tv3e4e
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libxml2-2.10.1-4aq5aj2n5u2n3dbrb76pnhoil6tv3e4e
==> Waiting for libedit-3.1-20210216-6pzeykrtvrkpbw6u3mq6likd4ktvah76
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libedit-3.1-20210216-6pzeykrtvrkpbw6u3mq6likd4ktvah76
==> Waiting for readline-8.1.2-kgyvtw5h6mi5nms32x3vzgbw32ymmfwa
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.1.2-kgyvtw5h6mi5nms32x3vzgbw32ymmfwa
==> Waiting for bzip2-1.0.8-cxcrelnw64jh6lvhzb6pfar7nijv6us6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bzip2-1.0.8-cxcrelnw64jh6lvhzb6pfar7nijv6us6
==> Waiting for m4-1.4.19-z7d5q4f2qzxejx4xxdrj45q5gxur6q7b
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.19-z7d5q4f2qzxejx4xxdrj45q5gxur6q7b
==> Waiting for gdbm-1.23-cpmyntybsnm3se7lfnvqosbiqzrcg2kq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.23-cpmyntybsnm3se7lfnvqosbiqzrcg2kq
==> Waiting for tar-1.34-kawegoyhusotpo5mlsqnjqf6ngrjyj2w
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/tar-1.34-kawegoyhusotpo5mlsqnjqf6ngrjyj2w
==> Waiting for libtool-2.4.7-bdxu4wnbhlmvj6sh5y7uynrldzepiilz
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.7-bdxu4wnbhlmvj6sh5y7uynrldzepiilz
==> Waiting for perl-5.36.0-4ebutg2fje7nmoqn5zack4n3hwh5xpg5
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.36.0-4ebutg2fje7nmoqn5zack4n3hwh5xpg5
==> Waiting for gettext-0.21.1-hj6szikaqzdpxa36gk4w72m4czhwd6gu
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gettext-0.21.1-hj6szikaqzdpxa36gk4w72m4czhwd6gu
==> Waiting for libpciaccess-0.16-p7f5n6q6kwnzq7syvqbslnotl72yxs23
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libpciaccess-0.16-p7f5n6q6kwnzq7syvqbslnotl72yxs23
==> Waiting for openssl-1.1.1s-uwlw4wregxiygolo4njivdqnmntkdrfm
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssl-1.1.1s-uwlw4wregxiygolo4njivdqnmntkdrfm
==> Waiting for autoconf-2.69-qdpipdfd3pjsmnelmhnde5zr5jm7gebr
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-qdpipdfd3pjsmnelmhnde5zr5jm7gebr
==> Waiting for bison-3.8.2-kxbisdgbfdep575ib3o6kxngzgkhdkzg
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bison-3.8.2-kxbisdgbfdep575ib3o6kxngzgkhdkzg
==> Waiting for openblas-0.3.21-4svpf4lqnwslt2pdohhgbfamsqnjrtez
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openblas-0.3.21-4svpf4lqnwslt2pdohhgbfamsqnjrtez
==> Waiting for hwloc-2.8.0-5yywrk2zoib75deet4eu4ocxim2ldngq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hwloc-2.8.0-5yywrk2zoib75deet4eu4ocxim2ldngq
==> Waiting for libevent-2.1.12-ule2pilocxwpbqtu746syxq6p5wuhndf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libevent-2.1.12-ule2pilocxwpbqtu746syxq6p5wuhndf
==> Waiting for cmake-3.24.3-jrlhw77jbz2jsfe52rjcjhvkyjqgaqva
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.24.3-jrlhw77jbz2jsfe52rjcjhvkyjqgaqva
==> Waiting for automake-1.16.5-l7j5vdrhtw5oc47phqkrj33ouguhje7q
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.5-l7j5vdrhtw5oc47phqkrj33ouguhje7q
==> Waiting for krb5-1.19.3-oc246vidm3aae72zpuxzubvpsgvtsbxg
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/krb5-1.19.3-oc246vidm3aae72zpuxzubvpsgvtsbxg
==> Waiting for pmix-4.1.2-optdpo7xdafhkbn7wg34nrxos6ypvabi
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pmix-4.1.2-optdpo7xdafhkbn7wg34nrxos6ypvabi
==> Waiting for numactl-2.0.14-l566d6cppqee7xyrx6yit5g2xywbvoyo
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/numactl-2.0.14-l566d6cppqee7xyrx6yit5g2xywbvoyo
==> Waiting for openssh-9.1p1-e4esedlbiusyosdimlwp6lc2wqvdxji7
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssh-9.1p1-e4esedlbiusyosdimlwp6lc2wqvdxji7
==> Waiting for openmpi-4.1.4-ilnrdw5772nw64ac6bkassqbmi7h2hgq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openmpi-4.1.4-ilnrdw5772nw64ac6bkassqbmi7h2hgq
==> Waiting for trilinos-13.0.1-lrg5jy2ufbudxfnw3hyn7yn56abmhddl
==> Installing trilinos-13.0.1-lrg5jy2ufbudxfnw3hyn7yn56abmhddl
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-trilinos-13.0.1-lrg5jy2ufbudxfnw3hyn7yn56abmhddl.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/trilinos-13.0.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-trilinos-13.0.1-lrg5jy2ufbudxfnw3hyn7yn56abmhddl.spack
==> Extracting trilinos-13.0.1-lrg5jy2ufbudxfnw3hyn7yn56abmhddl from binary cache
==> trilinos: Successfully installed trilinos-13.0.1-lrg5jy2ufbudxfnw3hyn7yn56abmhddl
  Fetch: 0.70s.  Build: 8.46s.	Total: 9.16s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/trilinos-13.0.1-lrg5jy2ufbudxfnw3hyn7yn56abmhddl
==> 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-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69	     bzip2@1.0.8			 gdbm@1.23	 libedit@3.1-20210216  libsigsegv@2.13	ncurses@6.3	 openssh@9.1p1	 pkgconf@1.8.0	 tcl@8.6.12	     zlib@1.2.13
automake@1.16.5      ca-certificates-mozilla@2022-10-11  gettext@0.21.1  libevent@2.1.12       libtool@2.4.7	numactl@2.0.14	 openssl@1.1.1s  pmix@4.1.2	 trilinos@13.0.1     zstd@1.5.2
berkeley-db@18.1.40  cmake@3.24.3			 hwloc@2.8.0	 libiconv@1.16	       libxml2@2.10.1	openblas@0.3.21  perl@5.36.0	 readline@8.1.2  util-macros@1.19.3
bison@3.8.2	     diffutils@3.8			 krb5@1.19.3	 libpciaccess@0.16     m4@1.4.19	openmpi@4.1.4	 pigz@2.7	 tar@1.34	 xz@5.2.7
==> 38 installed packages

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

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, LD_LIBRARY_PATH, 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
 -   747oqe2  scr@2.0.0%gcc@7.5.0+dtcmp~fortran~ipo+libyogrt async_api=NONE build_system=cmake build_type=RelWithDebInfo cache_base=/dev/shm cntl_base=/dev/shm copy_config=none file_lock=FLOCK resource_manager=SLURM scr_config=scr.conf arch=linux-ubuntu18.04-x86_64
[+]  jrlhw77	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  uwlw4wr	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   osciueo	  ^dtcmp@1.1.4%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   qo6kgjo	      ^lwgrp@1.0.5%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   ty6jvya	  ^libyogrt@1.27%gcc@7.5.0~static build_system=autotools scheduler=slurm arch=linux-ubuntu18.04-x86_64
 -   kunpxdt	      ^slurm@21-08-8-2%gcc@7.5.0~gtk~hdf5~hwloc~mariadb~pmix+readline~restd build_system=autotools sysconfdir=PREFIX/etc arch=linux-ubuntu18.04-x86_64
 -   skslu3i		  ^curl@7.85.0%gcc@7.5.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2~nghttp2 build_system=autotools libs=shared,static tls=openssl arch=linux-ubuntu18.04-x86_64
 -   pqgjrjg		  ^glib@2.74.1%gcc@7.5.0~libmount build_system=generic tracing=none arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  qzq4b7h		      ^libffi@3.4.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		      ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
 -   2zb5yee		      ^meson@0.63.3%gcc@7.5.0 build_system=python_pip patches=aa6c50d arch=linux-ubuntu18.04-x86_64
 -   wfr6uxy			  ^py-pip@22.2.2%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   opuypru			  ^py-setuptools@65.5.0%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   mjnnkeo			  ^py-wheel@0.37.1%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   rcjowmo		      ^ninja@1.11.1%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
 -   gtbod2d		      ^pcre2@10.39%gcc@7.5.0~jit+multibyte build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  wvhlgdd		      ^python@3.10.8%gcc@7.5.0+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib build_system=generic patches=0d98e93,7d40923,f2fd060 arch=linux-ubuntu18.04-x86_64
[+]  j5k5nzg			  ^expat@2.4.8%gcc@7.5.0+libbsd build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  qieib3t			      ^libbsd@0.11.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  miq3rrs				  ^libmd@1.0.4%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  vmf7qax			  ^sqlite@3.39.4%gcc@7.5.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  eayyoxj			  ^util-linux-uuid@2.38.1%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   ezuwtot		  ^json-c@0.16%gcc@7.5.0~ipo build_system=cmake build_type=RelWithDebInfo arch=linux-ubuntu18.04-x86_64
 -   grcwjnc		  ^lz4@1.9.4%gcc@7.5.0 build_system=makefile libs=shared,static arch=linux-ubuntu18.04-x86_64
 -   qfddwk6		  ^munge@0.5.15%gcc@7.5.0 build_system=autotools localstatedir=PREFIX/var arch=linux-ubuntu18.04-x86_64
 -   25x4i2l		      ^libgcrypt@1.10.1%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   t3etwuc			  ^libgpg-error@1.46%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   wcuzcqo			      ^gawk@5.1.1%gcc@7.5.0~nls build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  efr3j4d				  ^gmp@6.2.1%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
 -   vtov5r3				  ^mpfr@4.1.0%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
 -   rolnbco				      ^autoconf-archive@2022.02.11%gcc@7.5.0 build_system=autotools patches=139214f arch=linux-ubuntu18.04-x86_64
[+]  hgpn5sq				      ^texinfo@6.5%gcc@7.5.0 build_system=autotools patches=12f6edb,1732115 arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		  ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ilnrdw5	  ^openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	      ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q		  ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		      ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2		  ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		      ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  l566d6c	      ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  qdpipdf		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  l7j5vdr		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e4esedl	      ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  oc246vi		  ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kxbisdg		      ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr		  ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4ebutg2	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  optdpo7	      ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ule2pil		  ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   2uj3346	  ^pdsh@2.31%gcc@7.5.0+ssh+static_modules build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Concretized trilinos
[+]  lrg5jy2  trilinos@13.0.1%gcc@7.5.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=RelWithDebInfo cxxstd=14 gotype=long_long arch=linux-ubuntu18.04-x86_64
[+]  jrlhw77	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  uwlw4wr	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4svpf4l	  ^openblas@0.3.21%gcc@7.5.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-ubuntu18.04-x86_64
[+]  4ebutg2	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		      ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ilnrdw5	  ^openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  l566d6c	      ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  qdpipdf		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  l7j5vdr		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e4esedl	      ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  oc246vi		  ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kxbisdg		      ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr		  ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  optdpo7	      ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ule2pil		  ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	      ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Installing environment myproject2
==> Waiting for pkgconf-1.8.0-k2lfw6fht6zvsfihvx3avihboi3uv455
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pkgconf-1.8.0-k2lfw6fht6zvsfihvx3avihboi3uv455
==> Waiting for ca-certificates-mozilla-2022-10-11-aurd37jjebxaqzs73saip5v6hgfu3foj
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ca-certificates-mozilla-2022-10-11-aurd37jjebxaqzs73saip5v6hgfu3foj
==> Waiting for berkeley-db-18.1.40-53fb72wziswrec6tkbjpowshkul2nsk4
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/berkeley-db-18.1.40-53fb72wziswrec6tkbjpowshkul2nsk4
==> Waiting for libiconv-1.16-ltvovvvjgmlvy4m2pn365cy6p5dysajq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libiconv-1.16-ltvovvvjgmlvy4m2pn365cy6p5dysajq
==> Waiting for zlib-1.2.13-2hfr5rbzefrxf6t6kv4trbsl63puaza6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zlib-1.2.13-2hfr5rbzefrxf6t6kv4trbsl63puaza6
==> Waiting for libsigsegv-2.13-e262sf6ptgnmyu7zkflzp3ycbdfqz7hf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libsigsegv-2.13-e262sf6ptgnmyu7zkflzp3ycbdfqz7hf
==> Waiting for util-macros-1.19.3-ao5w53rpwhgfruk2zrqcehlov5slestd
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-macros-1.19.3-ao5w53rpwhgfruk2zrqcehlov5slestd
==> Waiting for xz-5.2.7-nrwxythffgfumjv7skmgdjtxaunlmqau
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/xz-5.2.7-nrwxythffgfumjv7skmgdjtxaunlmqau
==> Waiting for zstd-1.5.2-fprmzmoubdjdr663rprctp2tuqiv5apu
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/zstd-1.5.2-fprmzmoubdjdr663rprctp2tuqiv5apu
==> Waiting for libffi-3.4.2-qzq4b7hjmtrswtnnezcytreqg4vtsgi5
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libffi-3.4.2-qzq4b7hjmtrswtnnezcytreqg4vtsgi5
==> Waiting for libmd-1.0.4-miq3rrs534mewt3w5r3wd5jp3lkk7y25
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libmd-1.0.4-miq3rrs534mewt3w5r3wd5jp3lkk7y25
==> Waiting for pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf
==> Installing pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/pcre2-10.39/linux-ubuntu18.04-x86_64-gcc-7.5.0-pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf.spack
==> Extracting pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf from binary cache
==> pcre2: Successfully installed pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf
  Fetch: 0.42s.  Build: 0.33s.	Total: 0.74s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pcre2-10.39-gtbod2djn4h7cg7l6zq7kgmr3cvidirf
==> Waiting for lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p
==> Installing lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/lz4-1.9.4/linux-ubuntu18.04-x86_64-gcc-7.5.0-lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p.spack
==> Extracting lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p from binary cache
==> lz4: Successfully installed lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p
  Fetch: 0.07s.  Build: 0.29s.	Total: 0.36s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/lz4-1.9.4-grcwjnc4w2nzd3zc6dep44a4n5czwv6p
==> Waiting for autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst
==> Installing autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-archive-2022.02.11/linux-ubuntu18.04-x86_64-gcc-7.5.0-autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst.spack
==> Extracting autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst from binary cache
==> autoconf-archive: Successfully installed autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst
  Fetch: 0.08s.  Build: 0.37s.	Total: 0.45s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-archive-2022.02.11-rolnbcory6fewimzpvvipa7jevkmizst
==> Waiting for pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv
==> Installing pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/pdsh-2.31/linux-ubuntu18.04-x86_64-gcc-7.5.0-pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv.spack
==> Extracting pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv from binary cache
==> pdsh: Successfully installed pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv
  Fetch: 0.08s.  Build: 0.26s.	Total: 0.35s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pdsh-2.31-2uj33464g4syt2zl7xjzs7srr2pbcugv
==> Waiting for ncurses-6.3-zcuawlif55qhuknvbk4jez7xjcxhnydf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ncurses-6.3-zcuawlif55qhuknvbk4jez7xjcxhnydf
==> Waiting for util-linux-uuid-2.38.1-eayyoxjdfrc2wivabs5jbipcofeluyyo
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/util-linux-uuid-2.38.1-eayyoxjdfrc2wivabs5jbipcofeluyyo
==> Waiting for diffutils-3.8-c3uhkcjt7tagz2djrd6r2b6b3c2tia3s
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/diffutils-3.8-c3uhkcjt7tagz2djrd6r2b6b3c2tia3s
==> Waiting for pigz-2.7-wod35nye4qcrkbopr23zoy5qb3ywp3v3
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pigz-2.7-wod35nye4qcrkbopr23zoy5qb3ywp3v3
==> Waiting for libxml2-2.10.1-4aq5aj2n5u2n3dbrb76pnhoil6tv3e4e
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libxml2-2.10.1-4aq5aj2n5u2n3dbrb76pnhoil6tv3e4e
==> Waiting for libbsd-0.11.5-qieib3tiyp74ps4kn3jail7bot35t7hp
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libbsd-0.11.5-qieib3tiyp74ps4kn3jail7bot35t7hp
==> Waiting for libedit-3.1-20210216-6pzeykrtvrkpbw6u3mq6likd4ktvah76
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libedit-3.1-20210216-6pzeykrtvrkpbw6u3mq6likd4ktvah76
==> Waiting for readline-8.1.2-kgyvtw5h6mi5nms32x3vzgbw32ymmfwa
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/readline-8.1.2-kgyvtw5h6mi5nms32x3vzgbw32ymmfwa
==> Waiting for bzip2-1.0.8-cxcrelnw64jh6lvhzb6pfar7nijv6us6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bzip2-1.0.8-cxcrelnw64jh6lvhzb6pfar7nijv6us6
==> Waiting for m4-1.4.19-z7d5q4f2qzxejx4xxdrj45q5gxur6q7b
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/m4-1.4.19-z7d5q4f2qzxejx4xxdrj45q5gxur6q7b
==> Waiting for expat-2.4.8-j5k5nzgsbhue6ylglt4gtrnm6okuvsj6
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/expat-2.4.8-j5k5nzgsbhue6ylglt4gtrnm6okuvsj6
==> Waiting for gdbm-1.23-cpmyntybsnm3se7lfnvqosbiqzrcg2kq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gdbm-1.23-cpmyntybsnm3se7lfnvqosbiqzrcg2kq
==> Waiting for sqlite-3.39.4-vmf7qax3kowjkec5bzohcqvo5rqgm3xx
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/sqlite-3.39.4-vmf7qax3kowjkec5bzohcqvo5rqgm3xx
==> Waiting for tar-1.34-kawegoyhusotpo5mlsqnjqf6ngrjyj2w
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/tar-1.34-kawegoyhusotpo5mlsqnjqf6ngrjyj2w
==> Waiting for libtool-2.4.7-bdxu4wnbhlmvj6sh5y7uynrldzepiilz
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libtool-2.4.7-bdxu4wnbhlmvj6sh5y7uynrldzepiilz
==> Waiting for perl-5.36.0-4ebutg2fje7nmoqn5zack4n3hwh5xpg5
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/perl-5.36.0-4ebutg2fje7nmoqn5zack4n3hwh5xpg5
==> Waiting for gettext-0.21.1-hj6szikaqzdpxa36gk4w72m4czhwd6gu
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gettext-0.21.1-hj6szikaqzdpxa36gk4w72m4czhwd6gu
==> Waiting for libpciaccess-0.16-p7f5n6q6kwnzq7syvqbslnotl72yxs23
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libpciaccess-0.16-p7f5n6q6kwnzq7syvqbslnotl72yxs23
==> Waiting for bison-3.8.2-kxbisdgbfdep575ib3o6kxngzgkhdkzg
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/bison-3.8.2-kxbisdgbfdep575ib3o6kxngzgkhdkzg
==> Waiting for texinfo-6.5-hgpn5sqlfcoshixlwrloyuervjyhh7je
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/texinfo-6.5-hgpn5sqlfcoshixlwrloyuervjyhh7je
==> Waiting for autoconf-2.69-qdpipdfd3pjsmnelmhnde5zr5jm7gebr
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/autoconf-2.69-qdpipdfd3pjsmnelmhnde5zr5jm7gebr
==> Waiting for openssl-1.1.1s-uwlw4wregxiygolo4njivdqnmntkdrfm
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssl-1.1.1s-uwlw4wregxiygolo4njivdqnmntkdrfm
==> Waiting for hwloc-2.8.0-5yywrk2zoib75deet4eu4ocxim2ldngq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/hwloc-2.8.0-5yywrk2zoib75deet4eu4ocxim2ldngq
==> Waiting for automake-1.16.5-l7j5vdrhtw5oc47phqkrj33ouguhje7q
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/automake-1.16.5-l7j5vdrhtw5oc47phqkrj33ouguhje7q
==> Waiting for python-3.10.8-wvhlgddicoh3nqgeusdnal356lk55ckf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/python-3.10.8-wvhlgddicoh3nqgeusdnal356lk55ckf
==> Waiting for curl-7.85.0-skslu3imfcakpgjn2ctbimcqwyjxlphb
==> Installing curl-7.85.0-skslu3imfcakpgjn2ctbimcqwyjxlphb
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-curl-7.85.0-skslu3imfcakpgjn2ctbimcqwyjxlphb.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/curl-7.85.0/linux-ubuntu18.04-x86_64-gcc-7.5.0-curl-7.85.0-skslu3imfcakpgjn2ctbimcqwyjxlphb.spack
==> Extracting curl-7.85.0-skslu3imfcakpgjn2ctbimcqwyjxlphb from binary cache
==> curl: Successfully installed curl-7.85.0-skslu3imfcakpgjn2ctbimcqwyjxlphb
  Fetch: 0.09s.  Build: 0.38s.	Total: 0.47s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/curl-7.85.0-skslu3imfcakpgjn2ctbimcqwyjxlphb
==> Waiting for libevent-2.1.12-ule2pilocxwpbqtu746syxq6p5wuhndf
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libevent-2.1.12-ule2pilocxwpbqtu746syxq6p5wuhndf
==> Waiting for krb5-1.19.3-oc246vidm3aae72zpuxzubvpsgvtsbxg
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/krb5-1.19.3-oc246vidm3aae72zpuxzubvpsgvtsbxg
==> Waiting for cmake-3.24.3-jrlhw77jbz2jsfe52rjcjhvkyjqgaqva
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/cmake-3.24.3-jrlhw77jbz2jsfe52rjcjhvkyjqgaqva
==> Waiting for numactl-2.0.14-l566d6cppqee7xyrx6yit5g2xywbvoyo
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/numactl-2.0.14-l566d6cppqee7xyrx6yit5g2xywbvoyo
==> Waiting for gmp-6.2.1-efr3j4d5qpovjxsoraexs722kxyigj2b
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gmp-6.2.1-efr3j4d5qpovjxsoraexs722kxyigj2b
==> Waiting for py-pip-22.2.2-wfr6uxyo4hmx37irhpowmewi2e7yl4jt
==> Installing py-pip-22.2.2-wfr6uxyo4hmx37irhpowmewi2e7yl4jt
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-pip-22.2.2-wfr6uxyo4hmx37irhpowmewi2e7yl4jt.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-pip-22.2.2/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-pip-22.2.2-wfr6uxyo4hmx37irhpowmewi2e7yl4jt.spack
==> Extracting py-pip-22.2.2-wfr6uxyo4hmx37irhpowmewi2e7yl4jt from binary cache
==> py-pip: Successfully installed py-pip-22.2.2-wfr6uxyo4hmx37irhpowmewi2e7yl4jt
  Fetch: 0.08s.  Build: 0.59s.	Total: 0.67s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-pip-22.2.2-wfr6uxyo4hmx37irhpowmewi2e7yl4jt
==> Waiting for ninja-1.11.1-rcjowmokjukcp25hvxppdrqbldfsn63g
==> Installing ninja-1.11.1-rcjowmokjukcp25hvxppdrqbldfsn63g
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-ninja-1.11.1-rcjowmokjukcp25hvxppdrqbldfsn63g.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/ninja-1.11.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-ninja-1.11.1-rcjowmokjukcp25hvxppdrqbldfsn63g.spack
==> Extracting ninja-1.11.1-rcjowmokjukcp25hvxppdrqbldfsn63g from binary cache
==> ninja: Successfully installed ninja-1.11.1-rcjowmokjukcp25hvxppdrqbldfsn63g
  Fetch: 0.08s.  Build: 0.35s.	Total: 0.43s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/ninja-1.11.1-rcjowmokjukcp25hvxppdrqbldfsn63g
==> Waiting for pmix-4.1.2-optdpo7xdafhkbn7wg34nrxos6ypvabi
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/pmix-4.1.2-optdpo7xdafhkbn7wg34nrxos6ypvabi
==> Waiting for openssh-9.1p1-e4esedlbiusyosdimlwp6lc2wqvdxji7
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openssh-9.1p1-e4esedlbiusyosdimlwp6lc2wqvdxji7
==> Waiting for json-c-0.16-ezuwtotla7jmrd2fuugknbllkqpuhbw4
==> Installing json-c-0.16-ezuwtotla7jmrd2fuugknbllkqpuhbw4
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-json-c-0.16-ezuwtotla7jmrd2fuugknbllkqpuhbw4.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/json-c-0.16/linux-ubuntu18.04-x86_64-gcc-7.5.0-json-c-0.16-ezuwtotla7jmrd2fuugknbllkqpuhbw4.spack
==> Extracting json-c-0.16-ezuwtotla7jmrd2fuugknbllkqpuhbw4 from binary cache
==> json-c: Successfully installed json-c-0.16-ezuwtotla7jmrd2fuugknbllkqpuhbw4
  Fetch: 0.07s.  Build: 0.27s.	Total: 0.34s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/json-c-0.16-ezuwtotla7jmrd2fuugknbllkqpuhbw4
==> Waiting for mpfr-4.1.0-vtov5r3bpjuifsg2psb7k6qm7o7gstvl
==> Installing mpfr-4.1.0-vtov5r3bpjuifsg2psb7k6qm7o7gstvl
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-mpfr-4.1.0-vtov5r3bpjuifsg2psb7k6qm7o7gstvl.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/mpfr-4.1.0/linux-ubuntu18.04-x86_64-gcc-7.5.0-mpfr-4.1.0-vtov5r3bpjuifsg2psb7k6qm7o7gstvl.spack
==> Extracting mpfr-4.1.0-vtov5r3bpjuifsg2psb7k6qm7o7gstvl from binary cache
==> mpfr: Successfully installed mpfr-4.1.0-vtov5r3bpjuifsg2psb7k6qm7o7gstvl
  Fetch: 0.08s.  Build: 0.35s.	Total: 0.43s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/mpfr-4.1.0-vtov5r3bpjuifsg2psb7k6qm7o7gstvl
==> Waiting for py-wheel-0.37.1-mjnnkeonrctydcz3gf4ohj2byylfkkel
==> Installing py-wheel-0.37.1-mjnnkeonrctydcz3gf4ohj2byylfkkel
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-wheel-0.37.1-mjnnkeonrctydcz3gf4ohj2byylfkkel.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-wheel-0.37.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-wheel-0.37.1-mjnnkeonrctydcz3gf4ohj2byylfkkel.spack
==> Extracting py-wheel-0.37.1-mjnnkeonrctydcz3gf4ohj2byylfkkel from binary cache
==> py-wheel: Successfully installed py-wheel-0.37.1-mjnnkeonrctydcz3gf4ohj2byylfkkel
  Fetch: 0.08s.  Build: 0.28s.	Total: 0.35s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-wheel-0.37.1-mjnnkeonrctydcz3gf4ohj2byylfkkel
==> Waiting for py-setuptools-65.5.0-opuyprudifhmod7fzqqeqxhshta7dxu7
==> Installing py-setuptools-65.5.0-opuyprudifhmod7fzqqeqxhshta7dxu7
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-setuptools-65.5.0-opuyprudifhmod7fzqqeqxhshta7dxu7.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-setuptools-65.5.0/linux-ubuntu18.04-x86_64-gcc-7.5.0-py-setuptools-65.5.0-opuyprudifhmod7fzqqeqxhshta7dxu7.spack
==> Extracting py-setuptools-65.5.0-opuyprudifhmod7fzqqeqxhshta7dxu7 from binary cache
==> py-setuptools: Successfully installed py-setuptools-65.5.0-opuyprudifhmod7fzqqeqxhshta7dxu7
  Fetch: 0.08s.  Build: 0.41s.	Total: 0.49s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/py-setuptools-65.5.0-opuyprudifhmod7fzqqeqxhshta7dxu7
==> Waiting for openmpi-4.1.4-ilnrdw5772nw64ac6bkassqbmi7h2hgq
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/openmpi-4.1.4-ilnrdw5772nw64ac6bkassqbmi7h2hgq
==> Waiting for gawk-5.1.1-wcuzcqodkcpw32wbwruignxifptby7ot
==> Installing gawk-5.1.1-wcuzcqodkcpw32wbwruignxifptby7ot
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-gawk-5.1.1-wcuzcqodkcpw32wbwruignxifptby7ot.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/gawk-5.1.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-gawk-5.1.1-wcuzcqodkcpw32wbwruignxifptby7ot.spack
==> Extracting gawk-5.1.1-wcuzcqodkcpw32wbwruignxifptby7ot from binary cache
==> gawk: Successfully installed gawk-5.1.1-wcuzcqodkcpw32wbwruignxifptby7ot
  Fetch: 0.08s.  Build: 0.35s.	Total: 0.42s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/gawk-5.1.1-wcuzcqodkcpw32wbwruignxifptby7ot
==> Waiting for meson-0.63.3-2zb5yeey5ging7mj2kmkegyzinonyvew
==> Installing meson-0.63.3-2zb5yeey5ging7mj2kmkegyzinonyvew
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-meson-0.63.3-2zb5yeey5ging7mj2kmkegyzinonyvew.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/meson-0.63.3/linux-ubuntu18.04-x86_64-gcc-7.5.0-meson-0.63.3-2zb5yeey5ging7mj2kmkegyzinonyvew.spack
==> Extracting meson-0.63.3-2zb5yeey5ging7mj2kmkegyzinonyvew from binary cache
==> meson: Successfully installed meson-0.63.3-2zb5yeey5ging7mj2kmkegyzinonyvew
  Fetch: 0.09s.  Build: 0.44s.	Total: 0.53s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/meson-0.63.3-2zb5yeey5ging7mj2kmkegyzinonyvew
==> Waiting for lwgrp-1.0.5-qo6kgjo6tzdq2qakcvo5e6qvemb4i5zh
==> Installing lwgrp-1.0.5-qo6kgjo6tzdq2qakcvo5e6qvemb4i5zh
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-lwgrp-1.0.5-qo6kgjo6tzdq2qakcvo5e6qvemb4i5zh.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/lwgrp-1.0.5/linux-ubuntu18.04-x86_64-gcc-7.5.0-lwgrp-1.0.5-qo6kgjo6tzdq2qakcvo5e6qvemb4i5zh.spack
==> Extracting lwgrp-1.0.5-qo6kgjo6tzdq2qakcvo5e6qvemb4i5zh from binary cache
==> lwgrp: Successfully installed lwgrp-1.0.5-qo6kgjo6tzdq2qakcvo5e6qvemb4i5zh
  Fetch: 0.08s.  Build: 0.35s.	Total: 0.43s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/lwgrp-1.0.5-qo6kgjo6tzdq2qakcvo5e6qvemb4i5zh
==> Waiting for libgpg-error-1.46-t3etwucmt67eb4f637eqnoxrcbufkxcx
==> Installing libgpg-error-1.46-t3etwucmt67eb4f637eqnoxrcbufkxcx
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-libgpg-error-1.46-t3etwucmt67eb4f637eqnoxrcbufkxcx.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/libgpg-error-1.46/linux-ubuntu18.04-x86_64-gcc-7.5.0-libgpg-error-1.46-t3etwucmt67eb4f637eqnoxrcbufkxcx.spack
==> Extracting libgpg-error-1.46-t3etwucmt67eb4f637eqnoxrcbufkxcx from binary cache
==> libgpg-error: Successfully installed libgpg-error-1.46-t3etwucmt67eb4f637eqnoxrcbufkxcx
  Fetch: 0.08s.  Build: 0.32s.	Total: 0.39s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libgpg-error-1.46-t3etwucmt67eb4f637eqnoxrcbufkxcx
==> Waiting for glib-2.74.1-pqgjrjgepwrznupivpaqxtw4zjsm6tle
==> Installing glib-2.74.1-pqgjrjgepwrznupivpaqxtw4zjsm6tle
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-glib-2.74.1-pqgjrjgepwrznupivpaqxtw4zjsm6tle.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/glib-2.74.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-glib-2.74.1-pqgjrjgepwrznupivpaqxtw4zjsm6tle.spack
==> Extracting glib-2.74.1-pqgjrjgepwrznupivpaqxtw4zjsm6tle from binary cache
==> glib: Successfully installed glib-2.74.1-pqgjrjgepwrznupivpaqxtw4zjsm6tle
  Fetch: 0.08s.  Build: 0.71s.	Total: 0.79s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/glib-2.74.1-pqgjrjgepwrznupivpaqxtw4zjsm6tle
==> Waiting for dtcmp-1.1.4-osciueofy7txq65tfhretwazglhfpiit
==> Installing dtcmp-1.1.4-osciueofy7txq65tfhretwazglhfpiit
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-dtcmp-1.1.4-osciueofy7txq65tfhretwazglhfpiit.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/dtcmp-1.1.4/linux-ubuntu18.04-x86_64-gcc-7.5.0-dtcmp-1.1.4-osciueofy7txq65tfhretwazglhfpiit.spack
==> Extracting dtcmp-1.1.4-osciueofy7txq65tfhretwazglhfpiit from binary cache
==> dtcmp: Successfully installed dtcmp-1.1.4-osciueofy7txq65tfhretwazglhfpiit
  Fetch: 0.08s.  Build: 0.50s.	Total: 0.58s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/dtcmp-1.1.4-osciueofy7txq65tfhretwazglhfpiit
==> Waiting for libgcrypt-1.10.1-25x4i2lixlobso4oxcqho43hoof4axbl
==> Installing libgcrypt-1.10.1-25x4i2lixlobso4oxcqho43hoof4axbl
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-libgcrypt-1.10.1-25x4i2lixlobso4oxcqho43hoof4axbl.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/libgcrypt-1.10.1/linux-ubuntu18.04-x86_64-gcc-7.5.0-libgcrypt-1.10.1-25x4i2lixlobso4oxcqho43hoof4axbl.spack
==> Extracting libgcrypt-1.10.1-25x4i2lixlobso4oxcqho43hoof4axbl from binary cache
==> libgcrypt: Successfully installed libgcrypt-1.10.1-25x4i2lixlobso4oxcqho43hoof4axbl
  Fetch: 0.08s.  Build: 0.35s.	Total: 0.43s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libgcrypt-1.10.1-25x4i2lixlobso4oxcqho43hoof4axbl
==> Waiting for munge-0.5.15-qfddwk6u7zhmzpxo7o4m5nwb54w2e7yr
==> Installing munge-0.5.15-qfddwk6u7zhmzpxo7o4m5nwb54w2e7yr
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-munge-0.5.15-qfddwk6u7zhmzpxo7o4m5nwb54w2e7yr.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/munge-0.5.15/linux-ubuntu18.04-x86_64-gcc-7.5.0-munge-0.5.15-qfddwk6u7zhmzpxo7o4m5nwb54w2e7yr.spack
==> Extracting munge-0.5.15-qfddwk6u7zhmzpxo7o4m5nwb54w2e7yr from binary cache
==> munge: Successfully installed munge-0.5.15-qfddwk6u7zhmzpxo7o4m5nwb54w2e7yr
  Fetch: 0.08s.  Build: 0.34s.	Total: 0.42s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/munge-0.5.15-qfddwk6u7zhmzpxo7o4m5nwb54w2e7yr
==> Waiting for slurm-21-08-8-2-kunpxdt6ytocyebnkdjtfesnp4klpo42
==> Installing slurm-21-08-8-2-kunpxdt6ytocyebnkdjtfesnp4klpo42
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-slurm-21-08-8-2-kunpxdt6ytocyebnkdjtfesnp4klpo42.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/slurm-21-08-8-2/linux-ubuntu18.04-x86_64-gcc-7.5.0-slurm-21-08-8-2-kunpxdt6ytocyebnkdjtfesnp4klpo42.spack
==> Extracting slurm-21-08-8-2-kunpxdt6ytocyebnkdjtfesnp4klpo42 from binary cache
==> slurm: Successfully installed slurm-21-08-8-2-kunpxdt6ytocyebnkdjtfesnp4klpo42
  Fetch: 0.16s.  Build: 4.02s.	Total: 4.18s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/slurm-21-08-8-2-kunpxdt6ytocyebnkdjtfesnp4klpo42
==> Waiting for libyogrt-1.27-ty6jvyat4pwi3qbfb6k3jgnznetz3cws
==> Installing libyogrt-1.27-ty6jvyat4pwi3qbfb6k3jgnznetz3cws
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-libyogrt-1.27-ty6jvyat4pwi3qbfb6k3jgnznetz3cws.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/libyogrt-1.27/linux-ubuntu18.04-x86_64-gcc-7.5.0-libyogrt-1.27-ty6jvyat4pwi3qbfb6k3jgnznetz3cws.spack
==> Extracting libyogrt-1.27-ty6jvyat4pwi3qbfb6k3jgnznetz3cws from binary cache
==> libyogrt: Successfully installed libyogrt-1.27-ty6jvyat4pwi3qbfb6k3jgnznetz3cws
  Fetch: 0.08s.  Build: 0.51s.	Total: 0.59s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/libyogrt-1.27-ty6jvyat4pwi3qbfb6k3jgnznetz3cws
==> Waiting for scr-2.0.0-747oqe25cobnwlchrrx26c3e3ma2ug75
==> Installing scr-2.0.0-747oqe25cobnwlchrrx26c3e3ma2ug75
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64-gcc-7.5.0-scr-2.0.0-747oqe25cobnwlchrrx26c3e3ma2ug75.spec.json.sig
==> Fetching file:///mirror/build_cache/linux-ubuntu18.04-x86_64/gcc-7.5.0/scr-2.0.0/linux-ubuntu18.04-x86_64-gcc-7.5.0-scr-2.0.0-747oqe25cobnwlchrrx26c3e3ma2ug75.spack
==> Extracting scr-2.0.0-747oqe25cobnwlchrrx26c3e3ma2ug75 from binary cache
==> scr: Successfully installed scr-2.0.0-747oqe25cobnwlchrrx26c3e3ma2ug75
  Fetch: 0.08s.  Build: 1.73s.	Total: 1.82s.
[+] /home/spack/spack/opt/spack/linux-ubuntu18.04-x86_64/gcc-7.5.0/scr-2.0.0-747oqe25cobnwlchrrx26c3e3ma2ug75
==> 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-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69			    cmake@3.24.3   gettext@0.21.1  libedit@3.1-20210216  libpciaccess@0.16  m4@1.4.19	    openblas@0.3.21  pigz@2.7		   readline@8.1.2   util-linux-uuid@2.38.1
autoconf-archive@2022.02.11	    curl@7.85.0    glib@2.74.1	   libevent@2.1.12	 libsigsegv@2.13    meson@0.63.3    openmpi@4.1.4    pkgconf@1.8.0	   scr@2.0.0	    util-macros@1.19.3
automake@1.16.5 		    diffutils@3.8  gmp@6.2.1	   libffi@3.4.2 	 libtool@2.4.7	    mpfr@4.1.0	    openssh@9.1p1    pmix@4.1.2 	   slurm@21-08-8-2  xz@5.2.7
berkeley-db@18.1.40		    dtcmp@1.1.4    hwloc@2.8.0	   libgcrypt@1.10.1	 libxml2@2.10.1     munge@0.5.15    openssl@1.1.1s   py-pip@22.2.2	   sqlite@3.39.4    zlib@1.2.13
bison@3.8.2			    expat@2.4.8    json-c@0.16	   libgpg-error@1.46	 libyogrt@1.27	    ncurses@6.3     pcre2@10.39      py-setuptools@65.5.0  tar@1.34	    zstd@1.5.2
bzip2@1.0.8			    gawk@5.1.1	   krb5@1.19.3	   libiconv@1.16	 lwgrp@1.0.5	    ninja@1.11.1    pdsh@2.31	     py-wheel@0.37.1	   texinfo@6.5
ca-certificates-mozilla@2022-10-11  gdbm@1.23	   libbsd@0.11.5   libmd@1.0.4		 lz4@1.9.4	    numactl@2.0.14  perl@5.36.0      python@3.10.8	   trilinos@13.0.1
==> 68 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 uninstall trilinos from myproject2 and review the contents of the environment:

$ spack uninstall trilinos

==> Will not uninstall trilinos@13.0.1%gcc@7.5.0/lrg5jy2
It is used by the following other environments:
    myproject

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

==> Installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69			    cmake@3.24.3   gettext@0.21.1  libedit@3.1-20210216  libpciaccess@0.16  m4@1.4.19	    openblas@0.3.21  pigz@2.7		   readline@8.1.2   util-linux-uuid@2.38.1
autoconf-archive@2022.02.11	    curl@7.85.0    glib@2.74.1	   libevent@2.1.12	 libsigsegv@2.13    meson@0.63.3    openmpi@4.1.4    pkgconf@1.8.0	   scr@2.0.0	    util-macros@1.19.3
automake@1.16.5 		    diffutils@3.8  gmp@6.2.1	   libffi@3.4.2 	 libtool@2.4.7	    mpfr@4.1.0	    openssh@9.1p1    pmix@4.1.2 	   slurm@21-08-8-2  xz@5.2.7
berkeley-db@18.1.40		    dtcmp@1.1.4    hwloc@2.8.0	   libgcrypt@1.10.1	 libxml2@2.10.1     munge@0.5.15    openssl@1.1.1s   py-pip@22.2.2	   sqlite@3.39.4    zlib@1.2.13
bison@3.8.2			    expat@2.4.8    json-c@0.16	   libgpg-error@1.46	 libyogrt@1.27	    ncurses@6.3     pcre2@10.39      py-setuptools@65.5.0  tar@1.34	    zstd@1.5.2
bzip2@1.0.8			    gawk@5.1.1	   krb5@1.19.3	   libiconv@1.16	 lwgrp@1.0.5	    ninja@1.11.1    pdsh@2.31	     py-wheel@0.37.1	   texinfo@6.5
ca-certificates-mozilla@2022-10-11  gdbm@1.23	   libbsd@0.11.5   libmd@1.0.4		 lz4@1.9.4	    numactl@2.0.14  perl@5.36.0      python@3.10.8	   trilinos@13.0.1
==> 68 installed packages

We can see that trilinos no longer appears in the list of installed specs. However, it is still listed as a root in the environment. If we want to remove it from the roots list we need to use spack remove:

$ spack remove trilinos
==> Removing trilinos from environment myproject2
$ spack find
==> In environment myproject2
==> Root specs
scr

==> Installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69			    cmake@3.24.3   gettext@0.21.1  libedit@3.1-20210216  libpciaccess@0.16  m4@1.4.19	    openblas@0.3.21  pigz@2.7		   readline@8.1.2   util-linux-uuid@2.38.1
autoconf-archive@2022.02.11	    curl@7.85.0    glib@2.74.1	   libevent@2.1.12	 libsigsegv@2.13    meson@0.63.3    openmpi@4.1.4    pkgconf@1.8.0	   scr@2.0.0	    util-macros@1.19.3
automake@1.16.5 		    diffutils@3.8  gmp@6.2.1	   libffi@3.4.2 	 libtool@2.4.7	    mpfr@4.1.0	    openssh@9.1p1    pmix@4.1.2 	   slurm@21-08-8-2  xz@5.2.7
berkeley-db@18.1.40		    dtcmp@1.1.4    hwloc@2.8.0	   libgcrypt@1.10.1	 libxml2@2.10.1     munge@0.5.15    openssl@1.1.1s   py-pip@22.2.2	   sqlite@3.39.4    zlib@1.2.13
bison@3.8.2			    expat@2.4.8    json-c@0.16	   libgpg-error@1.46	 libyogrt@1.27	    ncurses@6.3     pcre2@10.39      py-setuptools@65.5.0  tar@1.34	    zstd@1.5.2
bzip2@1.0.8			    gawk@5.1.1	   krb5@1.19.3	   libiconv@1.16	 lwgrp@1.0.5	    ninja@1.11.1    pdsh@2.31	     py-wheel@0.37.1	   texinfo@6.5
ca-certificates-mozilla@2022-10-11  gdbm@1.23	   libbsd@0.11.5   libmd@1.0.4		 lz4@1.9.4	    numactl@2.0.14  perl@5.36.0      python@3.10.8	   trilinos@13.0.1
==> 68 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-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69	     bzip2@1.0.8			 gdbm@1.23	 libedit@3.1-20210216  libsigsegv@2.13	ncurses@6.3	 openssh@9.1p1	 pkgconf@1.8.0	 tcl@8.6.12	     zlib@1.2.13
automake@1.16.5      ca-certificates-mozilla@2022-10-11  gettext@0.21.1  libevent@2.1.12       libtool@2.4.7	numactl@2.0.14	 openssl@1.1.1s  pmix@4.1.2	 trilinos@13.0.1     zstd@1.5.2
berkeley-db@18.1.40  cmake@3.24.3			 hwloc@2.8.0	 libiconv@1.16	       libxml2@2.10.1	openblas@0.3.21  perl@5.36.0	 readline@8.1.2  util-macros@1.19.3
bison@3.8.2	     diffutils@3.8			 krb5@1.19.3	 libpciaccess@0.16     m4@1.4.19	openmpi@4.1.4	 pigz@2.7	 tar@1.34	 xz@5.2.7
==> 38 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.

Shorthand for add and remove

We’ve seen how to use add and remove to add and remove roots from an environment, and we’ve seen how to install all of the roots at once, and how to uninstall particular packages.

It may seem tedious to have to add then install (or uninstall then remove) every spec in an environment. You can combine these steps into single commands if you want:

  • spack install --add: add and install a package
  • spack uninstall --remove uninstall and remove a package

However, there are are advantages to processing all the specs of an environment 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.

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 any package in the environment. We’ll cover unify:false and unify:when_possible later, in the Stacks tutorial.

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 prefer 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:all:providers:mpi: entry below:

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

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

Note

This setting only defines the default mpi provider. You can still override the provider on the command line, e.g., with spack install trilinos ^openmpi.

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 changing the default of the 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 --fresh to make Spack re-concretize all the environment’s specs:

$ spack concretize --force --fresh
==> Concretized tcl
[+]  v63n6wx  tcl@8.6.12%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Concretized trilinos
 -   penzjd3  trilinos@13.0.1%gcc@7.5.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=RelWithDebInfo cxxstd=14 gotype=long_long arch=linux-ubuntu18.04-x86_64
 -   stszbns	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   yr4z2pt	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb		  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   vbkcftf	  ^mpich@4.0.2%gcc@7.5.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 patches=d4c0e99 pmi=pmi arch=linux-ubuntu18.04-x86_64
[+]  fxoomyc	      ^findutils@4.9.0%gcc@7.5.0 build_system=autotools patches=440b954 arch=linux-ubuntu18.04-x86_64
[+]  u2kjaxd	      ^libfabric@1.16.1%gcc@7.5.0~debug~kdreg build_system=autotools fabrics=sockets,tcp,udp arch=linux-ubuntu18.04-x86_64
 -   tlfr5qw	      ^yaksa@0.2%gcc@7.5.0~cuda~rocm build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   btoteei		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
 -   rxjqnjw		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   cyf55fe		  ^python@3.10.8%gcc@7.5.0+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib build_system=generic patches=0d98e93,7d40923,f2fd060 arch=linux-ubuntu18.04-x86_64
[+]  j5k5nzg		      ^expat@2.4.8%gcc@7.5.0+libbsd build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  qieib3t			  ^libbsd@0.11.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  miq3rrs			      ^libmd@1.0.4%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  qzq4b7h		      ^libffi@3.4.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		      ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  vmf7qax		      ^sqlite@3.39.4%gcc@7.5.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  eayyoxj		      ^util-linux-uuid@2.38.1%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
 -   3db4ryr	  ^openblas@0.3.21%gcc@7.5.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-ubuntu18.04-x86_64
 -   eydiwim	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64

==> Updating view at /home/spack7/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.

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, LIBRARY_PATH, and LD_LIBRARY_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:/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:.:
MODULEPATH=/home/spack/spack/share/spack/modules/linux-ubuntu18.04-x86_64
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 0
zlib version: 1.2.13
Hello world from rank 1
Hello world from rank 2
Hello world from rank 3

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 myproject
==> Root specs
gmp   hdf5 +hl  tcl   trilinos

==> 1 installed package
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 ----------------
zlib@1.2.12

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 our currently active environment, myproject, earlier using spack env create myproject so let’s mainly focus on its environment files in this section.

Earlier, when we changed our environment’s configuration using spack config edit, we were actually editing its spack.yaml file. We can change 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

You can see that myproject is active because it is highlighted in green.

We can also see from the listing that the 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:
  packages:
    all:
      providers:
        mpi: [mpich]
  specs: [tcl, trilinos, hdf5+hl ^mpich, gmp]
  view: true

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

Now activate the environment and install the packages:

$ spack env activate .
$ spack install
==> Concretized trilinos
[+]  lrg5jy2  trilinos@13.0.1%gcc@7.5.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=RelWithDebInfo cxxstd=14 gotype=long_long arch=linux-ubuntu18.04-x86_64
[+]  jrlhw77	  ^cmake@3.24.3%gcc@7.5.0~doc+ncurses+ownlibs~qt build_system=generic build_type=Release arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  uwlw4wr	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn		  ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	      ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4svpf4l	  ^openblas@0.3.21%gcc@7.5.0~bignuma~consistent_fpcsr+fortran~ilp64+locking+pic+shared build_system=makefile patches=d3d9b15 symbol_suffix=none threads=none arch=linux-ubuntu18.04-x86_64
[+]  4ebutg2	      ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w		  ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln		  ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		      ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  cpmynty		  ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		      ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ilnrdw5	  ^openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  l566d6c	      ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  qdpipdf		  ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  l7j5vdr		  ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f		  ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		      ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e4esedl	      ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  oc246vi		  ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kxbisdg		      ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		      ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy			  ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			      ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			      ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr		  ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  optdpo7	      ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ule2pil		  ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	      ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Concretized openmpi
[+]  ilnrdw5  openmpi@4.1.4%gcc@7.5.0~atomics~cuda~cxx~cxx_exceptions~gpfs~internal-hwloc~java~legacylaunchers~lustre~memchecker+romio+rsh~singularity+static+vt+wrapper-rpath build_system=autotools fabrics=none schedulers=none arch=linux-ubuntu18.04-x86_64
[+]  5yywrk2	  ^hwloc@2.8.0%gcc@7.5.0~cairo~cuda~gl~libudev+libxml2~netloc~nvml~oneapi-level-zero~opencl+pci~rocm build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  p7f5n6q	      ^libpciaccess@0.16%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ao5w53r		  ^util-macros@1.19.3%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  4aq5aj2	      ^libxml2@2.10.1%gcc@7.5.0~python build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ltvovvv		  ^libiconv@1.16%gcc@7.5.0 build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  nrwxyth		  ^xz@5.2.7%gcc@7.5.0~pic build_system=autotools libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  zcuawli	      ^ncurses@6.3%gcc@7.5.0~symlinks+termlib abi=none build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  l566d6c	  ^numactl@2.0.14%gcc@7.5.0 build_system=autotools patches=4e1d78c,62fc8a8,ff37630 arch=linux-ubuntu18.04-x86_64
[+]  qdpipdf	      ^autoconf@2.69%gcc@7.5.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-ubuntu18.04-x86_64
[+]  l7j5vdr	      ^automake@1.16.5%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  bdxu4wn	      ^libtool@2.4.7%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  z7d5q4f	      ^m4@1.4.19%gcc@7.5.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-ubuntu18.04-x86_64
[+]  c3uhkcj		  ^diffutils@3.8%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e262sf6		  ^libsigsegv@2.13%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  e4esedl	  ^openssh@9.1p1%gcc@7.5.0+gssapi build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  oc246vi	      ^krb5@1.19.3%gcc@7.5.0+shared build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kxbisdg		  ^bison@3.8.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  hj6szik		  ^gettext@0.21.1%gcc@7.5.0+bzip2+curses+git~libunistring+libxml2+tar+xz build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kawegoy		      ^tar@1.34%gcc@7.5.0 build_system=autotools zip=pigz arch=linux-ubuntu18.04-x86_64
[+]  wod35ny			  ^pigz@2.7%gcc@7.5.0 build_system=makefile arch=linux-ubuntu18.04-x86_64
[+]  fprmzmo			  ^zstd@1.5.2%gcc@7.5.0+programs build_system=makefile compression=none libs=shared,static arch=linux-ubuntu18.04-x86_64
[+]  6pzeykr	      ^libedit@3.1-20210216%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  uwlw4wr	      ^openssl@1.1.1s%gcc@7.5.0~docs~shared build_system=generic certs=mozilla arch=linux-ubuntu18.04-x86_64
[+]  aurd37j		  ^ca-certificates-mozilla@2022-10-11%gcc@7.5.0 build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  4ebutg2	  ^perl@5.36.0%gcc@7.5.0+cpanm+shared+threads build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  53fb72w	      ^berkeley-db@18.1.40%gcc@7.5.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-ubuntu18.04-x86_64
[+]  cxcreln	      ^bzip2@1.0.8%gcc@7.5.0~debug~pic+shared build_system=generic arch=linux-ubuntu18.04-x86_64
[+]  cpmynty	      ^gdbm@1.23%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  kgyvtw5		  ^readline@8.1.2%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  k2lfw6f	  ^pkgconf@1.8.0%gcc@7.5.0 build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  optdpo7	  ^pmix@4.1.2%gcc@7.5.0~docs+pmi_backwards_compatibility~restful build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  ule2pil	      ^libevent@2.1.12%gcc@7.5.0+openssl build_system=autotools arch=linux-ubuntu18.04-x86_64
[+]  2hfr5rb	  ^zlib@1.2.13%gcc@7.5.0+optimize+pic+shared build_system=makefile arch=linux-ubuntu18.04-x86_64

==> Installing environment /home/spack/code
==> 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
$ spack remove hdf5
==> Removing hdf5 from environment /home/spack/code

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
==> Removing hdf5 from 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
  view: 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
  },
  "roots": [
    {
      "hash": "lrg5jy2ufbudxfnw3hyn7yn56abmhddl",
      "spec": "trilinos"
    },
    {
      "hash": "ilnrdw5772nw64ac6bkassqbmi7h2hgq",
      "spec": "openmpi"
    }
  ],
  "concrete_specs": {
    "lrg5jy2ufbudxfnw3hyn7yn56abmhddl": {
      "name": "trilinos",
      "version": "13.0.1",
      "arch": {
	"platform": "linux",
	"platform_os": "ubuntu18.04",
	"target": "x86_64"
      },
      "compiler": {
	"name": "gcc",
	"version": "7.5.0"
      },
      "namespace": "builtin",

While it is still readable, it consists of over 1300 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
$ spack env create concrete spack.lock
==> Updating view at /home/spack/spack/var/spack/environments/concrete/.spack-env/view
==> Created environment 'concrete' in /home/spack/spack/var/spack/environments/concrete
==> You can activate this environment with:
==>   spack env activate concrete

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:

$ spacktivate 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
==> Updating view at /home/spack/spack/var/spack/environments/concrete/.spack-env/view
==> Created environment 'concrete' in /home/spack/spack/var/spack/environments/concrete
==> You can activate this environment with:
==>   spack env activate concrete

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:

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

==> 30 installed packages
-- linux-ubuntu18.04-x86_64 / gcc@7.5.0 -------------------------
autoconf@2.69        libedit@3.1-20210216  ncurses@6.2      pmix@4.1.2
automake@1.16.5      libevent@2.1.12       numactl@2.0.14   readline@8.1
berkeley-db@18.1.40  libiconv@1.16         openblas@0.3.20  trilinos@13.0.1
bzip2@1.0.8          libpciaccess@0.16     openmpi@4.1.3    util-macros@1.19.3
cmake@3.23.1         libsigsegv@2.13       openssh@9.0p1    xz@5.2.5
diffutils@3.8        libtool@2.4.7         openssl@1.1.1o   zlib@1.2.12
gdbm@1.19            libxml2@2.9.13        perl@5.34.1
hwloc@2.7.1          m4@1.4.19             pkgconf@1.8.0

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