import error with Zarr version 3.0.0
hi all, zarr 3.0.0 was released several days ago, and there seems to be an incompatibility in tiffslide.
i installed tiffslide with the latest zarr and saw an ImportError: "cannot import name 'BaseStore' from 'zarr.storage'". installing zarr<3.0 fixed that error.
$ python -m pip install tiffslide
$ python -c 'import tiffslide'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/fo/venv/lib/python3.12/site-packages/tiffslide/__init__.py", line 9, in <module>
from tiffslide.tiffslide import PROPERTY_NAME_BACKGROUND_COLOR
File "/private/tmp/fo/venv/lib/python3.12/site-packages/tiffslide/tiffslide.py", line 41, in <module>
from tiffslide._zarr import get_zarr_depth_and_dtype
File "/private/tmp/fo/venv/lib/python3.12/site-packages/tiffslide/_zarr.py", line 17, in <module>
from zarr.storage import BaseStore
ImportError: cannot import name 'BaseStore' from 'zarr.storage' (/private/tmp/fo/venv/lib/python3.12/site-packages/zarr/storage/__init__.py)
i'm not sure how to fix the code on the tiffslide part. there is zarr.abc.store.Store, which is an abstract base class. there is also zarr.storage.StoreLike.
Thanks for reporting!
We just pin zarr<3 and release a new version.
Moving to zarr 3 will require more refactoring.
Would you be willing to make the PR?
Cheers, Andreas 😊
yes, i can do that
Seems like there are more issues now...
https://github.com/Bayer-Group/tiffslide/actions/runs/12770125583/job/35594233326
Needs some further investigation.
here's a snippet of some of the errors:
FAILED tiffslide/tests/test_tiffslide.py::test_read_region_nopadding_oob[generated-pyramidal-1ch-16b-svs] - NotImplementedError: series with axes='ZYX' not supported yet
FAILED tiffslide/tests/test_tiffslide.py::test_padding_no_padding[generated-pyramidal-1ch-16b-svs] - NotImplementedError: series with axes='ZYX' not supported yet
FAILED tiffslide/tests/test_tiffslide.py::test_padding_br_on_nonzero_level[generated-pyramidal-1ch-16b-svs] - NotImplementedError: series with axes='ZYX' not supported yet
FAILED tiffslide/tests/test_tiffslide.py::test_no_numpy_scalar_overflow[generated-pyramidal-1ch-16b-svs] - NotImplementedError: series with axes='ZYX' not supported yet
FAILED tiffslide/tests/test_zarr.py::test_get_chunk_sizes[generated-pyramidal-1ch-16b-svs] - NotImplementedError: series with axes='ZYX' not supported yet
FAILED tiffslide/tests/test_zarr.py::test_decode_only_once[generated-pyramidal-1ch-16b-svs] - NotImplementedError: series with axes='ZYX' not supported yet
looks like the errors are all coming from https://github.com/Bayer-Group/tiffslide/blob/d1ef04a6fa1d7b528edaf78bdb684b9ed8263c51/tiffslide/tiffslide.py#L719
the tests are using zarr 2.18.4, so 3x isn't the issue.
Probably caused by some combination of kerchunk and/or/xor tifffile that need pinning too...
i can reproduce the error on my local machine, with a fresh install of the main branch of tiffslide and a fresh pip install -e .[dev]. i tested different versions of tifffile, and the version v2024.8.24 is the earliest version that causes the error in tiffslide.
taking a look at the diffs between v2024.8.24 and the latest working version, v2024.8.10, there was a change regarding axes.
changing this line fixes the tests that errored with the ZYX error:
- "metadata": None,
+ "metadata": {"axes": "YX"},
but then tifffile has the following complaints:
ERROR tifffile:tifffile.py:4907 <tifffile.TiffFile '_small_pyramid_2.svs'> shaped series axes do not match shape
ERROR tifffile:tifffile.py:4886 <tifffile.TiffFile '_small_pyramid_2.svs'> invalid shaped series metadata or corrupted file