Skip to content

Spack view

As before, the activated and installed environment has created a Spack view:

Spack view contents
[spack-python] $ ls -1 /data/scratch/${USER}/spack-environments/spack-python/.spack-env/view
bin
etc
include
lib
lib64
libexec
man
pyvenv.cfg
sbin
share

However, now that we have defined a series of environment variables in the modules > prefix_inspections: section of our spack.yaml file, they have been exported as part of activating the environment:

Spack environment variables
[spack-python] $ env | grep PATH=
PKG_CONFIG_PATH=/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/share/pkgconfig:/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/lib64/pkgconfig:/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/lib/pkgconfig
MANPATH=/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/share/man:(etc)
CMAKE_PREFIX_PATH=/data/scratch/abc123/spack-environments/spack-python/.spack-env/view
CPLUS_INCLUDE_PATH=/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/include
ACLOCAL_PATH=/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/share/aclocal
LIBRARY_PATH=/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/lib64:/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/lib
LD_LIBRARY_PATH=/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/lib64:/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/lib
PATH=/data/scratch/abc123/spack-environments/spack-python/.spack-env/view/bin:(etc)

If you recall the output of our original attempt in the Introduction, the key issue was this:

fatal error: sndfile.h: No such file or directory
        575 | #include <sndfile.h>
            |          ^~~~~~~~~~~
      compilation terminated.

If we check the include path of our view, we can see:

[spack-python] $ ls -lah /data/scratch/${USER}/spack-environments/spack-python/.spack-env/view/include/sndfile.h
lrwxrwxrwx 1 abc123 users /data/scratch/abc123/spack-environments/spack-python/.spack-env/view/include/sndfile.h -> /data/scratch/abc123/spack/apps/linux-rocky9-x86_64_v4/gcc-12.2.0/libsndfile/1.0.28-3gzwvir/include/sndfile.h

And since the include path has been exported to the common compilation environment variables $C_INCLUDE_PATH and $CPLUS_INCLUDE_PATH, we should be able to return to our pip install for sndfile.