Repository navigation
Drop NumPy 1.x and refuse it at import time - #3754
Merged
Merged
Conversation
install_requires now says numpy >=2.0, and xrspatial/__init__.py
imports a one-function module first that raises
ImportError: xarray-spatial requires NumPy 2.0 or newer, found 1.26.4
before any submodule loads. The min-deps job went red on 2026-10-10
when pyarrow 26.0.0 shipped: it needs numpy 2 but declares no numpy
requirement, so pip installed it beside the pinned numpy 1.26.0 and the
failure surfaced as an AttributeError in zonal three frames from the
cause (#3751). numba's own numpy check has the same shape.
The other floors move to their first numpy-2-capable releases so the
min-deps job can still install the set it declares: numba 0.60, scipy
1.13, pandas 2.2.2. The setup.cfg derivation comments and the min-deps
pins follow.
Closes #3751.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3751.
NumPy 1.x is no longer supported.
install_requiresnow saysnumpy >=2.0,<2.5, andxrspatial/__init__.pyimports a one-function module first that raises before anything else loads:Why an import-time check and not just metadata
The
min-depsjob went red on 2026-10-10 when pyarrow 26.0.0 came out. pyarrow 26 needs numpy 2 but declares no numpy requirement at all in its metadata, so pip installed it next to the pinned numpy 1.26.0 without complaint. The failure then showed up asAttributeError: 'NoneType' object has no attribute 'concat'in 30 dask zonal tests, because zonal'simport dask.dataframeguard swallowed the real ImportError. numba's own numpy check has the same shape: it fires inside a submodule import, several frames away from the cause. A check on the first line of the package turns both into one sentence naming the version found.Floors that moved with it
Raising numpy to 2.0 means the other floors have to be releases that actually work with numpy 2, or the min-deps job cannot install the set it is meant to test:
numpy<1.27)numpy<1.28)numpy<2capThe derivation comment block in
setup.cfgis updated to match, and themin-depspins becomenumba==0.60.0 scipy==1.13.0 numpy==2.0.0 pandas==2.2.2(xarray, urllib3 and zstandard unchanged).Tests
test_numpy_floor.py: the check rejects 1.x strings (including dev builds) with the version in the message, passes 2.x and later, and passes on the installed numpy.test_dependency_metadata_3701.py: newtest_numpy_floor_is_twoasserts the metadata agrees with the check.import xrspatialraises the message above and nothing else.pip install -e .[tests]with the pins resolves (numpy 2.0.0, numba 0.60.0, scipy 1.13.0, pandas 2.2.2, pyarrow 26.0.0 all import together) and the fast lane gives 11003 passed, 1 failed. The one failure is the Hypothesis fuzz case in geotiff: a single corrupt byte in ModelTiepointTag raises NotImplementedError instead of a typed parse error #3752, replayed from the local example database; it is unrelated to numpy.Note for #3753: that PR moves the numpy cap to
<2.6on the same line. Whichever merges second needs a one-line rebase.