6

Background

I log into a server to do scientific computations. It runs 'Scientific Linux version 7.4'.

In order to get access to different software I have to run a command like 'module load x'. For instance to use python I need to write 'module load python'. I don't know much about this module system but from what I can tell it just modifies some environmental variables. Typing "module show python" reveals

module-whatis    This module sets up PYTHON 3.6 in your environment.
conflict         python
append-path      MODULEPATH /global/software/sl-7.x86_64/modfiles/python/3.6
setenv           PYTHON_DIR /global/software/sl-7.x86_64/modules/langs/python/3.6
prepend-path     PATH /global/software/sl-7.x86_64/modules/langs/python/3.6/bin
prepend-path     CPATH /global/software/sl-7.x86_64/modules/langs/python/3.6/include
prepend-path     FPATH /global/software/sl-7.x86_64/modules/langs/python/3.6/include
prepend-path     INCLUDE /global/software/sl-7.x86_64/modules/langs/python/3.6/include
prepend-path     LIBRARY_PATH /global/software/sl-7.x86_64/modules/langs/python/3.6/lib
prepend-path     PKG_CONFIG_PATH /global/software/sl-7.x86_64/modules/langs/python/3.6/lib/pkgconfig
prepend-path     MANPATH /global/software/sl-7.x86_64/modules/langs/python/3.6/share/man

When I load python I also gain access to conda (whose executable is found in /global/software/sl-7.x86_64/modules/langs/python/3.6/bin).

Problem

Normally I cannot run conda without first loading the python module. But recently I noticed that this changed and now I can run conda without loading the python module. This confused me so I typed 'which conda' to see if I could find what executable is being run, but when I do it says that 'no conda is found' in any of the directories on my PATH variable.

How is it possible that 'which' cannot find the conda executable despite the fact that I can still run conda?

2

2 Answers 2

17

You probably have an alias or a shell function called “conda”.  Type

type conda

and see what it says.

4
  • Thanks. It looks like conda is a function. So it runs a bash scripts that runs conda. I guess they must've changed the set up to make using conda more convenient. Thanks for your help!
    – Onye
    Commented Feb 10, 2020 at 7:29
  • 5
    Unless you're sure that which is a built in to the shell that you're using it is best to avoid it. The -a option/flag of the builtin type is also useful if you're using bash.
    – Jetchisel
    Commented Feb 10, 2020 at 9:10
  • So I noticed that after loading in the module the 'which' command tells me that 'conda' is an executable but 'type' tells me that its still a function. Should I trust 'type' more than 'which'?
    – Onye
    Commented Feb 11, 2020 at 2:17
  • 1
    @Onye Yes, you should. type is a shell built-in, which is an external program. The latter has no access to the shell's method of looking up commands.
    – Barmar
    Commented Feb 11, 2020 at 2:19
1

I don't know much about this module system but from what I can tell it just modifies some environmental variables.

That is a red flag: in Posix operating systems, no executable can change the environment of anything but itself and of executables it started itself.

So your module system cannot be implemented using executables, and which only finds executables.

Instead, the commands have to be some subsystem of your shell: either shell functions or aliases.

Try type conda and/or type module to let the shell tell you what they are.

1
  • No need for alarming tone. Scientific Linux is based on RHEL, and these modules look very much like Software Collections. SCL basically sets up various environment variables and spawns new shell with these vars inherited. There is also a mode where variables are sourced, but usage of that mode is discouraged. Commented Feb 10, 2020 at 22:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .