Can not submit Matlab job: getting ExitCode2 (slurmstepd: error: execve(): matlab:)

Hi all,

I am trying to submit a Matlab simulation but I am getting the following error in slurm.out files.

/var/spool/slurmd/job40129493/slurm_script: /opt/modules/Modules//bin/modulecmd: No such file or directory
slurmstepd: error: execve(): matlab: No such file or directory
srun: error: node031: task 0: Exited with exit code 2

Seemed to be related on how I load modules: but when I tried just see the list of available modules with the following command: module spider I am getting the same error:

[hovsepya@login2 ~]$ module spider
-bash: /opt/modules/Modules//bin/modulecmd: No such file or directory

Can you please guide me how to proceed? I am kinda new to submitting jobs in servers. :slight_smile:
If needed I can share my batch file as well.


Hi there,

Indeed, but why were you manually sourcing (nonexistent) system files at shell initialization?

[hovsepya@login2 ~]$ cat ~/.bash_profile
if [ -f /etc/profile.modules ]
        . /etc/profile.modules
# put your own module loads here
        module load null
[hovsepya@login2 ~]$ 

Commenting the lines above fixed module spider & Co.

Thx, bye,

Hi Luca,

Thanks for the quick response.

I am not sure to what you refer here? I don’t really recall any edits that I have done to .bash_profile file.

Anyway, even though you marked it as a solution, it still does not work on my side.

I am having the same problems, as in OP.

Just for reference, around a week ago or so, I was able to load and launch Matlab in interactive mode, but now it does not work either and gives the same error about not being able to load the module.


EDIT: I temporally unmarked solution, so people would not “ignore” it as solved.


can you please share your sbatch script?



Hi Yann,

here it is.


# Authors
# Sevada Hovsepyan

#SBATCH --partition=mono-shared-EL7
#SBATCH --job-name leaky_syllables
#SBATCH --time=600:00
#SBATCH --cpus-per-task=8
#SBATCH --ntasks=1
#SBATCH --mem-per-cpu=8000
#SBATCH --mail-type=ALL
#SBATCH --output=slurm-%J.out

module load matlab/2019b

srun matlab -nodesktop -nosplash -nodisplay -r model_inf_for

but I am getting the error even when I am not using the script to launch, but try to load matlab module in interactive mode.


Hi there,

The last modification to your ~/.bash_profile was quite old (2014 IIRC), so probably it was how module was initialized previously.

Strange enough, I was quite sure to have successfully tested it and indeed it does not work now. I guess I mixed terminals, sorry for the inconvenience.

The reason is that you had module initialization snippets in three different files: ~/.profile , ~/.bash_profile and ~/.bashrc , I have now commented these snippets everywhere and indeed module spider works:

[hovsepya@node001 ~]$ unset HISTFILE
[hovsepya@node001 ~]$ ssh login2
[hovsepya@login2 ~]$ module spider matlab 2>&1 | \
 head -n 10

[hovsepya@login2 ~]$ 

Please test again after having completely logged out and logged in again for the change to take effect. If everything is OK, please mark the solution.

Thx, bye,

1 Like

Hi again,

no inconvenience at all, I am thankful for your help. :slight_smile:

Now the solution seems to be working, at least I can check modules with module spider command.
Now I’ll try to run my and hopefully it would work now, but your changes solved the problem with the modules, hence I marked it as solution.