JCSDA / spack-stack

Creative Commons Zero v1.0 Universal
25 stars 44 forks source link

Lmod version in Ubuntu 22.04 breaks spack-stack modules: "attempt to call global 'depends_on' (a nil value)" #593

Closed eap closed 1 year ago

eap commented 1 year ago

TLDR:

This is a tracking bug largely to document what is now a known issue. In the immediate term we will document a workaround for this limitation for most users we will recommend the continued use of tcl based modules.

Issue description:

spack modules are authored for recent versions of lmod (7.0+) and include the depends_on directive to establish relationships between modules. Ubuntu 22.04's packaged version of lmod is 6.6 and does not include the depends_on directive. Using lmod 6.6 to load spack modules may lead to the error Unable to load module ... attempt to call global 'depends_on' (a nil value). See full output below:

$ module load stack-python
Lmod has detected the following error:  Unable to load module: python/3.10.8
     /home/ubuntu/spack-stack-1.3.1/envs/skylab-4/install/modulefiles/gcc/11.3.0/python/3.10.8.lua : [string "-- -*- lua -*-..."]:16: attempt to call global 'depends_on' (a nil value)

While processing the following module(s):
    Module fullname      Module Filename
    ---------------      ---------------
    python/3.10.8        /home/ubuntu/spack-stack-1.3.1/envs/skylab-4/install/modulefiles/gcc/11.3.0/python/3.10.8.lua
    stack-python/3.10.8  /home/ubuntu/spack-stack-1.3.1/envs/skylab-4/install/modulefiles/gcc/11.3.0/stack-python/3.10.8.lua

Verifying Ubuntu's lmod version

$ apt-cache policy lmod
lmod:
  Installed: (none)
  Candidate: 6.6-0.4
  Version table:
     6.6-0.4 500
        500 http://us-east-2.ec2.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages

Workarounds

Use tcl modules

You can do this by following the instructions for Ubuntu 20.04 LTS in the spack-stack docs. Shortly, use apt install -y environment-modules instead of lmod, and do not run the sed -i 's/tcl/lmod/g' in step 7 of "Creating a new environment".

Manually install lmod

For more info see this: https://github.com/JCSDA/spack-stack/blob/develop/configs/sites/aws-pcluster/README.md#prerequisites

climbfuji commented 1 year ago

My suggestion would be to add a condensed version of this issue to the known issues section in the documentation, and then update the section for configuring a new site accordingly so that we can close this issue.

eap commented 1 year ago

@climbfuji - Since #594 the install instructions for ubuntu are unified making the debugging notes in this issue unnecessary. In #647 I'm adding this issue to KnownIssues.rst and we can close this issue once merged.