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