Skip to content

NumPy 2 support #165

@jni

Description

@jni

Tensorstore is not currently compatible with NumPy 2.0, slated to be released on Jun 16. If I create an environment with Python 3.12, NumPy 2.0.0rc2, and TensorStore 0.1.60:

$ pip list
Package     Version
----------- --------
ml-dtypes   0.4.0
numpy       2.0.0rc2
pip         24.0
setuptools  70.0.0
tensorstore 0.1.60
wheel       0.43.0

then run python -c "import tensorstore", I get the following error:

Traceback (most recent call last):  File "<string>", line 1, in <module>
  File "/Users/jni/micromamba/envs/np2/lib/python3.12/site-packages/tensorstore/__init__.py", line 19, in <module>
    from ._tensorstore import *
Traceback (most recent call last):
  File "/Users/jni/micromamba/envs/np2/lib/python3.12/site-packages/numpy/core/_multiarray_umath.py", line 44, in __getattr__
    raise ImportError(msg)
ImportError:
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0rc2 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

I couldn't find any reference to this in the repo so thought I'd flag it here so it's on the team's radar. On our end (napari) we can skip tensorstore tests if numpy >=2 is installed, but of course we'd love to have ts compatible with np2! 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions