Skip to content

install_cuda_and_libraries.sh broken due to LAMMPS pre_run_shell_cmd_hook #213

@casparvl

Description

@casparvl

An error occurs in the sanity check step where EasyBuild tries to load the module:

== 2026-04-16 15:25:01,623 build_log.py:233 ERROR EasyBuild encountered an error: $EESSI_SOFTWARE_SUBDIR is not defined! (at easybuild/eb_hooks.py:231 in get_eessi_envvar)
Callstack:
        easybuild/eb_hooks.py:231 in get_eessi_envvar
        easybuild/eb_hooks.py:1933 in pre_run_shell_cmd_hook
        easybuild/tools/hooks.py:253 in run_hook
        easybuild/tools/run.py:436 in run_shell_cmd
        easybuild/tools/run.py:191 in cache_aware_func
        easybuild/tools/modules.py:1266 in run_module
        easybuild/tools/modules.py:1131 in load
        easybuild/framework/easyblock.py:1879 in load_module
        easybuild/framework/easyblock.py:1909 in load_fake_module
        easybuild/framework/easyblock.py:4282 in sanity_check_load_module
        easybuild/framework/easyblock.py:4356 in _sanity_check_step
        easybuild/framework/easyblock.py:3397 in _dispatch_sanity_check_step
        easybuild/framework/easyblock.py:3409 in sanity_check_step
        easybuild/easyblocks/c/cuda.py:356 in sanity_check_step
        easybuild/framework/easyblock.py:4763 in run_step
        easybuild/framework/easyblock.py:4922 in run_all_steps
        easybuild/framework/easyblock.py:5109 in build_and_install_one
        easybuild/main.py:178 in build_and_install_software
        easybuild/main.py:611 in process_eb_args
        easybuild/main.py:331 in process_easystack
        easybuild/main.py:793 in main
        easybuild/main.py:844 in main_with_hooks
        easybuild/main.py:859 in <module>

For some reason, all of the EESSI variables are cleared from the module load step in the sanity check, something that doesn't happen if you just install with EESSI-extend in the homedir.

== 2026-04-22 10:55:59,931 hooks.py:218 INFO Found pre_run_shell_cmd_hook hook
== 2026-04-22 10:55:59,933 hooks.py:252 INFO Running 'pre_run_shell_cmd_hook' hook function (args: [['/cvmfs/software.eessi.io
/versions/2025.06/compat/linux/x86_64/usr/share/Lmod/libexec/lmod', 'python', 'use', '--priority', '10000', '/tmp/eb-05if15xt/
eb-8evbtp_o/tmpr_58gs1m/all/']], keyword args: {'interactive': False, 'work_dir': '/tmp/tmp.tWcHRGC9DD/build/CUDA/12.6.0/system-system', 'fail_on_error': False, 'hidden': True})...
== 2026-04-22 10:55:59,933 run.py:518 INFO Running '/cvmfs/software.eessi.io/versions/2025.06/compat/linux/x86_64/usr/share/Lm
od/libexec/lmod ...' command in /tmp/tmp.tWcHRGC9DD/build/CUDA/12.6.0/system-system:
        /cvmfs/software.eessi.io/versions/2025.06/compat/linux/x86_64/usr/share/Lmod/libexec/lmod python use --priority 10000
/tmp/eb-05if15xt/eb-8evbtp_o/tmpr_58gs1m/all/
== 2026-04-22 10:56:00,008 run.py:632 INFO '/cvmfs/software.eessi.io/versions/2025.06/compat/linux/x86_64/usr/share/Lmod/libexec/lmod ...' command completed successfully
== 2026-04-22 10:56:00,008 run.py:634 INFO Output of '/cvmfs/software.eessi.io/versions/2025.06/compat/linux/x86_64/usr/share/
Lmod/libexec/lmod ...' command (stdout only):
import os
os.environ["__LMOD_REF_COUNT_CMAKE_PREFIX_PATH"] = ''
del os.environ["__LMOD_REF_COUNT_CMAKE_PREFIX_PATH"]
os.environ["CMAKE_PREFIX_PATH"] = ''
del os.environ["CMAKE_PREFIX_PATH"]
os.environ["EASYBUILD_ALLOW_LOADED_MODULES"] = ''
del os.environ["EASYBUILD_ALLOW_LOADED_MODULES"]
os.environ["EASYBUILD_CUDA_SANITY_CHECK_ERROR_ON_FAILED_CHECKS"] = ''
del os.environ["EASYBUILD_CUDA_SANITY_CHECK_ERROR_ON_FAILED_CHECKS"]
os.environ["EASYBUILD_DEBUG"] = ''
...
os.environ["EESSI_SITE_SOFTWARE_PATH"] = ''
del os.environ["EESSI_SITE_SOFTWARE_PATH"]
os.environ["EESSI_SOFTWARE_LAYER_VERSION_SUFFIX"] = ''
del os.environ["EESSI_SOFTWARE_LAYER_VERSION_SUFFIX"]
os.environ["EESSI_SOFTWARE_PATH"] = ''
del os.environ["EESSI_SOFTWARE_PATH"]
os.environ["EESSI_SOFTWARE_SUBDIR"] = ''
del os.environ["EESSI_SOFTWARE_SUBDIR"]
os.environ["EESSI_VERSION"] = ''
del os.environ["EESSI_VERSION"]
...

Anyway, the pre_run_shell_cmd_hook here causes the error to be raised. A pre_run_shell_cmd hook is rather inconvenient in any case, since it is triggered every time - even when it's completely irrelevant, as it is in the case of running install_cuda_and_libraries.sh. This PR https://github.com/EESSI/software-layer-scripts/pull/211/changes solves the original LAMMPS issue as well, and should also make sure that this current issue does not pop up again as the hook will now only be triggered on LAMMPS installations (and not on every installation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions