zarr-developers / numcodecs

A Python package providing buffer compression and transformation codecs for use in data storage and communication applications.
http://numcodecs.readthedocs.io
MIT License
121 stars 82 forks source link

0.12.1: `cannot import name 'MsgPack' from 'numcodecs'` in numcodecs/__init__.py #526

Open kloczek opened 1 month ago

kloczek commented 1 month ago

Looks like on testing zarr has been exposed probably missing msgpack import (and missing install time dependency of that module as well if I'm right).

_________________________________________________________________________ ERROR collecting zarr/tests/test_core.py __________________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/zarr-python-2.18.1/zarr/tests/test_core.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
zarr/tests/test_core.py:13: in <module>
    from numcodecs import (
E   ImportError: cannot import name 'MsgPack' from 'numcodecs' (/usr/lib64/python3.10/site-packages/numcodecs/__init__.py)
jakirkham commented 1 month ago

It is an optional dependency in Numcodecs

https://github.com/zarr-developers/numcodecs/blob/79a0e933d78a51f32237b29fc375d0ee27aace37/pyproject.toml#L63-L65

Users need to install it if they need it

Edit: If Zarr needs this, then they should also add numcodecs[msgpack] where appropriate

jakirkham commented 1 month ago

Could you please raise this issue on the Zarr repo?

Feel free to cc me there

kloczek commented 1 month ago

Whatever will import numcodecs.MsgPack will fail (and zarr test suite is doing that) so this is IMO not kind of optional dependency 🤔