How to Solve NameError: name 'MPI' is not defined -- mpi4py

Solution: Import the 'MPI' module

To Solve the error, add the following line to the top of your code.

from mpi4py import MPI

 

For more information:
Python mpi4py MPI