Skip to content

Support using dev versions of numcodecs with zstd #2422

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

Closed
wants to merge 1 commit into from

Conversation

maxrjones
Copy link
Member

@maxrjones maxrjones commented Oct 20, 2024

I received the following error when using zstd with '0.13.2.dev40' (from pip install git+https://github.com/zarr-developers/numcodecs@zarr3-codecs). This change only uses the X.Y.Z part from the version when checking compatibility:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[11], line 12
      8 ds = xr.open_zarr(virtual_store, zarr_version=3, consolidated=False)
      9 ds = ds.drop_encoding()
     10 encoding = {
     11     variable: {
---> 12         "codecs": [zarr.codecs.BytesCodec(), zarr.codecs.ZstdCodec()],
     13         "chunks": (1, 4096, 4096)
     14     }
     15 }
     16 ds.to_zarr(output_uri, zarr_version=3, mode="w", encoding=encoding, storage_options={"use_listings_cache": False})

File /opt/conda/lib/python3.11/site-packages/zarr/codecs/zstd.py:46, in ZstdCodec.__init__(self, level, checksum)
     44 def __init__(self, *, level: int = 0, checksum: bool = False) -> None:
     45     # numcodecs 0.13.0 introduces the checksum attribute for the zstd codec
---> 46     _numcodecs_version = tuple(map(int, version("numcodecs").split(".")))
     47     if _numcodecs_version < (0, 13, 0):  # pragma: no cover
     48         raise RuntimeError(
     49             "numcodecs version >= 0.13.0 is required to use the zstd codec. "
     50             f"Version {_numcodecs_version} is currently installed."
     51         )

ValueError: invalid literal for int() with base 10: 'dev40'

@jhamman
Copy link
Member

jhamman commented Oct 20, 2024

I also fixed this over in #2418. I think I prefer that fix. What do you think @maxrjones ?

@maxrjones
Copy link
Member Author

I also fixed this over in #2418. I think I prefer that fix. What do you think @maxrjones ?

👍 yup, that's better

@maxrjones maxrjones closed this Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants