Skip to content

Error trying to load local zarr dataset #634

@dstansby

Description

@dstansby
from cloudvolume import CloudVolume
vol = CloudVolume('zarr://file:///Users/dstansby/notebooks/hipct/meshgen/4')

gives me

---------------------------------------------------------------------------
UnsupportedProtocolError                  Traceback (most recent call last)
File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/cloudvolume.py:245, in CloudVolume.__new__(cls, cloudpath, mip, bounded, autocrop, fill_missing, cache, compress_cache, cdn_cache, progress, info, provenance, compress, compress_level, non_aligned_writes, parallel, delete_black_uploads, background_color, green_threads, use_https, max_redirects, mesh_dir, skel_dir, agglomerate, secrets, spatial_index_db, lru_bytes, cache_locking)
    244 try:
--> 245   return init('zarr2://' + cloudpath)
    246 except:

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/cloudvolume.py:232, in CloudVolume.__new__.<locals>.init(cloudpath)
    231 def init(cloudpath):
--> 232   path = strict_extract(cloudpath)
    233   if path.format in REGISTERED_PLUGINS:

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/paths.py:113, in strict_extract(cloudpath, windows, disable_toabs)
    106 """
    107 Same as cloudvolume.paths.extract, but raise an additional 
    108 cloudvolume.exceptions.UnsupportedProtocolError
   (...)
    111 Returns: ExtractedPath
    112 """
--> 113 path = extract(cloudpath, windows, disable_toabs)
    115 if path.dataset == '' or path.layer == '':

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/paths.py:155, in extract(cloudpath, windows, disable_toabs)
    153   abspath = toabs    
--> 155 fmt, protocol, cloudpath = extract_format_protocol(cloudpath)
    157 split_char = '/'

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/paths.py:89, in extract_format_protocol(cloudpath)
     88 if proto in ALLOWED_FORMATS:
---> 89   raise error # e.g. gs://graphene://
     90 elif proto in ALLOWED_PROTOCOLS:

UnsupportedProtocolError: 
Cloud Path must conform to format://PROTOCOL://BUCKET/PATH
Examples: 
  precomputed://gs://test_bucket/em
  gs://test_bucket/em
  graphene://https://example.com/image/em

Supported Formats: None (precomputed), graphene, precomputed, boss, n5, zarr, zarr2, zarr3
Supported Protocols: gs, file, s3, http, https, mem, middleauth+https, ngauth+https, matrix, tigerdata

Cloud Path Recieved: zarr2://zarr://file:///Users/dstansby/notebooks/hipct/meshgen/4


During handling of the above exception, another exception occurred:

InfoUnavailableError                      Traceback (most recent call last)
Cell In[13], line 1
----> 1 vol = CloudVolume('zarr://file:///Users/dstansby/notebooks/hipct/meshgen/4')

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/cloudvolume.py:247, in CloudVolume.__new__(cls, cloudpath, mip, bounded, autocrop, fill_missing, cache, compress_cache, cdn_cache, progress, info, provenance, compress, compress_level, non_aligned_writes, parallel, delete_black_uploads, background_color, green_threads, use_https, max_redirects, mesh_dir, skel_dir, agglomerate, secrets, spatial_index_db, lru_bytes, cache_locking)
    245     return init('zarr2://' + cloudpath)
    246   except:
--> 247     raise err
    248 else:
    249   raise err

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/cloudvolume.py:241, in CloudVolume.__new__(cls, cloudpath, mip, bounded, autocrop, fill_missing, cache, compress_cache, cdn_cache, progress, info, provenance, compress, compress_level, non_aligned_writes, parallel, delete_black_uploads, background_color, green_threads, use_https, max_redirects, mesh_dir, skel_dir, agglomerate, secrets, spatial_index_db, lru_bytes, cache_locking)
    236     raise UnsupportedFormatError(
    237       "Unknown format {}".format(path.format)
    238     )
    240 try:
--> 241   return init(cloudpath)
    242 except InfoUnavailableError as err:
    243   if 'precomputed://' not in cloudpath:

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/cloudvolume.py:234, in CloudVolume.__new__.<locals>.init(cloudpath)
    232 path = strict_extract(cloudpath)
    233 if path.format in REGISTERED_PLUGINS:
--> 234   return REGISTERED_PLUGINS[path.format](**kwargs)
    235 else:
    236   raise UnsupportedFormatError(
    237     "Unknown format {}".format(path.format)
    238   )

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/datasource/zarr/__init__.py:47, in create_zarr(cloudpath, mip, bounded, autocrop, fill_missing, cache, compress_cache, cdn_cache, progress, info, compress, compress_level, non_aligned_writes, delete_black_uploads, parallel, green_threads, secrets, cache_locking, **kwargs)
     28 config = SharedConfiguration(
     29   cdn_cache=cdn_cache,
     30   compress=compress,
   (...)
     38   cache_locking=cache_locking,
     39 )
     40 cache = CacheService(
     41   cloudpath=get_cache_path(cache, cloudpath),
     42   enabled=bool(cache),
     43   config=config,
     44   compress=compress_cache,
     45 )
---> 47 meta = ZarrMetadata(cloudpath, config=config, cache=cache, info=info)
     48 imagesrc = ZarrImageSource(
     49   config, meta, cache, 
     50   autocrop=bool(autocrop),
   (...)
     53   fill_missing=bool(fill_missing),
     54 )
     56 return CloudVolumePrecomputed(
     57   meta, cache, config, 
     58   imagesrc, mesh=None, skeleton=None,
     59   mip=mip
     60 )

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/datasource/zarr/metadata.py:50, in ZarrMetadata.__init__(self, cloudpath, config, cache, info)
     47 self.zattrs = self.default_zattrs()
     49 if orig_info is None:
---> 50   self.info = self.fetch_info()
     51 else:
     52   self.render_zarr_metadata()

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/datasource/zarr/metadata.py:427, in ZarrMetadata.fetch_info(self)
    424 if res is not None:
    425   self.zarrays.extend(res)
--> 427 return self.zarr_to_info(self.zarrays, self.zattrs)

File ~/notebooks/hipct/meshgen/.venv/lib/python3.12/site-packages/cloudvolume/datasource/zarr/metadata.py:368, in ZarrMetadata.zarr_to_info(self, zarrays, zattrs)
    363 num_channels = len([ 
    364   chan for chan in zattrs["omero"]["channels"] if chan["active"] 
    365 ])
    367 if not zarrays:
--> 368   raise exceptions.InfoUnavailableError()
    370 base_res = self.spatial_resolution_in_nm(0, zattrs, zarrays)
    372 info = PrecomputedMetadata.create_info(
    373   num_channels=num_channels,
    374   layer_type='image',
   (...)
    380   chunk_size=zarrays[0]["chunks"][2:][::-1],
    381 )

InfoUnavailableError:

Somewhere in that message it says Cloud Path Recieved: zarr2://zarr://file:///Users/dstansby/notebooks/hipct/meshgen/4, which doesn't seem right - there's two protocol identifiers on the front (zarr and zarr2), despite the fact I only passed zarr in the CloudVolume call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe code is not performing according to the design or a design flaw is seriously impacting users.zarrzarr format related.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions