Unable to open hd5 file using rhdf5 but can list contents
Entering edit mode
dNand • 0
Last seen 5 weeks ago
United States

Hi, I am new to using h5 files. I have some data from some collaborators and while I am able to list the contents using

hfls("file.h5"), when I try to open the file using

h5f = H5Fopen("file.h5")

I get the following error

Error in H5Fopen("file.h5") : HDF5. File accessibility. Unable to open file.

My session info is as follows

``` R version 4.1.2 (2021-11-01) Platform: i386-w64-mingw32/i386 (32-bit) Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale: [1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C LC_TIME=English_United Kingdom.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] rhdf5_2.38.1 BiocManager_1.30.18

loaded via a namespace (and not attached): [1] compiler_4.1.2 tools_4.1.2 rhdf5filters_1.6.0 Rhdf5lib_1.16.0

``` Any help would be appreciated!

hdf5 h5 rhdf5 • 142 views
Entering edit mode
Last seen 2 days ago
United States

That's the error you get when you try to open a file that isn't there.

> dir(".", "h5$")
> H5Fopen("fileisnotthere.h5")
Error in H5Fopen("fileisnotthere.h5") : 
  HDF5. File accessibility. Unable to open file.

If you don't provide a path to the file, R assumes it exists in the working directory (which you can get using getwd()). And if you use dir as I have, and there's no H5 file in your working directory, then there you go.

Entering edit mode
Mike Smith ★ 5.7k
Last seen 16 hours ago
EMBL Heidelberg / de.NBI

If you can list the contents with h5ls(), then it should be possible to read.

You can get the Error in H5Fopen("file.h5") : HDF5. File accessibility. Unable to open file. for quite a few reasons (there are many ways opening a file can fail!). One common problem is that file file is already open by another process e.g. HDFView or another R session. Make sure that's not the case.

You can also print some more detailed HDF5 errors by running h5errorHandling(type = "verbose") before using H5Fopen(). This normally generates a large trace of HDF5 function calls, which can be pretty opaque if you're not familiar with HDF5, but might be useful to help diagnose the issue.

I'd also suggest trying the h5read() function which can be a bit more user friendly if you're just exploring the contents of the file.


Login before adding your answer.

Traffic: 380 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6