{"id":2744,"date":"2023-06-15T12:22:21","date_gmt":"2023-06-15T19:22:21","guid":{"rendered":"https:\/\/in.nau.edu\/arc\/?page_id=2744"},"modified":"2025-03-19T09:58:44","modified_gmt":"2025-03-19T16:58:44","slug":"spack-package-installations","status":"publish","type":"page","link":"https:\/\/in.nau.edu\/arc\/spack-package-installations\/","title":{"rendered":"Spack Package Installations"},"content":{"rendered":"<!-- shortcode-right-column -->\n<div class=\"shortcode-right-column\" >\n    <div class=\"shortcode-right-column__container\"><\/p>\n<p><!-- shortcode-contact -->\n<div class=\"shortcode-contact\">\n    <div class=\"contact-header\">\n        <h3>Advanced Research Computing<\/h3>\n    <\/div>\n    <div class=\"contact-body\">\n                <a href=\"mailto:ask-arc@nau.edu\" aria-label=\"Advanced Research Computing: Email Address\" title=\"Email Address\">\n            <div class=\"contact-icon-container\">\n                <i class=\"fas fa-envelope\" aria-hidden=\"true\"><\/i>\n                <span class=\"sr-only\">Email:<\/span>\n            <\/div>\n            <div class=\"contact-email\">ask-arc&#8203;@nau.edu<\/div>\n        <\/a>\n                    <\/div>\n<\/div>\n\n<\/p>\n<p><\/div>\n<\/div>\n\n<h1>Spack Package Installations<\/h1>\n<p>Spack is a unique HPC focused package manager that allows users to install different variations of the same package which can include different versions of the package, compiler builds, dependency options and much more. Spack specs are used to download a specific package with a specific build configuration.<\/p>\n<p>More information of Spack can be accessed here at the: <a href=\"https:\/\/spack.readthedocs.io\/en\/latest\/index.html\">Spack Documentation Page<\/a> as well as the <a href=\"https:\/\/github.com\/spack\/spack\">GitHub<\/a> documentation page.<\/p>\n<h2>Loading the Spack Module<\/h2>\n<p>To use the spack command, you must first load it with the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">module load<\/span> command.<\/p>\n<pre><code>[abc123@wind ~ ]$ module load spack\r\n[abc123@wind ~ ]$ spack --version\r\n0.23.0<\/code><\/pre>\n<h2>Using Spack Packages<\/h2>\n<p>If you have installed a Spack package and are unable to use it, you may run into an error similar to this:<\/p>\n<pre><code>[abc123@wind ~ ]$ go version\r\n-bash: go: command not found<\/code><\/pre>\n<p>To use software provided by Spack, you need to load it into your environment.<\/p>\n<pre><code>[abc123@wind ~ ]$ spack load go\r\n[abc123@wind ~ ]$ go version\r\ngo version go1.23.2 linux\/amd64<\/code><\/pre>\n<h2>Listing and Searching for Spack Packages<\/h2>\n<p>To list all Spack packages that are currently installed on Monsoon, use the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack find<\/span> command.<\/p>\n<pre><code>[abc123@wind ~ ]$ spack find<\/code><\/pre>\n<p>To narrow the results to a specific package, you can specify the package name at the end of the command.<\/p>\n<pre><code>[abc123@wind ~ ]$ spack find go<\/code><\/pre>\n<p>To search for remote packages that can be installed, use the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack list<\/span> command.<\/p>\n<pre><code>[abc123@wind ~ ]$ spack list<\/code><\/pre>\n<p>You can also specify a search criteria.<\/p>\n<pre><code>[abc123@wind ~ ]$ spack list go<\/code><\/pre>\n<p><em>Note: The <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack find<\/span> and the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack list<\/span> commands can be commonly mistaken for each other.<\/em><\/p>\n<h2>Installing Spack Packages<\/h2>\n<p>Spack can be loaded as a regular module using the following command:<\/p>\n<pre><code>[abc123@wind ~ ]$ module load spack<\/code><\/pre>\n<p>Once spack is loaded, you can use the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack install\/uninstall<\/span> commands to either install specific packages with their desired specs.<\/p>\n<pre><code>[abc123@wind ~]$ spack install gzip\r\n[abc123@wind ~]$ spack uninstall gzip<\/code><\/pre>\n<p>Though packages may be installed directly with the commands shown above, <strong>some software may take up a lot of resources<\/strong>. It is recommended that users utilize the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack_install<\/span> script provided to run their installs on compute nodes to evade the potential issue of excessive resource usage on the login nodes. The <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack_install<\/span> script submits a job for the user which will install the specific packages passed into the parameters.<\/p>\n<pre><code>[abc123@wind ~]$ spack_install gzip<\/code><\/pre>\n<p><em>Note: Though the script loads the Spack module for the install, users must then manually load Spack themselves to access the software.\u00a0<\/em><\/p>\n<p>Users may specify a package by itself or provide additional specs they would like to add to the installation process. This process will then submit a job on behalf of the user and once spack in loaded, the software will be ready to be used.<\/p>\n<p>If a specific version of a package is preferred where multiple arguments are needed, enclosing the specifications into quotes allows for the install script to process everything that needs to be installed.<\/p>\n<pre><code>[abc123@wind ~]$ .\/spack_install \"py-mpi4py ^python@3.9\"\r\nInput spec\r\n--------------------------------\r\n- py-mpi4py\r\n- ^python@3.9\r\nConcretized\r\n--------------------------------\r\n- py-mpi4py@3.1.4%gcc@8.5.0 build_system=python_pip arch=linux-rhel8-x86_64_v 2<\/code><\/pre>\n<p>The user may also specify a node they want their installation to run on using the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">-n<\/span> flag with the node name following.<\/p>\n<pre><code>[abc123@wind ~]$ .\/spack_install gzip -n cn32<\/code><\/pre>\n<h2>Additional Spack Commands<\/h2>\n<p>After the desired package is installed users may find these commands helpful with managing specific packages.<\/p>\n<p>To install a package, use the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack install<\/span> command (see spack_install script above)<\/p>\n<pre><code>[abc123@wind ~]$ spack install gzip\r\n==&gt; Installing gzip-1.12-aaksfrav72c234tchtdw5pf57l4ckl2a\r\n==&gt; gzip: Successfully installed gzip-1.12-aaksfrav72c234tchtdw5pf57l4ckl2a<\/code><code><\/code><\/pre>\n<p>To see the specific build configurations of a package, use the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack spec<\/span> command:<\/p>\n<pre><code>[abc123@wind ~]$ spack spec gzip\r\nInput spec\r\n--------------------------------\r\n -   gzip\r\n\r\nConcretized\r\n--------------------------------\r\n -   gzip@1.13%gcc@8.5.0 build_system=autotools arch=linux-rhel8-x86_64_v2\r\n[^]      ^gcc-runtime@8.5.0%gcc@8.5.0 build_system=generic arch=linux-rhel8-x86_64_v2\r\n[e]      ^glibc@2.28%gcc@8.5.0 build_system=autotools arch=linux-rhel8-x86_64_v2\r\n[^]      ^gmake@4.4.1%gcc@8.5.0~guile build_system=generic arch=linux-rhel8-x86_64_v2<\/code><\/pre>\n<p>To see more information about a package, use the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack info<\/span> command:<\/p>\n<pre><code>[abc123@wind ~]$ spack info gzip\r\nAutotoolsPackage: gzip\r\nDescription:\r\nGNU Gzip is a popular data compression program originally written by\r\nJean-loup Gailly for the GNU project.<\/code><\/pre>\n<p>To check what packages are currently installed in the active environment, use the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack find<\/span> command:<\/p>\n<pre><code>[abc123@wind ~]$ spack find gzip\r\n-- linux-rhel8-x86_64_v2 \/ gcc@8.5.0 ----------------------------\r\ngzip@1.12\r\n==&gt; 1 installed package<\/code><\/pre>\n<h2>Spack Environments<\/h2>\n<p>Spack environments allows for users to work with different packages separately. Unlike Conda environments, Spack environments <a href=\"https:\/\/spack.readthedocs.io\/en\/latest\/environments.html\">are not isolated<\/a>.<\/p>\n<p>You can create a spack environment using the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack env create<\/span> command:<\/p>\n<pre><code>[abc123@wind ~]$ spack env create -d .\/mydir\r\n==&gt; Created environment in \/home\/abc123\/mydir\r\n==&gt; You can activate this environment with:\r\n==&gt; spack env activate \/home\/abc123\/mydir<\/code><\/pre>\n<p>Once the environment is created, activate it with the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack activate<\/span> command:<\/p>\n<pre><code>[abc123@wind ~]$ spack env activate \/home\/abc123\/mydir<\/code><\/pre>\n<p>Additionally, you can deactivate an environment with the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack deactivate<\/span> command:<\/p>\n<pre><code>[abc123@wind ~]$ spack env deactivate<\/code><\/pre>\n<p>An abstract spec is only a partially specified configuration of a package. This means that the spec can potentially be used to describe multiple builds of the same package. Abstract specs are useful because the user is able to add these spack to an environment without installing them. The <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack add<\/span> command is environmentally sensitive, meaning the spec will only be added to the current environment.<\/p>\n<pre><code>[abc123@wind ~\/mydir]$ spack add gzip\r\n==&gt; Adding gzip to environment \/home\/abc123\/mydir<\/code><\/pre>\n<p>Even though the specs have been added to an environment with spack add, they are still unable to be processed and installed. The spec has to complete the previous partially specified build of the package (when spack add was used). This can be done with the a process called <a class=\"reference internal\" href=\"https:\/\/spack.readthedocs.io\/en\/latest\/environments.html#environments-concretization-config\"><span class=\"std std-ref\">concretization<\/span><\/a>, and can be accessed by using the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack concretize<\/span> command:<\/p>\n<pre><code>[abc123@wind ~\/mydir]$ spack concretize\r\n==&gt; Concretized gzip\r\n[+] aaksfra gzip@1.12%gcc@8.5.0 build_system=autotools arch=linux-rhel8-x86_64_v2\r\n\r\n==&gt; Updating view at \/home\/abc123\/mydir\/.spack-env\/view<\/code><\/pre>\n<p>Once the package has been added and concretized, it is ready to be installed. Using the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack find<\/span> command with the <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">-c<\/span> flag, it can be seen that the specific package has gained all its required dependencies but it still not actively installed into the environment.<\/p>\n<pre><code>$ spack find -c\r\n==&gt; In environment \/home\/abc123\/mydir\r\n==&gt; Root specs\r\nip\r\n\r\n==&gt; Concretized roots\r\n-- linux-rhel8-x86_64_v2 \/ gcc@8.5.0 ----------------------------\r\nip@3.3.3\r\n\r\n==&gt; 0 installed packages<\/code><\/pre>\n<p>The <span style=\"font-size: 16px; font-family: monospace; border: 1px solid; border-radius: 4px; padding: 0px 4px 0px; border-color: #BBBBBB;\" data-darkreader-inline-border-top=\"\" data-darkreader-inline-border-right=\"\" data-darkreader-inline-border-bottom=\"\" data-darkreader-inline-border-left=\"\">spack install<\/span> command allows spack to install the packages added and concretized in your environment. This will install the desired package plus any dependencies it might of required. Running the spack find command again after the installation will give you everything you have now installed into your environment.<\/p>\n<pre><code>$ spack install\r\n==&gt; Installing environment \/home\/abc123\/mydir<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spack Package Installations Spack is a unique HPC focused package manager that allows users to install different variations of the same package which can include different versions of the package, compiler builds, dependency options and much more. Spack specs are used to download a specific package with a specific build configuration. More information of Spack [&hellip;]<\/p>\n","protected":false},"author":1963,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_relevanssi_hide_post":"","_relevanssi_hide_content":"","_relevanssi_pin_for_all":"","_relevanssi_pin_keywords":"","_relevanssi_unpin_keywords":"","_relevanssi_related_keywords":"","_relevanssi_related_include_ids":"","_relevanssi_related_exclude_ids":"","_relevanssi_related_no_append":"","_relevanssi_related_not_related":"","_relevanssi_related_posts":"","_relevanssi_noindex_reason":"","ring_central_script_selection":"","footnotes":""},"class_list":["post-2744","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/pages\/2744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/users\/1963"}],"replies":[{"embeddable":true,"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/comments?post=2744"}],"version-history":[{"count":99,"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/pages\/2744\/revisions"}],"predecessor-version":[{"id":3777,"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/pages\/2744\/revisions\/3777"}],"wp:attachment":[{"href":"https:\/\/in.nau.edu\/arc\/wp-json\/wp\/v2\/media?parent=2744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}