"module load" command does not work
I'm trying to compile the "Global Climate Model" with the following commands.
module unload pgi gcc
module load gcc/4.6.3 pgi/11.8
When I execute them, the terminal replies with command not found
.
What am I doing wrong? What is the right way to do this?
Just to summarize the previous comments and answers and add a bit of first-hand installation experience:
You are looking for the module
command provided by the Environment Modules package. It is a tool for modifying the shell environment (PATH but also aliases etc.) and common to many multi-user clusters like High-Performance Computing clusters.
The instructions you got were probably from some HPC cluster, since you want to run a global climate model. Read more about Environment Modules on HPC here.
Now for something actually Ubuntu-related: It is actually not that much of a pain to set up Environment Modules under Ubuntu. I just did it in under 10 minutes for Ubuntu 14.10 and the Bash shell.
As mentioned in other posts, you can install Environment Modules from the repos (package environment-modules
).
Then you run add.modules
. It will put a few lines into your shell initalization file, in this case ~/.bashrc
:
case "$0" in
-sh|sh|*/sh) modules_shell=sh ;;
-ksh|ksh|*/ksh) modules_shell=ksh ;;
-zsh|zsh|*/zsh) modules_shell=zsh ;;
-bash|bash|*/bash) modules_shell=bash ;;
esac
module() { eval `/usr/Modules/$MODULE_VERSION/bin/modulecmd $modules_shell $*`; }
#module() { eval `/usr/bin/modulecmd $modules_shell $*`; }
You need to uncomment the last line and comment out or delete the second-last. This line defines the module
command you were looking for. It effectively runs modulecmd bash
plus the arguments you give it.
I have the feeling that this function is actually not very safe because it evaluates anything you supply it with in its arguments. Some users can perhaps comment on how to improve this.
You now just need to create some directory containing the so-called modulefiles
and add it to $MODULEPATH
, for example with module use /path/to/your/modulefiles
. There are examples for modulefiles out there on the interwebs.
I find this a very handy tool not just for multi-user clusters. I use it for switching between different Python distributions.
For those who "skim" (looking at you Seth): This is NOT A QUESTION ABOUT KERNEL MODULES. It's a question about manipulating shell environment variables using a tool called ENIRONMENT-MODULES. If you're at all familiar with kernel modules, you'll realize there is no standard kernel tool (script or otherwise) named "module." All the module manipulation tools abbreviate module as mod (lsmod, insmod, modprobe, etc). And there is no module named gcc.
Environment-modules (http://modules.sourceforge.net/) is yet another environment tool for switching execution environments in the shell. It helps people who need Python 2.4 and Python 2.7 on the same machine. Or it helps people manage Intel v. GNU compilers and libraries.
Unfortunately, environment-modules isn't a package for Ubuntu 12.04 LTS.
Options include installing from source (follow the link above), upgrading to 14.04 LTS, or looking at deb files. Of the three, I'd install from source. The deb file depends on libtcl8.6 which is in the same predicament, unavailable on 12.04LTS.
You're probably trying to use a software package that isn't installed on your machine. Of course I can't really be sure, but my guess would be that you're trying to use environment-modules. If that is correct, you could install environment-modules from the standard Ubuntu repositories.
But be aware that environment-modules is a rather old program. The homepage notes the last update of a helper tool as of 2011, the copyright notice doesn't go further up than 1999. So there's no guarantee that this software package works flawlessly with current Ubuntu versions. It might, but you can't be sure.