You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example below shows four attempts at reading a remote Zarr AnnData. 1 of the 4 attempts is successful, and the data can be looked at here https://dl01.irc.ugent.be/spatial/mibitof/data.zarr (at the location table/table). Please note that the consolidated metadata is present in the root folder (created by calling zarr.consolidate_metadata()).
The URL https://s3.embl.de/spatialdata/test_remote/data.zarr contains the same data as above, but here we have an S3 storage where the data is "not discoverable", so consolidated metadata are needed for zarr to find the files.
We see that:
in attempts 1 and 2 we try to pass a zarr.Group to read_zarr(), and this doesn't work. Maybe because the zarr.Group is returned by open_consolidated() and not by open(). They are both groups but slightly different inside. For instance g.store is a zarr.storage.FSStore for open() and a zarr.storage.ConsolidatedMetadataStore for open_consolidated(). So maybe some of these internal elements break read_zarr().
in attempts 3 and 4 we pass a URL. Here read_zarr() is most likely ignoring the zmetadata present two folders up, so in the attempt 4 there is no surprise it fails, while it works in attempts 3 because the folders inside the URL are "discoverable".
importzarrimportosimportpytestfromanndataimportread_zarrstore0='https://dl01.irc.ugent.be/spatial/mibitof/data.zarr'store1='https://s3.embl.de/spatialdata/test_remote/data.zarr'# workaround .zmetadata is being written as zmetadata (https://github.com/zarr-developers/zarr-python/issues/1121)f0=zarr.open_consolidated(store0, mode="r", metadata_key="zmetadata")
f1=zarr.open_consolidated(store1, mode="r", metadata_key="zmetadata")
# this shows that the data is seen correctly by zarrprint(dict(f0['table/table']))
print(dict(f1['table/table']))
# attempt 1, failsgroup0=f0["table/table"]
withpytest.raises(zarr.errors.PathNotFoundError):
table0=read_zarr(group0)
# attempt 2, failsgroup1=f1["table/table"]
withpytest.raises(zarr.errors.PathNotFoundError):
table0=read_zarr(group1)
# attempt 3, workstable0=read_zarr(os.path.join(store0, 'table/table'))
print(table0)
# attempt 4, fails# this returns an empty table instead (makes sense since no consolidated metadata is passed here)table1=read_zarr(os.path.join(store1, 'table/table'))
print(table1)
Traceback (for the first of the with pytest.raises...):
Traceback (most recent call last):
File "/Users/macbook/miniconda3/envs/ome/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3508, in run_codeexec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-0d02b753fc78>", line 1, in <module>
table0 = read_zarr(group1)
File "/Users/macbook/miniconda3/envs/ome/lib/python3.10/site-packages/anndata/_io/zarr.py", line 65, in read_zarr
f = zarr.open(store, mode="r")
File "/Users/macbook/miniconda3/envs/ome/lib/python3.10/site-packages/zarr/convenience.py", line 122, in openraise PathNotFoundError(path)
zarr.errors.PathNotFoundError: nothing found at path ''
@LucaMarconato, could you try #1057 and make sure it fixes your issue? We're not set up to test against s3 directly, but I think this should fix the issue
Please make sure these conditions are met
Report
Description
Maybe related to #951.
The example below shows four attempts at reading a remote Zarr
AnnData
. 1 of the 4 attempts is successful, and the data can be looked at here https://dl01.irc.ugent.be/spatial/mibitof/data.zarr (at the locationtable/table
). Please note that the consolidated metadata is present in the root folder (created by callingzarr.consolidate_metadata()
).The URL https://s3.embl.de/spatialdata/test_remote/data.zarr contains the same data as above, but here we have an S3 storage where the data is "not discoverable", so consolidated metadata are needed for
zarr
to find the files.We see that:
zarr.Group
toread_zarr()
, and this doesn't work. Maybe because thezarr.Group
is returned byopen_consolidated()
and not byopen()
. They are both groups but slightly different inside. For instanceg.store
is azarr.storage.FSStore
foropen()
and azarr.storage.ConsolidatedMetadataStore
foropen_consolidated()
. So maybe some of these internal elements breakread_zarr()
.read_zarr()
is most likely ignoring thezmetadata
present two folders up, so in the attempt 4 there is no surprise it fails, while it works in attempts 3 because the folders inside the URL are "discoverable".Note, in the store you see a
zmetadata
and not a.zmetadata
because of this bug zarr-developers/zarr-python#1121.Reproducing
Code:
Traceback (for the first of the
with pytest.raises...
):Versions
The text was updated successfully, but these errors were encountered: