Problems while importing h5py package
<p>I am coding in python and trying to <code>import h5py</code>. I have installed this package before. When I try to do this, it gives this error:</p>

<pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/lib/python2.7/dist-packages/h5py/__init__.py", line 34, in &lt;module&gt;
    from ._conv import register_converters as _register_converters
  File "h5py/h5t.pxd", line 14, in init h5py._conv (/build/h5py-nQFNYZ/h5py-2.6.0/h5py/_conv.c:7359)
  File "h5py/numpy.pxd", line 66, in init h5py.h5t (/build/h5py-nQFNYZ/h5py-2.6.0/h5py/h5t.c:20505)
ValueError: numpy.dtype has the wrong size, try recompiling
</code></pre>

<p>The point is that when I <code>import h5py</code> in the directory:<br>
<code>/usr/lib/python2.7/dist-packages/</code> it works, but I do not have enough space there.  </p>

<p>Does anyone know how to import this package in my data directory?
(I tried to export but it did not work!)</p>

<p>The fact that it works in one place and not another points to a possible conflict between several installs.</p>

<p>I suggest that you make sure to have only one install of NumPy and of h5py.</p>

<p>To diagnose the problem, issue the commands</p>

<pre><code>python -c 'import h5py; print h5py.__file__'
python -c 'import numpy; print numpy.__file__'
</code></pre>

<p>in your home directory then in <code>/usr/lib/python2.7/dist-packages/</code>, and copy the output here.</p>

<p>A likely solution is to</p>

<ol>
<li>pip uninstall h5py</li>
<li>pip uninstall numpy</li>
</ol>

<p>and rely on your package manager for the installation. If that is not appropriate (outdated packages, for instance), install everything with pip.</p>

python numpy h5py