Skip to content

[Bug]: ImportError: Numba needs NumPy 2.2 or less. Got NumPy 2.3. #775

@jypeter

Description

@jypeter

What happened?

I have at last updated my python environment on 2 different servers by removing the numpy<2 constraint. I got, at last, the latest xcdat (0.9.0) and xesmf (0.8.10) versions and asked one of our PhD students to test my environment

He came back right away telling me that he could not import xcdat, with a numba error that I can indeed reproduce (on both servers) : ImportError: Numba needs NumPy 2.2 or less. Got NumPy 2.3

Full traceback

 >python
Python 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xcdat
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/xcdat/__init__.py", line 13, in <module>
    from xcdat.regridder.accessor import RegridderAccessor  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/xcdat/regridder/__init__.py", line 1, in <module>
    from xcdat.regridder.accessor import RegridderAccessor  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/xcdat/regridder/accessor.py", line 6, in <module>
    from xcdat.regridder import regrid2, xesmf, xgcm
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/xcdat/regridder/regrid2.py", line 4, in <module>
    import sparse as sp
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/sparse/__init__.py", line 48, in <module>
    from sparse.numba_backend import *  # noqa: F403
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/sparse/numba_backend/__init__.py", line 85, in <module>
    from ._common import (
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/sparse/numba_backend/_common.py", line 8, in <module>
    import numba
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/numba/__init__.py", line 59, in <module>
    _ensure_critical_deps()
  File "/home/share/unix_files/cdat/miniconda3_2024-03/envs/bauer_env/lib/python3.12/site-packages/numba/__init__.py", line 45, in _ensure_critical_deps
    raise ImportError(msg)
ImportError: Numba needs NumPy 2.2 or less. Got NumPy 2.3.

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

Of course, I expected no error!

This seems very similar to ([Bug]: ImportError: Numba needs NumPy 2.1 or less. Got NumPy 2.2.
#744), with more recent version numbers

Are we shooting at a moving target? I will downgrade numpy with conda install "numpy<=2.2" as soon as I'm through with this bug report, but somebody (from numba?) should address this

Minimal Complete Verifiable Example (MVCE)

import xcdat

Relevant log output

Anything else we need to know?

No response

Environment

xCDAT = 0.9.0

>>> xr.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:23:07) [GCC 12.3.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1160.119.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.3
libnetcdf: 4.9.2

xarray: 2025.6.1
pandas: 2.3.0
numpy: 2.3.1
scipy: 1.15.2
netCDF4: 1.7.2
pydap: None
h5netcdf: None
h5py: None
zarr: 3.0.9
cftime: 1.6.4
nc_time_axis: None
iris: None
bottleneck: 1.5.0
dask: 2025.5.1
distributed: 2025.5.1
matplotlib: 3.10.3
cartopy: 0.24.0
seaborn: None
numbagg: None
fsspec: 2025.5.1
cupy: None
pint: 0.24.4
sparse: None
flox: None
numpy_groupies: 0.11.3
setuptools: 80.9.0
pip: 25.1.1
conda: None
pytest: None
mypy: None
IPython: 9.4.0
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

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions