-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: KeyError in h5py with h5netcdf 0.13.0 #136
Comments
Either the new track_order feature or a regression of the dimension scale refactor. Can you narrow down the issue? |
@paugier Can you try to open the files with keyword Update: |
@paugier Reading this h5py/h5py#1385 it's a |
@hmaarrfk Any ideas? |
we removed the track order keyword |
@paugier Please add the hdf5 and h5py versions you are using in your environment. Thanks! |
@paugier One final request, providing a minimal example would greatly help to narrow down the issue. I couldn't reproduce this so far. |
Hmm, ok. I just read through the log of the provided error. My guess is that the test is using an h5 file that was created with 0.12.0 or earlier with Then in I think that the bug comes: Line 1009 in fe17016
where track order is being specified on read and append. If you can help provide us with the dataset, and the code to recreate it will go a long way. |
Good news, I can easily reproduce locally with the most recent versions of h5py (3.6.0) and h5netcdf (0.13.0). There is no file created with older versions of these packages. The error happens for example in this line https://foss.heptapod.net/fluiddyn/fluidsim/-/blob/branch/default/fluidsim/util/output.py#L121 for the (simplest) case for which I will try to provide a minimal example reproducing the bug soon. |
I finally manage to find time to produce this minimal example. # error with h5netcdf 0.13.0, no error with 0.12.0
import h5netcdf as h5pack
# no error with this import
# import h5py as h5pack
def save(d, path_file):
print(path_file)
print(d)
with h5pack.File(path_file, "w") as h5file:
for key, value in d.items():
h5file.attrs[key] = value
try:
h5file.attrs["a"] = 0
except KeyError:
print(f"ERROR for {path_file = }")
raise
foo = {key: ord(key) for key in "abcdefghij"}
bar = {key: ord(key) for key in "bcdefghija"}
assert foo == bar
save(foo, "foo.nc")
save(foo, "foo1.nc")
save(bar, "bar.nc") Here, it gives
|
@paugier Great, thanks! That's the It doesn't look like there is a solution already available in Bottom line, we would need to |
I confirm. Simpler reproducer (error for import h5netcdf as h5pack
# import h5py as h5pack
with h5pack.File("foo.nc", "w") as h5file:
for i in range(10):
h5file.attrs[f"key{i}"] = i
try:
h5file.attrs[f"key{i}"] = 0
except KeyError:
print(f"ERROR for {i = }")
raise |
eek. not so sure what the best way forward is. seems rather annoying and serious. maybe we should expose the parameter again and leave the default as false. thanks for helping us work through the bugs here |
@kmuehlbauer I think we should definitely remove the error on The next question is if we should change the default value back to the 0.12.0 one due to this long standing buy (2years +) |
@hmaarrfk That's a pity, really. The only other way would be to fix this via I agree that we should remove the error. And probably switch default again for the new API, we I'm not sure, if I can get this in before the weekend. But we would need to to fix in master , to create a 0.13-release branch, cherry-pick and get 0.13.1 out with these changes. |
Would be best to be consistent, so switching back to |
If you can create the branch, I can cherry-pick. I'm interested enough, for performance reasons to move to an h5py backend, and I am making the changes as we speak. |
Wow, lots of exciting stuff has been merged last week. Should we just make a version 0.14.0 instead? |
Let's fix this one as 0.13.1. There is #135 which gets merged in the next days and will be finally 0.14.0 (which will be released not shortly too). |
Ok got the PR on master to be nice. I think the one on 0.13 is ready too if there aren't major comments on the master branch. I guess for now, the tip would be to stick to the 0.12.0 until 0.13.1 gets released. Thanks you two! |
@hmaarrfk Would you mind adding the readme note to master too? |
Oh I forgot to say thank you @hmaarrfk and @kmuehlbauer for your work on this issue and on h5netcdf in general! It's really a very useful and nice package. |
See upstream HDFGroup/hdf5#1388 for details. |
The CI of fluidsim was broken by the release of h5netcdf 0.13.0. I get a lot of
KeyError: 'Unable to delete attribute (record is not in B-tree)'
with tracebacks looking likeBy pinning h5netcdf to 0.12.0, the CI is green again.
Any idea of what can cause this issue ?
The text was updated successfully, but these errors were encountered: