Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i load Module packages of linux using a python script

Tags:

python-2.7

I am new to python and am learning things by writing scripts. I have tried the following and none of them seem to be working.

1) commands.getoutput('module load xxx')

2) subprocess.check_output(['module load', xxx'])

None of these change the environment as a side effect of the module call. Can someone tell me what is wrong?

like image 596
pupil Avatar asked Apr 09 '26 09:04

pupil


1 Answers

In case it helps anyone, I managed to do it by prefixing all commands that depend on the module with module load xxx &&. For example,

module load mpi/mpich && mpirun ./myprogram -n 4 -options

Not an elegant solution, but works for me. There's also this answer but I couldn't make it work in the system I have access to.

like image 196
Aditya Kashi Avatar answered Apr 12 '26 17:04

Aditya Kashi