I am trying to use Mpi4py 1.3 with python 2.7 on Windows 7 64bits. I downloaded the installable version from here which includes OpenMPI 1.6.3 so in the installed directory (*/Python27\Lib\site-packages\mpi4py\lib) following libraries exist: libmpi.lib, libmpi_cxx.lib, libopen-pal.lib, and libopen-rte.lib. Now in my codes when trying to import it:
from mpi4py import MPI
It returns following error:
ImportError: DLL load failed: The specified module could not be found.
I tried to copy a bove lib files alongside the */Python27\Lib\site-packages\mpi4py\MPI.pyd and even to Windows/System32, but it didn't work. I appreciate your help on what DLL is missing and how to fix the error?
Using Mpi4py 1.3 with python 3.5 on Windows 10, I can run import mpi4py successfully but not from mpi4py import MPI. To fix it, just reinstall MPI via MPI. This works for me. 
I solved the problem. My environment is Win10, python 3.6.6, pycharm 2019.2 and linked to annaconda visual env.
1. download MS MPI, install both .mis and SDK.
2. set up environmental variables
control panel --> advanced system settings --> environmental variables --> add
(1) C:\Program Files (x86)\Microsoft SDKs\MPI and
(2) C:\Program Files\Microsoft MPI\Bin.
There are my paht, you may need to change the path here.
3. install MS visual studio, community version is enough
4. Anaconda prompt, use conda install -c intel mpi4py. I read most replies but not mentioned this way. 
I had the same issue and no answer solved the issue.
For me, the following solved the problem. I compiled and installed the mpi4py manually as follows:
C:\Program Files (x86)\Microsoft SDKs\MPI\Lib and C:\Program Files (x86)\Microsoft SDKs\MPI to your Windows environment variables (not sure if needed)C:\Program Files (x86)\Microsoft Visual Studio 14.0\.... although I use VS2017 currently.git clone https://github.com/mpi4py/mpi4py.gitcd mpi4pypython -m pip install Cythonpython setup.py buildpython setup.py installMy setting:
Use sys.prefix\lib\site-packages\mpi4py\bin\python-mpi.exe or add the following code to sys.prefix\lib\site-packages\mpi4py\__init__.py around line 37:
def _init_openmpi():
    """Pre-load libmpi.dll and register OpenMPI distribution."""
    import os
    import ctypes
    if os.name != 'nt' or 'OPENMPI_HOME' in os.environ:
        return
    try:
        openmpi_home = os.path.abspath(os.path.dirname(__file__))
        openmpi_bin = os.path.join(openmpi_home, 'bin')
        os.environ['OPENMPI_HOME'] = openmpi_home
        os.environ['PATH'] = ';'.join((openmpi_bin, os.environ['PATH']))
        ctypes.cdll.LoadLibrary(os.path.join(openmpi_bin, 'libmpi.dll'))
    except Exception:
        pass
_init_openmpi()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With