Skip to content

Tests fail when using NumPy 2.0 #59

@maxrjones

Description

@maxrjones

All the titiler-xarray tests fail when using NumPy 2.0, with ERROR tests/test_app.py::test_get_variables_test - ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Here's the full traceback for one of the failures:

_________________________________________________________________________________________ ERROR at setup of test_get_variables_test _________________________________________________________________________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x108495f10>

    @pytest.fixture
    def app(monkeypatch):
        """App fixture."""
        monkeypatch.setenv("TITILER_XARRAY_DEBUG", "TRUE")
        monkeypatch.setenv("TEST_ENVIRONMENT", "1")
    
>       from titiler.xarray.main import app

tests/conftest.py:13: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
titiler/xarray/main.py:5: in <module>
    import rioxarray
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/rioxarray/__init__.py:5: in <module>
    import rioxarray.raster_array  # noqa
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/rioxarray/raster_array.py:22: in <module>
    import xarray
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/xarray/__init__.py:3: in <module>
    from xarray import testing, tutorial
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/xarray/testing/__init__.py:1: in <module>
    from xarray.testing.assertions import (  # noqa: F401
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/xarray/testing/assertions.py:9: in <module>
    import pandas as pd
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/pandas/__init__.py:22: in <module>
    from pandas.compat import is_numpy_dev as _is_numpy_dev  # pyright: ignore # noqa:F401
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/pandas/compat/__init__.py:18: in <module>
    from pandas.compat.numpy import (
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/pandas/compat/numpy/__init__.py:4: in <module>
    from pandas.util.version import Version
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/pandas/util/__init__.py:2: in <module>
    from pandas.util._decorators import (  # noqa:F401
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/pandas/util/_decorators.py:14: in <module>
    from pandas._libs.properties import cache_readonly
/Users/max/miniforge3/envs/titiler-xarray/lib/python3.11/site-packages/pandas/_libs/__init__.py:13: in <module>
    from pandas._libs.interval import Interval
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   ???
E   ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

pandas/_libs/interval.pyx:1: ValueError

These is likely a Pandas issue, but I'm just raising an issue for now until I have more time to look into it. I'm going to open a separate PR to temporarily pin NumPy to unblock some work.

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