title: mpi4py: Library not loaded: /usr/local/lib/libmpi.1.dylib
body: <p>I am trying to use python with mpi4py. However, when I run <code>from mpi4py import MPI</code> in a python environment, I get the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: dlopen(/usr/local/lib/python2.7/site-packages/mpi4py/MPI.so,  2): Library not loaded: /usr/local/lib/libmpi.1.dylib
    Referenced from: /usr/local/lib/python2.7/site-packages/mpi4py/MPI.so
    Reason: image not found
  </code></pre>
  
  <p>In the specified path (<code>/usr/local/lib/</code>) I have what I think is a version of the required file called <code>libmpi.12.dylib</code>. I have looked at the <a href="https://github.com/mpi4py/mpi4py/blob/master/src/lib-mpi/compat/openmpi.h" rel="nofollow">source code for mpi4py</a> and from what I can tell this file is valid, but for some reason mpi4py (MPI.so specifically) is still trying to use the .1. version.</p>
  
  <p>The error message shown occurs whether I run using <code>mpirun</code>, <code>mpiexec</code>, or simply enter the import command in a terminal python session (the last one is how I generated the error message as copied here).</p>
  
  <p>I would greatly appreciate any help on this. I have tried reinstalling and/or updating all the related packages and codes, but it has not solved the problem.</p>
  
  <p>--- UPDATE ---
  Out of desperation I tried renaming <code>libmpi.12.dylib</code> to <code>libmpi.1.dylib</code> and it worked, at least for now. I am still interested in a non-hack solution if anyone has one.</p>