Reputation: 39
I have the following issue: I have installed anaconda 3 and installed a package called "pygrib" into my anaconda environment. Now when importing pygrib in a file in my environment, it will show me this error:
import pygrib
ImportError: libhdf5.so.10: cannot open shared object file: No such file or directory
As I am a noobie, I dont really know what to do with this information. I installed the h5py package and some other related ones, but it didnt resolve the issue. What to do?
Upvotes: 0
Views: 844
Reputation: 384
This is a linking error with the HDF5 library. Are you building pygrib
from source or using the conda-forge
channel to install it via conda
? When I use the conda-forge
build of pygrib
I get the same issue. The GRIB API from ECMWF (on conda-forge
it is listed as ecmwf_grib
) is what pygrib depends on and the HDF5 dependency comes from netCDF4 being used in the GRIB API library. Specifically, using the latest HDF5 (1.10.0 at this time) is what is causing a problem. Using HDF5 1.8.* instead allows pygrib
to import properly.
To force conda to grab a specific version, just do:
conda install pygrib hdf5=1.8
This will get conda
to solve the package specifications again with the older HDF5 library and likely clear up the issue. This assumes you are in the conda
environment that you installed pygrib
into. You could also create a new environment with conda create -n <env name> pygrib hdf5=1.8
if you wanted to.
In general, when you see these errors where a library is not found, it is often a matter of getting the right version of a library installed. With conda
, this sort of thing happens when updating packages and a newer version of a library gets installed that a package you are using has not been properly linked with. As long as you can track down the package/library that is causing trouble, you can use the above procedure to start requiring certain versions of things get installed and conda
should then update or downgrade things so that things work together again. Hopefully this makes sense and helps.
This part may or may not interest you, but what I cannot say for certain is where this problem originates. My guess is that it is something with ecmwf_grib
and how it is built. That is where ldd
shows the old HDF5 dependency showing up for my installation. If I can figure out the exact issue, I'll update this answer.
Upvotes: 1