mpiexec : The term 'mpiexec' is not recognized as the name of a cmdlet, function, script file, or operable program

3k Views Asked by At

I keep getting this error in pycharm terminal although I've installed mpi4py package correctly from settings > projectname > python interpreter.

The command I want to use in the terminal is mpiexec -n 5 python filename.py

And I got the same error when I tried to use mpirun instead of mpiexec.

I'm using python's latest version (3.10) and mpi4py latest version (3.1.3).

2

There are 2 best solutions below

0
On

For me what fixed it was adding it to the environment variables. Add the ones with names MSPI... in system variables and copy them to your user variables then just restart

0
On

so I am using Atom instead of Pycharm, but I was in a similar boat. After trying several options like creating a batch file or using the start command in Powershell.

This command worked for me, but I had to run it from the bin folder in the MPI program installation:

.\mpiexec.exe -n 2 python "C:/%Path%to%your%script\filename.py"

It is not ideal, of course, because you must navigate to the bin folder every time you want to run your script, but it can probably be automated with a batch file. There is also probably a way to get mpiexec or mpirun to work, but this was a quick way for me to run the script.