Installing a personal version of Nano¶
Now, as a simple example, let's imagine for some reason you specifically need an
older version of the nano
text editor, you've requested it from the ITSR Apps
Team and they have rejected your request as demand is low (which is very likely
what would happen). First, let's look at the available version in upstream:
spack find
output
$ spack -C ${HOME}/spack-config-templates/0.22.0 find -x -p nano
-- linux-rocky9-x86_64_v4 / gcc@12.2.0 --------------------------
nano@7.2 /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nano/7.2-4ew6nde
==> 1 installed package
$ module avail -l nano
- Package/Alias -----------------------.- Versions --------
/share/apps/rocky9/environmentmodules/apocrita-modules/spack:
nano/7.2-gcc-12.2.0
We can see that v7.2
of nano
is already installed centrally. Let's see
what other versions might be available:
spack info
output
$ spack -C ${HOME}/spack-config-templates/0.22.0 info nano
AutotoolsPackage: nano
Description:
Tiny little text editor
Homepage: https://www.nano-editor.org
Preferred version:
7.2 https://www.nano-editor.org/dist/v7/nano-7.2.tar.xz
Safe versions:
7.2 https://www.nano-editor.org/dist/v7/nano-7.2.tar.xz
6.3 https://www.nano-editor.org/dist/v6/nano-6.3.tar.xz
(etc.)
Always run a spec
command before install
!
You should always check what is about to be installed using the spec
command as detailed below and then move onto the install
command.
And let's see if we can
spec
a personal installation of v6.3
:
spack spec
output
$ spack -C ${HOME}/spack-config-templates/0.22.0 spec nano@6.3
Input spec
--------------------------------
- nano@6.3
Concretized
--------------------------------
- nano@6.3%gcc@12.2.0 build_system=autotools arch=linux-rocky9-x86_64_v4
[^] ^gcc-runtime@12.2.0%gcc@12.2.0 build_system=generic arch=linux-rocky9-x86_64_v4
[e] ^glibc@2.34%gcc@11.4.1 build_system=autotools arch=linux-rocky9-x86_64_v4
[^] ^gmake@4.4.1%gcc@11.4.1~guile build_system=generic arch=linux-rocky9-x86_64_v4
[^] ^gcc-runtime@11.4.1%gcc@11.4.1 build_system=generic arch=linux-rocky9-x86_64_v4
[^] ^ncurses@6.5%gcc@11.4.1~symlinks+termlib abi=none build_system=autotools patches=7a351bc arch=linux-rocky9-x86_64_v4
[^] ^pkgconf@2.2.0%gcc@11.4.1 build_system=autotools arch=linux-rocky9-x86_64_v4
To explain the symbols in the above output:
-
means that the listed application/library is not installed anywhere at all, neither in upstream or personally[^]
means that the listed application/library is already installed in upstream and will be used to avoid re-installation[e]
means that the listed application/library is marked as external.glibc
is always marked as external and is provided from the compute node installation of Rocky 9 Linux because otherwise major issues can occur. It is also possible to define additional external packages in your custom packages.yaml should you wish.
So, let's follow through and install nano
v6.3
. I am using -j ${NSLOTS}
to
match the number of compilation threads used to the core request for the qlogin
session:
spack install
output
$ spack -C ${HOME}/spack-config-templates/0.22.0 install -j ${NSLOTS} nano@6.3
[+] /usr (external glibc-2.34-xri56vcyzs7kkvakhoku3fefc46nw25y)
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gcc-runtime/11.4.1-llid4hw
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/gcc-runtime/12.2.0-w77gg5r
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/gmake/4.4.1-xchit5a
[+] /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-11.4.1/ncurses/6.5-4n2uzha
==> Installing nano-6.3-m7n4nhp5wbd3qzc67f5jzapsp4vlsthh [6/6]
==> No binary for nano-6.3-m7n4nhp5wbd3qzc67f5jzapsp4vlsthh found: installing from source
==> Fetching https://mirror.spack.io/_source-cache/archive/eb/eb532da4985672730b500f685dbaab885a466d08fbbf7415832b95805e6f8687.tar.xz
==> No patches needed for nano
==> nano: Executing phase: 'autoreconf'
==> nano: Executing phase: 'configure'
==> nano: Executing phase: 'build'
==> nano: Executing phase: 'install'
==> nano: Successfully installed nano-6.3-m7n4nhp5wbd3qzc67f5jzapsp4vlsthh
Stage: 1.57s. Autoreconf: 0.00s. Configure: 39.08s. Build: 2.17s. Install: 1.16s. Post-install: 0.65s. Total: 44.99s
[+] /data/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nano/6.3-m7n4nhp
To break down what has happened above:
- The existing available upstream dependencies have been used from the central location as opposed to reinstalled
- Spack has noticed that the
nano
v6.3
is missing and has thus pulled down a source code tarball to thesource_cache
directory defined inconfig.yaml
and then manually compiled it and installed it to the location defined asinstall_tree:
root:
inconfig.yaml
.
Let's now return to our spack find
command:
spack find
output
$ spack -C ${HOME}/spack-config-templates/0.22.0 find -x -p nano
-- linux-rocky9-x86_64_v4 / gcc@12.2.0 --------------------------
nano@6.3 /data/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nano/6.3-m7n4nhp
nano@7.2 /share/apps/rocky9/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nano/7.2-4ew6nde
==> 2 installed packages
So now we have nano
v6.3
installed personally, and v7.2
in upstream. If we run our spec
command again:
spack spec output
$ spack -C ${HOME}/spack-config-templates/0.22.0 spec nano@6.3
Input spec
--------------------------------
- nano@6.3
Concretized
--------------------------------
[+] nano@6.3%gcc@12.2.0 build_system=autotools arch=linux-rocky9-x86_64_v4
[^] ^gcc-runtime@12.2.0%gcc@12.2.0 build_system=generic arch=linux-rocky9-x86_64_v4
[e] ^glibc@2.34%gcc@11.4.1 build_system=autotools arch=linux-rocky9-x86_64_v4
[^] ^gmake@4.4.1%gcc@11.4.1~guile build_system=generic arch=linux-rocky9-x86_64_v4
[^] ^gcc-runtime@11.4.1%gcc@11.4.1 build_system=generic arch=linux-rocky9-x86_64_v4
[^] ^ncurses@6.5%gcc@11.4.1~symlinks+termlib abi=none build_system=autotools patches=7a351bc arch=linux-rocky9-x86_64_v4
[^] ^pkgconf@2.2.0%gcc@11.4.1 build_system=autotools arch=linux-rocky9-x86_64_v4
We can see that nano@6.3
is marked with a [+]
which means it is already
installed in the install_tree:
root:
for this custom configuration scope
(as opposed to [^]
which means it is already installed upstream).
If we now add our specified private module path using module use
as specified
in modules.yaml
:
module use /data/scratch/${USER}/spack/privatemodules/linux-rocky9-x86_64_v4
Then we should see our personal version available for use:
Output from module avail
$ module avail -l nano
- Package/Alias -----------------------.- Versions --------
/data/scratch/abc123/spack/privatemodules/linux-rocky9-x86_64_v4:
nano/6.3-gcc-12.2.0
/share/apps/rocky9/environmentmodules/apocrita-modules/spack:
nano/7.2-gcc-12.2.0
And indeed, we can load and use our personal version (use the full module name):
Output from module load
$ module load nano/6.3-gcc-12.2.0
$ which nano
/data/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/nano/6.3-m7n4nhp/bin/nano
$ nano --version
GNU nano, version 6.3
(C) 1999-2011, 2013-2022 Free Software Foundation, Inc.
(C) 2014-2022 the contributors to nano
Compiled options: --disable-libmagic --enable-utf8