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).
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.