easybuilders / easybuild-framework

EasyBuild is a software installation framework in Python that allows you to install software in a structured and robust way.
https://easybuild.io
GNU General Public License v2.0
148 stars 201 forks source link

Sanity check failed: loading fake module failed: 'Changing environment as dictated by module failed: invalid syntax #1477

Open kylecook80 opened 8 years ago

kylecook80 commented 8 years ago

I am trying to install the 'intel' toolchain with the following command

eb intel-2015b.eb --robot

The installation attempts to install flex, however it failed with the error in the title of the issue. Below is the entire log from the build. Any suggestions?

https://gist.github.com/kylecook80/31835b7228f1e6e7319b

boegel commented 8 years ago

I believe this is caused by this line:

eval `/opt/lmod/lmod/settarg/settarg_cmd -s python --destroy`;

That's not valid Python code, and EasyBuild is trying to execute it as Python code, since it's expecting output in Python syntax from Lmod.

This is caused by having the settarg module loaded, this has come up before. Are you trying this in a VM you got during SC15? :-)

@rtmclay: Is there any way to solve this on the Lmod side (this is not an EasyBuild problem imho). This has come up before.

@kylecook80: Try unloading the settarg module, and then trying again. Also, if you want to play with the Intel tools, you'll need to manually provide the install files to EasyBuild, since it won't be able to download them. Maybe go with the foss/2015b toolchain instead, which is all open-source software that EasyBuild should be able to download automagically.

kylecook80 commented 8 years ago

@boegel I am trying this in a VM because of SC15! :)

This worked! Thank you so much.

boegel commented 8 years ago

Glad to hear that fixed your problem, I'll try to figure out how we can avoid this from happening when the settarg module is loaded.

boegel commented 8 years ago

@rtmclay: can you remind me why this invalid Python code pops up when settarg is loaded?

boegel commented 8 years ago

@rtmclay: ping?

rtmclay commented 8 years ago

Because Lmod defines the module command to be:

% type module module () {         eval $($LMOD_CMD bash "$@")         [ $? = 0 ] && eval $(${LMOD_SETTARG_CMD:-:} -s sh) }

And some how your code is picking this up.  When the settarg module is loaded, it defines LMOD_SETTARG_CMD to point to the settarg program.  When the settarg module is unloaded it needs to run a command as shown from tjhe settarg modulefile:

local cmd     = "eval " .. settarg_cmd .. " -s " .. myShell .. " --destroy" execute{cmd=cmd, modeA = {"unload"}}

Lmod always emits the execute command on unload.  I plan on changing it to only do so when the shell is bash or csh.  But that won't help EB as it use bash or csh as the shell passed to the module command.  AFAIK.

boegel commented 8 years ago

No, EasyBuild uses python as shell.

It doesn't use the module function, but calls the lmod binary directly as lmod python <subcommand>.

See https://github.com/hpcugent/easybuild-framework/blob/6b798c86938f3898454f120e4a3e7faba2e4c9af/easybuild/tools/modules.py#L494

rtmclay commented 8 years ago

I am working on fixing Lmod so that will only emit text from the execute command if the shell is "real". This means csh, bash and fish.

boegel commented 8 years ago

@rtmclay: did you get to fixing this in Lmod? If so, can you specify in which version this was fixed?