I have configured a parallel version of hdf5 on my WSL2 Ubuntu 22.04 on Windows 11 system.
In C and Fortran, parallel hdf5 works quite well. However, things get muddy when I’m following this guide to install parallel h5py , and trying to run the demo code. The system continues to complain AttributeError: module ‘h5py’ has no attribute ‘File’.
I searched for several cases on StackExchange but none of those seem to work. I installed mpi4py and h5py simply by pip3, so there is nothing to do with conda error. It’s highly appreciated if anyone can give some suggestions.
That AttributeError usually is caused by a bad installation of h5py. Can you provide exact commands you used to install libhdf5, h5py? You mention “conda error”. Did you install the parallel version of libhdf5 via the conda package manager?
The install commands look okay. I assume the output from that pip3 command is not available now?
One useful check would be to verify what is actually installed as h5py. You should have an h5py directory under the site-packages directory. To find out the location of the site packages directory, run this command:
In the h5py directory, there should be a _hl one, and in it a files.py file. The AttributeError you reported indicates that this file is missing in your installation.
Errors like this can often occur if you’ve got a file called h5py.py in the same directory where you’re running the code - import h5py will find this file instead of your h5py installation.