Skip to content

Could not detect module function from bash. Trying to detect modulecmd from which #8193

@adamjstewart

Description

@adamjstewart

I couldn't seem to find an issue dedicated to this bug. I'm using Spack on Blue Waters (Cray) for the first time and no matter what command I run I see the following warning message:

$ spack install zlib
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Installing zlib
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Using cached archive: /mnt/a/u/sciteam/stewart1/spack/var/spack/cache/zlib/zlib-1.2.11.tar.gz
==> Staging archive: /mnt/a/u/sciteam/stewart1/spack/var/spack/stage/zlib-1.2.11-acfau7b4yp2pdvwsltyeevfpsovfbzyn/zlib-1.2.11.tar.gz
==> Created stage in /mnt/a/u/sciteam/stewart1/spack/var/spack/stage/zlib-1.2.11-acfau7b4yp2pdvwsltyeevfpsovfbzyn
==> Applied patch w_patch.patch
==> Building zlib [Package]
==> Executing phase: 'install'
==> Warning: Could not detect module function from bash. Trying to detect modulecmd from `which`
==> Successfully installed zlib
  Fetch: 0.08s.  Build: 30.66s.  Total: 30.73s.
[+] /mnt/a/u/sciteam/stewart1/spack/opt/spack/cray-cnl5-interlagos/cce-8.5.8/zlib-1.2.11-acfau7b4yp2pdvwsltyeevfpsovfbzyn

Spack also hangs for ~2 minutes after the first 2 warning messages, not sure what it's doing. Module-related info:

$ type module
module is a function
module () 
{ 
    if [[ $1 == "purge" ]]; then
        echo "";
        echo "BEWARE: Running \"module purge\" puts your environment in an unreliable state.";
        echo "Doing so makes it difficult to debug problems or for support staff to help";
        echo "you. Please structure your build so that you don't have to do this.";
        echo "";
    fi;
    if [[ $1 == "PrgEnvLoad" ]]; then
        PRGMOD=`echo $LOADEDMODULES | tr ":" "\n" | grep PrgEnv`;
        if [[ $PRGMOD == "" ]]; then
            moduleraw load $2 $3 $4 $5 $6 2>&1;
            return;
        fi;
        moduleraw swap $PRGMOD $2 $3 $4 $5 $6 2>&1;
        return;
    fi;
    moduleraw $* 2>&1
}
$ which modulecmd
/opt/modules/3.2.10.4/bin/modulecmd

I have 3 concerns here:

  1. If there are two ways to locate modulecmd, why print a warning message unless both fail?
  2. Why are we looking for modulecmd multiple times instead of saving the result of the first search?
  3. Why do simple commands like spack help or spack arch also print these warnings? Are we always searching for modulecmd? Seems like a great way to slow Spack down to a grinding halt.

@mamelara @becker33 @tgamblin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions