Skip to content
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

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

Open
kloczek opened this issue May 17, 2024 · 6 comments

Comments

@kloczek
Copy link

kloczek commented May 17, 2024

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
Copy link
Member

jakirkham commented May 17, 2024

It is an optional dependency in Numcodecs

numcodecs/pyproject.toml

Lines 63 to 65 in 79a0e93

msgpack = [
"msgpack",
]

Users need to install it if they need it

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

@jakirkham
Copy link
Member

Could you please raise this issue on the Zarr repo?

Feel free to cc me there

@kloczek
Copy link
Author

kloczek commented May 17, 2024

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

@dstansby
Copy link
Contributor

I've been running into this recently, and it's not obvious from the error message that it can be fixed by installing numcodecs[msgpack]. I think there's two actions to take here:

  • Make zarr depend on numcodecs[msgpack]
  • Add a better error message here in numcodecs explaining how to fix this error

@joshmoore
Copy link
Member

  • Make zarr depend on numcodecs[msgpack]

...as a test dependency?

@dstansby
Copy link
Contributor

Oh yeah, it looks like it's already a test dependency. So I guess worth just having a better error message here (if that's possible?) Help with this very welcome!

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

No branches or pull requests

4 participants