Newer
Older
# Spack
Spack is a package manager for supercomputers, Linux, and macOS. It makes installing scientific software easy. With Spack, you can build a package with multiple versions, configurations, platforms, and compilers, and all of these builds can coexist on the same machine.
Homepage: [https://spack.io/](https://spack.io/)
Documentation: [https://spack.readthedocs.io/en/latest/](https://spack.readthedocs.io/en/latest/)
## Spack On IT4Innovations Clusters
```console
~]$ ml av Spack
---------------------- /apps/modules/devel ------------------------------
Spack/default
```
!!! note
Spack/default is rule for setting up local installation
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
## First Usage Module Spack/default
The Spack will be installed into your /home, create folder Spack for installing software and set the configuration into ~/.spack/configure.yml
```console
~]$ ml Spack
== Settings for first use
Couldn't import dot_parser, loading of dot files will not be possible.
== temporary log file in case of crash /tmp/eb-wLh1RT/easybuild-54vEn3.log
== processing EasyBuild easyconfig /apps/easybuild/easyconfigs-it4i/s/Spack/Spack-0.10.0.eb
== building and installing Spack/0.10.0...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== cleaning up...
== creating module...
== permissions...
== packaging...
== COMPLETED: Installation ended successfully
== Results of the build can be found in the log file(s) ~/.local/easybuild/software/Spack/0.10.0/easybuild/easybuild-Spack-0.10.0-20170707.122650.log
== Build succeeded for 1 out of 1
== Temporary log file(s) /tmp/eb-wLh1RT/easybuild-54vEn3.log* have been removed.
== Temporary directory /tmp/eb-wLh1RT has been removed.
== Create folder ~/Spack
The following have been reloaded with a version change:
1) Spack/default => Spack/0.10.0
~]$ spack --version
0.10.0
```
## Usage Module Spack/default
```console
~]$ ml Spack
The following have been reloaded with a version change:
1) Spack/default => Spack/0.10.0
~]$ spack --version
0.10.0
```
## Build Software Package
### Search For Available Software
To install software with Spack, you need to know what software is available. Using the `spack list` command.
```console
~]$ spack list
==> 1114 packages.
abinit font-bh-100dpi libffi npm py-ply r-maptools tetgen
ack font-bh-75dpi libfontenc numdiff py-pmw r-markdown tethex
activeharmony font-bh-lucidatypewriter-100dpi libfs nwchem py-prettytable r-mass texinfo
adept-utils font-bh-lucidatypewriter-75dpi libgcrypt ocaml py-proj r-matrix texlive
adios font-bh-ttf libgd oce py-prompt-toolkit r-matrixmodels the-platinum-searcher
adol-c font-bh-type1 libgpg-error oclock py-protobuf r-memoise the-silver-searcher
allinea-forge font-bitstream-100dpi libgtextutils octave py-psutil r-mgcv thrift
allinea-reports font-bitstream-75dpi libhio octave-splines py-ptyprocess r-mime tinyxml
ant font-bitstream-speedo libice octopus py-pudb r-minqa tinyxml2
antlr font-bitstream-type1 libiconv ompss py-py r-multcomp tk
ape font-cronyx-cyrillic libint ompt-openmp py-py2cairo r-munsell tmux
apex font-cursor-misc libjpeg-turbo opari2 py-py2neo r-mvtnorm tmuxinator
applewmproto font-daewoo-misc libjson-c openblas py-pychecker r-ncdf4 transset
appres font-dec-misc liblbxutil opencoarrays py-pycodestyle r-networkd3 trapproto
apr font-ibm-type1 libmesh opencv py-pycparser r-nlme tree
...
```
#### Specify Software Version (for package)
To see more available versions of a package, run `spack versions`.
```console
~]$ spack versions git
==> Safe versions (already checksummed):
2.11.0 2.9.3 2.9.2 2.9.1 2.9.0 2.8.4 2.8.3 2.8.2 2.8.1 2.8.0 2.7.3 2.7.1
==> Remote versions (not yet checksummed):
Found no versions for git
```
## Graph For Software Package
Spack provides the `spack graph` command for graphing dependencies. The command by default generates an ASCII rendering of a spec’s dependency graph.
```console
~]$ spack graph git
o git
|\
| |\
| | |\
| | | |\
| | | | |\
| | | | | |\
| | | | | | |\
| | | | | | | |\
| | | | | | | o | curl
| |_|_|_|_|_|/| |
|/| | | |_|_|/ /
| | | |/| | | |
| | | o | | | | openssl
| |_|/ / / / /
|/| | | | | |
| | | | o | | gettext
| | | | |\ \ \
| | | | | |\ \ \
| | | | | | |\ \ \
| | | | | | | |\ \ \
| | | | | | | o | | | libxml2
| |_|_|_|_|_|/| | | |
|/| | | | |_|/| | | |
| | | | |/| | | | | |
o | | | | | | | | | | zlib
/ / / / / / / / / /
| | | o | | | | | | xz
| | | / / / / / /
| | | o | | | | | tar
| | | / / / / /
| | | | o | | | pkg-config
| | | | / / /
o | | | | | | perl
/ / / / / /
o | | | | | pcre
/ / / / /
| o | | | ncurses
| / / /
| | | o autoconf
| | | o m4
| | | o libsigsegv
| | |
o | | libiconv
/ /
| o expat
|
o bzip2
```
### Information For Software Package
To get more information on a particular package from `spack list`, use `spack info`.
```console
~]$ spack info git
Package: git
Homepage: http://git-scm.com
Safe versions:
2.11.0 https://github.com/git/git/tarball/v2.11.0
2.9.3 https://github.com/git/git/tarball/v2.9.3
2.9.2 https://github.com/git/git/tarball/v2.9.2
2.9.1 https://github.com/git/git/tarball/v2.9.1
2.9.0 https://github.com/git/git/tarball/v2.9.0
2.8.4 https://github.com/git/git/tarball/v2.8.4
2.8.3 https://github.com/git/git/tarball/v2.8.3
2.8.2 https://github.com/git/git/tarball/v2.8.2
2.8.1 https://github.com/git/git/tarball/v2.8.1
2.8.0 https://github.com/git/git/tarball/v2.8.0
2.7.3 https://github.com/git/git/tarball/v2.7.3
2.7.1 https://github.com/git/git/tarball/v2.7.1
Variants:
None
Installation Phases:
install
Build Dependencies:
autoconf curl expat gettext libiconv openssl pcre perl zlib
Link Dependencies:
curl expat gettext libiconv openssl pcre perl zlib
Run Dependencies:
None
Virtual Packages:
None
Description:
Git is a free and open source distributed version control system
designed to handle everything from small to very large projects with
speed and efficiency.
```
### Install Software Package
`spack install` will install any package shown by `spack list`. For example, To install the latest version of the `git` package, you might type this.
Use `spack install git` for default version or `spack install git@version`.
```console
~]$ spack install git@2.11.0
==> Installing git
==> Installing pcre
==> Fetching http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.bz2
...
```
!!! warning
`ftp` on cluster is not allowed, you must edit source link (edit)[#Edit Rule]
### Edit Rule
```console
~]$ spack edit git
```
!!! note
For change source link (ftp:// to http://) use `spack create URL -f`. Automatically generates rules.
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
**Example**
```console
~]$ spack install git
==> Installing git
==> Installing pcre
==> Fetching ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.bz2
curl: (7) couldn't connect to host
==> Fetching from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.bz2 failed.
==> Error: FetchError: All fetchers failed for pcre-8.39-bm3lumpbghly2l7bkjsi4n2l3jyam6ax
...
~]$ spack create http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.bz2 -f
==> This looks like a URL for pcre
==> Found 2 versions of pcre:
8.41 http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.bz2
8.40 http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.bz2
How many would you like to checksum? (default is 1, q to abort) 1
==> Downloading...
==> Fetching http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.bz2
######################################################################## 100,0%
==> Checksummed 1 version of pcre
==> This package looks like it uses the cmake build system
==> Created template for pcre package
==> Created package file: ~/.local/easybuild/software/Spack/0.10.0/var/spack/repos/builtin/packages/pcre/package.py
~]$
~]$ spack install git
==> Installing git
==> Installing pcre
==> Installing cmake
==> Installing ncurses
==> Fetching http://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz
######################################################################## 100,0%
...
```
## Available Spack Module
We know that `spack list` shows you the names of available packages, but how do you figure out which are already installed?
```console
==> 19 installed packages.
-- linux-centos6-x86_64 / gcc@4.4.7 -----------------------------
autoconf@2.69 cmake@3.7.1 expat@2.2.0 git@2.11.0 libsigsegv@2.10 m4@1.4.17 openssl@1.0.2j perl@5.24.0 tar@1.29 zlib@1.2.10
bzip2@1.0.6 curl@7.50.3 gettext@0.19.8.1 libiconv@1.14 libxml2@2.9.4 ncurses@6.0 pcre@8.41 pkg-config@0.29.1 xz@5.2.2
```
**Spack colorizes output**
```console
~]$ spack find | less -R
```
`spack find` shows the specs of installed packages. A spec is like a name, but it has a version, compiler, architecture, and build options associated with it. In spack, you can have many installations of the same package with different specs.
## Load And Unload Module
Neither of these is particularly pretty, easy to remember, or easy to type. Luckily, Spack has its own interface for using modules and dotkits.
```console
~]$ spack load git
==> This command requires spack's shell integration.
To initialize spack's shell commands, you must run one of
the commands below. Choose the right command for your shell.
For bash and zsh:
. ~/.local/easybuild/software/Spack/0.10.0/share/spack/setup-env.sh
For csh and tcsh:
setenv SPACK_ROOT ~/.local/easybuild/software/Spack/0.10.0
source ~/.local/easybuild/software/Spack/0.10.0/share/spack/setup-env.csh
```
**First usage**
```console
~]$ . ~/.local/easybuild/software/Spack/0.10.0/share/spack/setup-env.sh
```
```console
~]$ git version 1.7.1
~]$ spack load git
~]$ git --version
git version 2.11.0
~]$ spack unload git
~]$ git --version
git version 1.7.1
```
## Uninstall Software Package
Spack will ask you either to provide a version number to remove the ambiguity or use the `--all` option to uninstall all of the matching packages.
You may force uninstall a package with the `--force` option
``console
~]$ spack uninstall git
==> The following packages will be uninstalled :
-- linux-centos6-x86_64 / gcc@4.4.7 -----------------------------
xmh3hmb git@2.11.0%gcc
==> Do you want to proceed ? [y/n]
y
==> Successfully uninstalled git@2.11.0%gcc@4.4.7 arch=linux-centos6-x86_64 -xmh3hmb
```