Sam
Sam

Reputation: 463

module: command not found

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!

Upvotes: 23

Views: 92290

Answers (6)

spkane
spkane

Reputation: 6764

This documentation should help both with getting access to the modules shell function (install and then open up a new terminal) and on how to create or install new modules (there aren't any by default in most installs).

From the research I have done, Spack and EasyBuild can be used to install software and create modulefiles for that software.

Upvotes: 0

vdi
vdi

Reputation: 793

In my case, I was using zsh instead of the default bash shell.

After switching to bash and submitting the script, it worked out

Upvotes: 2

Deepak Mourya
Deepak Mourya

Reputation: 430

This was working for me

#!/bin/bash -i // it will make this interactive

Upvotes: 0

icasimpan
icasimpan

Reputation: 1323

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.

Upvotes: 5

Baedsch
Baedsch

Reputation: 632

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.

Upvotes: 29

bougui
bougui

Reputation: 3807

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

module () {
    eval `/usr/bin/modulecmd bash $*`
}

Upvotes: 1

Related Questions