Skip to content

[Bug]: conda solver picks numpy-2-incompatible regionmask 0.4.0 alongside xcdat in some envs #837

Description

@will-s-hart

What happened?

When creating a conda environment containing xcdat alongside certain other dependencies (I hit it with geoviews), the (libmamba) solver picks an old version of regionmask (0.4.0). That version isn't compatible with numpy 2 — it uses the now-removed np.NaN — so import xcdat fails with an AttributeError (full traceback in the log section below).

The trap doesn't appear with conda create -c conda-forge xcdat alone — it only triggers when xcdat is combined with certain other packages. Forcing regionmask>=0.11 on the install command line resolves cleanly, so the solver has no trouble finding a numpy-2-compatible regionmask when asked (it just for some reason doesn't pick one by default).

What did you expect to happen? Are there are possible answers you came across?

While this isn't strictly an xcdat issue, I wonder whether it would be worth pinning regionmask >=0.11 (this appears to be the first numpy 2 compatible release - regionmask/regionmask#440) here.

Minimal Complete Verifiable Example (MVCE)

conda create -n xcdat_test -c conda-forge xcdat geoviews
conda activate xcdat_test
python -c "import xcdat"

Relevant log output

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import xcdat
  File "/opt/homebrew/Caskroom/miniforge/base/envs/xcdat_test/lib/python3.14/site-packages/xcdat/__init__.py", line 25, in <module>
    from xcdat.spatial import SpatialAccessor  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/xcdat_test/lib/python3.14/site-packages/xcdat/spatial.py", line 18, in <module>
    from xcdat.mask import (
    ...<2 lines>...
    )
  File "/opt/homebrew/Caskroom/miniforge/base/envs/xcdat_test/lib/python3.14/site-packages/xcdat/mask.py", line 4, in <module>
    import regionmask
  File "/opt/homebrew/Caskroom/miniforge/base/envs/xcdat_test/lib/python3.14/site-packages/regionmask/__init__.py", line 15, in <module>
    from .core.regions import Regions_cls, Region_cls
  File "/opt/homebrew/Caskroom/miniforge/base/envs/xcdat_test/lib/python3.14/site-packages/regionmask/core/regions.py", line 17, in <module>
    from .mask import _mask
  File "/opt/homebrew/Caskroom/miniforge/base/envs/xcdat_test/lib/python3.14/site-packages/regionmask/core/mask.py", line 214, in <module>
    def create_mask_contains(lon, lat, coords, fill=np.NaN, numbers=None):
                                                    ^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/xcdat_test/lib/python3.14/site-packages/numpy/__init__.py", line 778, in __getattr__
    raise AttributeError(
    ...<3 lines>...
    )
AttributeError: `np.NaN` was removed in the NumPy 2.0 release. Use `np.nan` instead.

Anything else we need to know?

As an aside, mamba (standalone) consistently picks regionmask 0.13.0 in the same install command — only conda (with libmamba solver) falls into the trap.

Environment

xcdat 0.11.2

INSTALLED VERSIONS

commit: None
python: 3.14.5 | packaged by conda-forge | (main, May 20 2026, 00:45:47) [Clang 20.1.8 ]
python-bits: 64
OS: Darwin
OS-release: 25.3.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.6
libnetcdf: 4.10.0

xarray: 2026.4.0
pandas: 3.0.3
numpy: 2.4.6
scipy: 1.17.1
netCDF4: 1.7.4
pydap: None
h5netcdf: None
h5py: None
zarr: None
cftime: 1.6.5
nc_time_axis: None
iris: None
bottleneck: None
dask: 2026.3.0
distributed: 2026.3.0
matplotlib: 3.10.9
cartopy: 0.25.0
seaborn: None
numbagg: None
fsspec: 2026.4.0
cupy: None
pint: None
sparse: 0.18.0
flox: None
numpy_groupies: None
setuptools: 82.0.1
pip: 26.1.1
conda: None
pytest: None
mypy: None
IPython: None
sphinx: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugInconsistencies or issues which will cause an issue or problem for users or implementors.

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions