Skip to content

In a chained environment, setup-meta-modules doesn't find python from the upstream environment #865

@srherbener

Description

@srherbener

Describe the bug

When building a chained environment and the upstream environment satisfies the python dependency, the spack stack setup-meta-modules command doesn't find the python provider for building the stack-python meta module.

To Reproduce

How I ran into this was trying to use chained environments to build a debug version of the hdf5 library so I can run the debugger on the hdf5 library code. I did the following using spack-stack-1.5.1 as the upstream environment. I did this on my arm64 based Mac, using apple-clang@14.0.3, gfortran@12.2.0 and openmpi@4.1.5.

spack stack create env --site macos.default --template empty --name spack-stack-1.5.1-debug-hdf5  --upstream $PWD/envs/spack-stack-1.5.1/install

cd envs/spack-stack-1.5.1-debug-hdf5
spack env activate .
spack add ewok-env%apple-clang@14.0.3 ^hdf5
spack add jedi-fv3-env%apple-clang@14.0.3 ^hdf5

spack concretize --force 2>&1 | tee log.concretize
../../util/show_duplicate_packages.py -d log.concretize
spack install -v 2>&1 | tee log.install

spack module lmod refresh --upstream-modules
spack stack setup-meta-modules

And the setup-meta-modules returned this:

Configuring basic directory information ...
  ... script directory: /Users/stephenh/spack-stack/spack/lib/jcsda-emc/spack-stack/stack
  ... base directory: /Users/stephenh/spack-stack/spack/lib/jcsda-emc/spack-stack
  ... spack directory: /Users/stephenh/spack-stack/spack
Configuring active spack environment ...
  ... environment directory: /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5
Parsing spack environment main config ...
  ... install directory: /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5/install
Parsing spack environment modules config ...
  ... configured to use lmod modules
  ... module directory: /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5/install/modulefiles
Parsing spack environment package config ...
  ... list of possible compilers: '['apple-clang', 'clang', 'gcc', 'intel', 'pgi', 'xl', 'nag', 'fj', 'aocc']'
  ... list of possible mpi providers: '['openmpi', 'mpich']'
['module-index.yaml', 'Core', 'apple-clang', 'openmpi']
 ... stack compilers: '{'apple-clang': ['14.0.3']}'
 ... stack mpi providers: '{'openmpi': {'4.1.5': {'apple-clang': ['14.0.3']}}}'
  ... core compilers: ['gcc@4.6']
Preparing meta module directory ...
  ... meta module directory : /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5/install/modulefiles/Core
Creating compiler modules ...
  ... configuring stack compiler apple-clang@14.0.3
  ... ... CC  : /usr/bin/clang
  ... ... CXX : /usr/bin/clang++
  ... ... F77 : /opt/homebrew/bin/gfortran
  ... ... FC' : /opt/homebrew/bin/gfortran
  ... ... COMPFLAGS: 
  ... ... MODULELOADS: 
  ... ... MODULEPREREQS: 
  ... ... MODULEPATH  : /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5/install/modulefiles/apple-clang/14.0.3
  ... writing /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5/install/modulefiles/Core/stack-apple-clang/14.0.3.lua
  ... configuring stack mpi library openmpi@4.1.5 for compiler apple-clang@14.0.3
  ... ... MODULELOADS: load("openmpi/4.1.5")
  ... ... MODULEPREREQS: prereq("openmpi/4.1.5")
  ... ... MODULEPATH  : /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5/install/modulefiles/openmpi/4.1.5/apple-clang/14.0.3
  ... writing /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5/install/modulefiles/apple-clang/14.0.3/stack-openmpi/4.1.5.lua
  ... using spack-built python version 3.10.8
 ... stack python providers: '{}'
No matching Python version found found, proceed without creating Python modules? (yes/no): yes
Metamodule generation completed successfully in /Users/stephenh/spack-stack/envs/spack-stack-1.5.1-debug-hdf5/install/modulefiles/Core

My spack.yaml file has these entries:

...
  specs:
  - ewok-env%apple-clang@14.0.3 ^hdf5
  - jedi-fv3-env%apple-clang@14.0.3 ^hdf5
  upstreams:
    install:
      install_tree: /Users/stephenh/spack-stack/envs/spack-stack-1.5.1/install
...

And I enabled the debug build of hdf5 by modifying common/packages.py:

...
    hdf5:
      version: ['1.14.0']
      variants: build_type=Debug +hl +fortran +mpi ~threadsafe +szip
...

Everything appeared to work up to the setup-meta-modules command. I think the only thing that is missing is the stack-python module lmod script.

Expected behavior
The setup-meta-modules command finds the python provided by the upstream environment and construct a stack-python lua module script accordingly.

System:
arm64 MacOS

Additional context
Add any other context about the problem here.

Metadata

Metadata

Labels

INFRAJEDI InfrastructurebugSomething is not working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions