<commit_before>.. Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
   Spack Project Developers. See the top-level COPYRIGHT file for details.

   SPDX-License-Identifier: (Apache-2.0 OR MIT)

.. _environments-tutorial:

=====================
Environments Tutorial
=====================

We've shown you how to install and remove packages with Spack.  You can
use :ref:`cmd-spack-install` to install packages,
:ref:`cmd-spack-uninstall` to remove them, and :ref:`cmd-spack-find` to
look at and query what is installed.  We've also shown you how to
customize Spack's installation with configuration files like
:ref:`packages.yaml <build-settings>`.

If you build a lot of software, or if you work on multiple projects,
managing everything in one place can be overwhelming. The default ``spack
find`` output may contain many packages, but you may want to *just* focus
on packages for a particular project.  Moreover, you may want to include
special configuration with your package groups, e.g., to build all the
packages in the same group the same way.

Spack **environments** provide a way to handle these problems.

-------------------
Environment basics
-------------------

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

.. code-block:: console

   $ bin/spack find
   ==> 70 installed packages
   -- linux-ubuntu16.04-x86_64 / clang@3.8.0-2ubuntu4 --------------
   tcl@8.6.8  zlib@1.2.8  zlib@1.2.11

   -- linux-ubuntu16.04-x86_64 / gcc@4.7 ---------------------------
   zlib@1.2.11

   -- linux-ubuntu16.04-x86_64 / gcc@5.4.0 -------------------------
   adept-utils@1.0.1  hdf5@1.10.4          mpc@1.1.0               perl@5.26.2
   autoconf@2.69      hdf5@1.10.4          mpfr@3.1.6              pkgconf@1.4.2
   automake@1.16.1    hdf5@1.10.4          mpich@3.2.1             readline@7.0
   boost@1.68.0       hwloc@1.11.9         mpileaks@1.0            suite-sparse@5.3.0
   bzip2@1.0.6        hypre@2.15.1         mumps@5.1.1             tar@1.30
   callpath@1.0.4     hypre@2.15.1         mumps@5.1.1             tcl@8.6.8
   cmake@3.12.3       isl@0.18             ncurses@6.1             tcl@8.6.8
   diffutils@3.6      libdwarf@20180129    netcdf@4.6.1            texinfo@6.5
   dyninst@9.3.2      libiberty@2.31.1     netcdf@4.6.1            trilinos@12.12.1
   elfutils@0.173     libpciaccess@0.13.5  netlib-scalapack@2.0.2  trilinos@12.12.1
   findutils@4.6.0    libsigsegv@2.11      netlib-scalapack@2.0.2  util-macros@1.19.1
   gcc@7.2.0          libtool@2.4.6        numactl@2.0.11          xz@5.2.4
   gdbm@1.14.1        libxml2@2.9.8        openblas@0.3.3          zlib@1.2.8
   gettext@0.19.8.1   m4@1.4.18            openmpi@3.1.3           zlib@1.2.8
   glm@0.9.7.1        matio@1.5.9          openssl@1.0.2o          zlib@1.2.11
   gmp@6.1.2          matio@1.5.9          parmetis@4.0.3
   hdf5@1.10.4        metis@5.1.0          parmetis@4.0.3


This is a complete, but cluttered view.  There are packages built with
both ``openmpi`` and ``mpich``, as well as multiple variants of other<commit_msg>should not need bin prefix on spack command (#12215)<commit_after>.. Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
   Spack Project Developers. See the top-level COPYRIGHT file for details.

   SPDX-License-Identifier: (Apache-2.0 OR MIT)

.. _environments-tutorial:

=====================
Environments Tutorial
=====================

We've shown you how to install and remove packages with Spack.  You can
use :ref:`cmd-spack-install` to install packages,
:ref:`cmd-spack-uninstall` to remove them, and :ref:`cmd-spack-find` to
look at and query what is installed.  We've also shown you how to
customize Spack's installation with configuration files like
:ref:`packages.yaml <build-settings>`.

If you build a lot of software, or if you work on multiple projects,
managing everything in one place can be overwhelming. The default ``spack
find`` output may contain many packages, but you may want to *just* focus
on packages for a particular project.  Moreover, you may want to include
special configuration with your package groups, e.g., to build all the
packages in the same group the same way.

Spack **environments** provide a way to handle these problems.

-------------------
Environment basics
-------------------

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

.. code-block:: console

   $ spack find
   ==> 70 installed packages
   -- linux-ubuntu16.04-x86_64 / clang@3.8.0-2ubuntu4 --------------
   tcl@8.6.8  zlib@1.2.8  zlib@1.2.11

   -- linux-ubuntu16.04-x86_64 / gcc@4.7 ---------------------------
   zlib@1.2.11

   -- linux-ubuntu16.04-x86_64 / gcc@5.4.0 -------------------------
   adept-utils@1.0.1  hdf5@1.10.4          mpc@1.1.0               perl@5.26.2
   autoconf@2.69      hdf5@1.10.4          mpfr@3.1.6              pkgconf@1.4.2
   automake@1.16.1    hdf5@1.10.4          mpich@3.2.1             readline@7.0
   boost@1.68.0       hwloc@1.11.9         mpileaks@1.0            suite-sparse@5.3.0
   bzip2@1.0.6        hypre@2.15.1         mumps@5.1.1             tar@1.30
   callpath@1.0.4     hypre@2.15.1         mumps@5.1.1             tcl@8.6.8
   cmake@3.12.3       isl@0.18             ncurses@6.1             tcl@8.6.8
   diffutils@3.6      libdwarf@20180129    netcdf@4.6.1            texinfo@6.5
   dyninst@9.3.2      libiberty@2.31.1     netcdf@4.6.1            trilinos@12.12.1
   elfutils@0.173     libpciaccess@0.13.5  netlib-scalapack@2.0.2  trilinos@12.12.1
   findutils@4.6.0    libsigsegv@2.11      netlib-scalapack@2.0.2  util-macros@1.19.1
   gcc@7.2.0          libtool@2.4.6        numactl@2.0.11          xz@5.2.4
   gdbm@1.14.1        libxml2@2.9.8        openblas@0.3.3          zlib@1.2.8
   gettext@0.19.8.1   m4@1.4.18            openmpi@3.1.3           zlib@1.2.8
   glm@0.9.7.1        matio@1.5.9          openssl@1.0.2o          zlib@1.2.11
   gmp@6.1.2          matio@1.5.9          parmetis@4.0.3
   hdf5@1.10.4        metis@5.1.0          parmetis@4.0.3


This is a complete, but cluttered view.  There are packages built with
both ``openmpi`` and ``mpich``, as well as multiple variants of other
{'fraction_non_alphanumeric': 0.15598256095591798, 'fraction_numerical': 0.09478443403843048, 'mean_word_length': 1.9327651515151516, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1676430', 'n_tokens_mistral': 2437, 'n_tokens_neox': 2241, 'n_words': 555}