module: command not found

42,251

Solution 1

I tried to reproduce it and it turns out that for me sourcing

source /etc/profile.d/modules.sh

in th .sh script helps for bash and similar. For csh and tcsh, you have to add

source /etc/profile.d/modules.csh

to the script. Note, that this line must come first and then the

module load foo

line.

Solution 2

I got here as I was searching for ways to install multiple php versions in CentOS7 and https://blog.remirepo.net/post/2019/05/22/PHP-7.4-as-Software-Collection was one of the articles I tried to follow and encountered the same "module: command not found" issue.

Sourcing /etc/profile via command:

. /etc/profile

seems to make the "module load" work.

Credits to fadishei in https://forums.fedoraforum.org/showthread.php?262708-module-command-not-found

To make the version of php (e.g. php7.4) persist, append the following to file /etc/profile.d/custom.sh

source /etc/profile.d/modules.sh
module load php74

Reboot and run the php --version to cross-check that php 7.4 is the current version installed.

Solution 3

I think that you have to put this in your script to define the module command:

module () {
    eval `/usr/bin/modulecmd bash $*`
}
Share:
42,251
Sam
Author by

Sam

Updated on July 18, 2022

Comments

  • Sam
    Sam almost 2 years

    I'm attempting to load several modules for building a library on Linux but am told that the command 'module' doesn't exist. I've Googled around and discovered that the solution was to source a directory called "module" which I am unable to locate despite extensive searching.

    I'm not quite sure what I should and any help would be appreciated (it might help to know that the makefile I'm working with uses csh while my default shell is bash). Thanks!