cea-hpc / modules

Environment Modules: provides dynamic modification of a user's environment
http://modules.sourceforge.net/
GNU General Public License v2.0
668 stars 102 forks source link

Loading module in fish shell prints commands to stdout #508

Closed helmutcarter closed 9 months ago

helmutcarter commented 10 months ago

Describe the bug

When I try to load a module in fish, it ostensibly print the commands it should run to stdout.

To Reproduce

Steps to reproduce the behavior:

$ modulecmd fish load python/2.7.18

Location and content of any modulerc or modulefile involved:

$ cat /home/helmut/modulefiles

Expected behavior

I expect the python2 module to be loaded. I have no issue when I do this in bash. This also happens with other module files in fish for me.

Error and debugging information

$ modulecmd fish --debug load python/2.7.18 
DEBUG CALLING /cm/local/apps/environment-modules/4.5.3//libexec/modulecmd.tcl fish --debug load python/2.7.18
DEBUG setConf: tcl_ext_lib set to '/cm/local/apps/environment-modules/4.5.3//lib/libtclenvmodules.so'
DEBUG Load Tcl extension library (/cm/local/apps/environment-modules/4.5.3//lib/libtclenvmodules.so)
DEBUG setConf: siteconfig set to '/cm/local/apps/environment-modules/4.5.3//etc/siteconfig.tcl'
DEBUG sourceSiteConfig: Source site configuration (/cm/local/apps/environment-modules/4.5.3//etc/siteconfig.tcl)
DEBUG setConf: locked_configs set to ''
DEBUG setConf: pager set to '/usr/bin/less -eFKRX'
DEBUG initPager: start pager (asked_use_pager=-, cmd='/usr/bin/less -eFKRX')
DEBUG setConf: verbosity set to 'debug'
DEBUG setConf: term_background set to 'dark'
DEBUG setConf: colors set to 'hi=1:db=2:se=2:er=91:wa=93:me=95:in=94:mp=1;94:di=94:al=96:sy=95:de=4:cm=92'
DEBUG setConf: color set to '0'
DEBUG module: cmd='load', args='python/2.7.18'
DEBUG setConf: avail_indepth set to '1'
:set -xg CPATH /home/helmut/programs/Python-2.7.18/Include:/cm/shared/apps/slurm/current/include;
set -xg LD_LIBRARY_PATH /home/helmut/programs/Python-2.7.18/Lib:/cm/shared/apps/slurm/current/lib64/slurm:/cm/shared/apps/slurm/current/lib64:/cm/local/apps/gcc/11.2.0/lib:/cm/local/apps/gcc/11.2.0/lib64:/cm/local/apps/gcc/11.2.0/lib32;
set -xg LIBRARY_PATH /home/helmut/programs/Python-2.7.18/Lib:/cm/shared/apps/slurm/current/lib64/slurm:/cm/shared/apps/slurm/current/lib64;
set -xg MANPATH /home/helmut/programs/Python-2.7.18/Misc/python.man:/cm/shared/apps/slurm/current/man:/cm/local/apps/environment-modules/4.5.3//share/man:/usr/local/share/man:/usr/share/man:/cm/local/apps/environment-modules/current/share/man:/cm/local/apps/environment-modules/current/share/man:/cm/local/apps/environment-modules/current/share/man;
set -xg _LMFILES_ /cm/local/modulefiles/gcc/11.2.0:/cm/local/modulefiles/slurm/water/21.08.8:/home/helmut/modulefiles/python/2.7.18;
set -xg LOADEDMODULES gcc/11.2.0:slurm/water/21.08.8:python/2.7.18;
set -xg LIBRARY_PATH_modshare /cm/shared/apps/slurm/current/lib64:1:/home/helmut/programs/Python-2.7.18/Lib:1:/cm/shared/apps/slurm/current/lib64/slurm:1;
set -xg MANPATH_modshare /usr/local/share/man:1:/cm/local/apps/environment-modules/4.5.3//share/man:1:/cm/local/apps/environment-modules/current/share/man:1:/home/helmut/programs/Python-2.7.18/Misc/python.man:1:/usr/share/man:1:/cm/shared/apps/slurm/current/man:1;
set -xg CPATH_modshare /home/helmut/programs/Python-2.7.18/Include:1:/cm/shared/apps/slurm/current/include:1;
set -xg LD_LIBRARY_PATH_modshare /cm/shared/apps/slurm/current/lib64:1:/cm/local/apps/gcc/11.2.0/lib:1:/home/helmut/programs/Python-2.7.18/Lib:1:/cm/shared/apps/slurm/current/lib64/slurm:1:/cm/local/apps/gcc/11.2.0/lib32:1:/cm/local/apps/gcc/11.2.0/lib64:1;
set -xg _LMFILES__modshare /home/helmut/modulefiles/python/2.7.18:1:/cm/local/modulefiles/gcc/11.2.0:1:/cm/local/modulefiles/slurm/water/21.08.8:1;
set -xg LOADEDMODULES_modshare gcc/11.2.0:1:python/2.7.18:1:slurm/water/21.08.8:1;
set -xg PATH /home/helmut/programs/Python-2.7.18 /home/helmut/.local/bin /cm/local/apps/environment-modules/4.5.3/bin /home/helmut/.vscode-server/bin/6c3e3dba23e8fadc360aed75ce363ba185c49794/bin/remote-cli /cm/local/apps/environment-modules/4.5.3/bin /home/helmut/programs/anaconda3/bin /home/helmut/programs/anaconda3/condabin /home/helmut/.cargo/bin /cm/shared/apps/slurm/current/sbin /cm/shared/apps/slurm/current/bin /cm/local/apps/gcc/11.2.0/bin /home/helmut/bin /cm/local/apps/environment-modules/4.5.3/bin /usr/local/bin /usr/bin /usr/local/sbin /usr/sbin /sbin /usr/sbin /cm/local/apps/environment-modules/4.5.3/bin;
set -xg PATH_modshare /usr/bin:1:/usr/local/bin:1:/cm/shared/apps/slurm/current/bin:1:/home/helmut/.local/bin:1:/home/helmut/programs/anaconda3/bin:1:/home/helmut/.cargo/bin:1:/cm/shared/apps/slurm/current/sbin:1:/cm/local/apps/gcc/11.2.0/bin:1:/sbin:1:/home/helmut/programs/Python-2.7.18:1:/usr/sbin:1:/home/helmut/programs/anaconda3/condabin:1:/home/helmut/.vscode-server/bin/6c3e3dba23e8fadc360aed75ce363ba185c49794/bin/remote-cli:1:/cm/local/apps/environment-modules/4.5.3/bin:1:/home/helmut/bin:1:/usr/local/sbin:1;
test 0;

Modules version and configuration

$ modulecmd fish --version
Modules Release 4.5.3 (2020-08-31)
$ modulecmd fish config --dump-state
Modules Release 4.5.3 (2020-08-31)

- Config. name ---------.- Value (set by if default overridden) ---------------
advanced_version_spec     0
auto_handling             0
avail_indepth             1
avail_report_dir_sym      1
avail_report_mfile_sym    1
collection_pin_version    0
collection_target         <undef>
color                     never
colors                    hi=1:db=2:se=2:er=91:wa=93:me=95:in=94:mp=1;94:di=94:al=96:sy=95:de=4:cm=92
contact                   root@localhost
extended_default          0

Additional context

None. Thank you!

xdelaruelle commented 10 months ago

Hello Helmut,

What you observe is the expected behavior of modulecmd command.

Modules tool is based on two components:

So you need to use the module shell function from your shell session, not the modulecmd script.

There is a fish initialization script provided with Modules that defines the module shell function. Given the information you provided, you should find this script at /cm/local/apps/environment-modules/4.5.3/init/fish.

$ source /cm/local/apps/environment-modules/4.5.3/init/fish

Regards, Xavier

helmutcarter commented 9 months ago

Hello Xavier,

Thank you for clearing that up. For some reason my fish shell had been set to automatically expand 'module' into 'modulecmd fish', so I assumed modulecmd was what I should be using.

Warmly, Helmut