spack icon indicating copy to clipboard operation
spack copied to clipboard

Documentation: how to create (tcl/lmod) module for a Spack environment

Open UweSauter opened this issue 4 years ago • 4 comments

Assume you have a Spack environment defined via

spack:
  concretization: together
  view: true
  packages:
    all:
      compiler: [[email protected]]
  specs:
  - package1
  - package2

What else needs to be defined so that Spack creates a (one) module that will set up the user's environment using Spack's environment's view? I don't want to generate a tcl/lmod module for each installed package, just for the Spack's environment's view.

UweSauter avatar Oct 14 '21 12:10 UweSauter

I too would appreciate such a feature but I believe it doesn't exist yet. One could easily hack together a script to create such a modulefile from the generated loads file from an environment, but Spack directly creating this file would be better.

bcdarwin avatar Oct 15 '21 17:10 bcdarwin

Especially important in light of #26804 (see workaround given there).

bcdarwin avatar Oct 18 '21 18:10 bcdarwin

I think this makes sense, especially with concretization: together.

If you don't want to wait for module files you can do spack env activate --sh > env.sh and source env.sh.

haampie avatar Oct 18 '21 18:10 haampie

Got any news on that? I'm trying to understand at what depth I need to work for a PR, and noticed this: https://github.com/spack/spack/blob/0f26931628bf6485b07ffe4611eb1ef3cec2c8c7/lib/spack/spack/hooks/module_file_generation.py#L43 Does that mean that env_write actually generate module files?

dunatotatos avatar Sep 16 '22 13:09 dunatotatos