Skip to content

_dereference_path assertion error #3387

@zyndagj

Description

@zyndagj

Zarr version

v3.1.1

Numcodecs version

v0.16.1

Python Version

3.13.5

Operating System

Linux

Installation

conda

Description

zarr-python v3.1.1 show incorrect file information and throws the following assertion error

$ python zarr_3.1.1_error.py        
Name        :
Type        : Group
Zarr format : 2
Read-only   : True
Store type  : LocalStore
Traceback (most recent call last):
  File "/hpc/mydata/greg.zynda/index/setup_zebrafish_czbiohub/zarr_3.1.1_error.py", line 8, i
n <module>
    print(zarr_data[0].shape)
          ~~~~~~~~~^^^
  File "/hpc/mydata/greg.zynda/anaconda/25.3.1/x86_64/envs/zarr/lib/python3.13/site-packages/
zarr/core/group.py", line 1892, in __getitem__
    obj = self._sync(self._async_group.getitem(path))                                       
  File "/hpc/mydata/greg.zynda/anaconda/25.3.1/x86_64/envs/zarr/lib/python3.13/site-packages/
zarr/core/sync.py", line 208, in _sync
    return sync(
        coroutine,
        timeout=config.get("async.timeout"),
    )
  File "/hpc/mydata/greg.zynda/anaconda/25.3.1/x86_64/envs/zarr/lib/python3.13/site-packages/
zarr/core/sync.py", line 163, in sync
    raise return_result
  File "/hpc/mydata/greg.zynda/anaconda/25.3.1/x86_64/envs/zarr/lib/python3.13/site-packages/
zarr/core/sync.py", line 119, in _runner
    return await coro
           ^^^^^^^^^^
  File "/hpc/mydata/greg.zynda/anaconda/25.3.1/x86_64/envs/zarr/lib/python3.13/site-packages/
zarr/core/group.py", line 697, in getitem
    store_path = self.store_path / key
                 ~~~~~~~~~~~~~~~~^~~~~
  File "/hpc/mydata/greg.zynda/anaconda/25.3.1/x86_64/envs/zarr/lib/python3.13/site-packages/
zarr/storage/_common.py", line 238, in __truediv__                                          
    return self.__class__(self.store, _dereference_path(self.path, other))                  
                                      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^                   
  File "/hpc/mydata/greg.zynda/anaconda/25.3.1/x86_64/envs/zarr/lib/python3.13/site-packages/
zarr/storage/_common.py", line 35, in _dereference_path                                     
    assert isinstance(path, str)
           ~~~~~~~~~~^^^^^^^^^^^
AssertionError

while zarr-python v2.18.7 does not

$ conda list | grep -E "(zarr|python|numcodecs)"
# packages in environment at /hpc/mydata/greg.zynda/anaconda/25.3.1/x86_64/envs/zarr2:      
msgpack-python             1.1.1            py313h33d0bda_0       conda-forge               
numcodecs                  0.15.1           py313ha87cce1_0       conda-forge               
python                     3.13.5           hec9711d_102_cp313    conda-forge               
python_abi                 3.13             8_cp313               conda-forge               
zarr                       2.18.7           pyhd8ed1ab_0          conda-forge               
$ python zarr_3.1.1_error.py       
Name        : /
Type        : zarr.hierarchy.Group
Read-only   : True
Store type  : zarr.storage.DirectoryStore
No. members : 3
No. arrays  : 3
No. groups  : 0
Arrays      : 0, 1, 2

(791, 1, 448, 2174, 2423)

I am rather new to the zarr format, so I may just not understand that these operations shouldn't work on v3.

Steps to reproduce

#! /usr/bin/env python

import zarr

zarr_data = zarr.open('../single-objective/ZSNS001.ome.zarr/',mode='r')                     
print(zarr_data.info)
print(zarr_data[0].shape)

This zarr file can be downloaded from https://public.czbiohub.org/royerlab/zebrahub/imaging/single-objective/ZSNS001.ome.zarr

Additional output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPotential issues with the zarr-python library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions