GeezerVison is showing github.com — SPEC 0: Bump minimum supported version to NumPy 2.0 and Xarray 2024.5 by seisman · Pull Request #4090 · GenericMappingTools/pygmt
Conversation
seisman
commented
Sep 16, 2025
•
edited by weiji14
Loading
Uh oh!
There was an error while loading. Please reload this page.
Following SPEC0 policy, NumPy 1.26 should be dropped in 2025 quarter 3.
Bumps the minimum supported NumPy version to 2.0 in the following files:
-
.github/workflows/ci_tests.yaml
-
.github/workflows/ci_tests_legacy.yaml
-
environment.yml
-
pyproject.toml
-
requirements.txt
- Remove workarounds for unsupported versions
Supersedes #3916, closes #3445
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
https://github.com/GenericMappingTools/pygmt/actions/runs/17768889118/job/50499354183?pr=4090
The Python 3.11 CI job fails with the following error:
error libmamba Could not solve for environment specs
The following packages are incompatible
├─ numpy =2.0 * is requested and can be installed;
└─ xarray =2023.7 * is not installable because it requires
└─ numpy >=1.21,<2.0a0 *, which conflicts with any installable versions previously reported.
critical libmamba Could not solve for environment specs
Likely need to bump xarray first. See #4091.
The Python 3.11 CI job has two failing tests due to the removal of the conftest.py file. The failures are related to #2628. I think we should fix them to match the behavior of NumPy>=2.0
=================================== FAILURES ===================================
__________________ [doctest] pygmt.datatypes.image._GMT_IMAGE __________________
063 1 0
064 >>> x # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
065 array([-179.5, -178.5, ..., 178.5, 179.5])
066 >>> y # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
067 array([ 89.5, 88.5, ..., -88.5, -89.5])
068 >>> data.dtype
069 dtype('uint8')
070 >>> data.shape
071 (180, 360, 3)
072 >>> data.min(), data.max()
Expected:
(10, 255)
Got:
(np.uint8(10), np.uint8(255))
/home/runner/work/pygmt/pygmt/pygmt/datatypes/image.py:72: DocTestFailure
_____________ [doctest] pygmt.datatypes.image._GMT_IMAGE.to_xarray _____________
109 --------
110 >>> from pygmt.clib import Session
111 >>> with Session() as lib:
112 ... with lib.virtualfile_out(kind="image") as voutimg:
113 ... lib.call_module("read", ["@earth_day_01d", voutimg, "-Ti"])
114 ... # Read the image from the virtual file
115 ... image = lib.read_virtualfile(voutimg, kind="image")
116 ... # Convert to xarray.DataArray and use it later
117 ... da = image.contents.to_xarray()
118 >>> da # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
Differences (unified diff with -expected +actual):
@@ -1,3 +1,3 @@
-<xarray.DataArray 'z' (band: 3, y: 180, x: 360)>...
+<xarray.DataArray 'z' (band: 3, y: 180, x: 360)> Size: 194kB
array([[[ 10, 10, 10, ..., 10, 10, 10],
[ 10, 10, 10, ..., 10, 10, 10],
@@ -22,9 +22,10 @@
[177, 179, 179, ..., 178, 177, 177],
[185, 187, 187, ..., 187, 186, 185],
- [189, 191, 191, ..., 191, 191, 189]]], dtype=uint8)
+ [189, 191, 191, ..., 191, 191, 189]]],
+ shape=(3, 180, 360), dtype=uint8)
Coordinates:
- * y (y) float64... 89.5 88.5 87.5 86.5 ... -86.5 -87.5 -88.5 -89.5
- * x (x) float64... -179.5 -178.5 -177.5 -176.5 ... 177.5 178.5 179.5
- * band (band) uint8... 1 2 3
+ * y (y) float64 1kB 89.5 88.5 87.5 86.5 ... -86.5 -87.5 -88.5 -89.5
+ * x (x) float64 3kB -179.5 -178.5 -177.5 -176.5 ... 177.5 178.5 179.5
+ * band (band) uint8 3B 1 2 3
Attributes:
- long_name: z
+ long_name: z
|
weiji14 reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
seisman
changed the title
SPEC 0: Bump minimum supported versions to NumPy 2.0
SPEC 0: Bump minimum supported version to NumPy 2.0
Sep 16, 2025
The following packages are incompatible
├─ numpy =2.0 * is requested and can be installed;
└─ xarray =2023.10 * is not installable because there are no viable options
├─ xarray 2023.10.0 would require
│ └─ numpy >=1.21,<2.0a0 *, which conflicts with any installable versions previously reported;
└─ xarray [2023.10.0|2023.10.1] would require
└─ numpy >=1.22,<2.0a0 *, which conflicts with any installable versions previously reported.
There is a numpy<2.0 pin set at conda-forge/conda-forge-repodata-patches-feedstock#728, we might need to bump xarray higher, to 2024.5.0 I think?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
https://github.com/GenericMappingTools/pygmt/actions/runs/17768889118/job/50499354183?pr=4090 The Python 3.11 CI job fails with the following error:
error libmamba Could not solve for environment specs
The following packages are incompatible
├─ numpy =2.0 * is requested and can be installed;
└─ xarray =2023.7 * is not installable because it requires
└─ numpy >=1.21,<2.0a0 *, which conflicts with any installable versions previously reported.
critical libmamba Could not solve for environment specs
Likely need to bump xarray first. See #4091.
Still failing. The minimum xarray version compatible with numpy 2.0 is xarray 2024.5:
$ mamba search xarray=2024.5 --info Loading channels: done
xarray 2024.5.0 pyhd8ed1ab_0
----------------------------
file name : xarray-2024.5.0-pyhd8ed1ab_0.conda
name : xarray
version : 2024.5.0
build : pyhd8ed1ab_0
build number: 0
size : 768 KB
license : Apache-2.0
subdir : noarch
url : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch/xarray-2024.5.0-pyhd8ed1ab_0.conda
md5 : e839fd0ae78a368c930f0b1feafa6736
timestamp : 2024-05-13 13:49:27 UTC
constraints :
- hdf5 >=1.12
- distributed >=2023.4
- nc-time-axis >=1.4
- cartopy >=0.21
- h5py >=3.8
- h5netcdf >=1.1
- toolz >=0.12
- dask-core >=2023.4
- pint >=0.22
- scipy >=1.10
- numba >=0.56
- cftime >=1.6
- seaborn-base >=0.12
- iris >=3.4
- zarr >=2.14
- flox >=0.7
- bottleneck >=1.3
- sparse >=0.14
- matplotlib-base >=3.7
- netcdf4 >=1.6.0
dependencies:
- numpy >=1.23
- packaging >=23.1
- pandas >=2.0
- python >=3.9
$ mamba search xarray=2024.3 --info
Loading channels: done
xarray 2024.3.0 pyhd8ed1ab_0
----------------------------
file name : xarray-2024.3.0-pyhd8ed1ab_0.conda
name : xarray
version : 2024.3.0
build : pyhd8ed1ab_0
build number: 0
size : 747 KB
license : Apache-2.0
subdir : noarch
url : https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/noarch/xarray-2024.3.0-pyhd8ed1ab_0.conda
md5 : 772d7ee42b65d0840130eabd5bd3fc17
timestamp : 2024-03-29 19:57:37 UTC
constraints :
- bottleneck >=1.3
- sparse >=0.13
- nc-time-axis >=1.4
- scipy >=1.8
- zarr >=2.12
- flox >=0.5
- netcdf4 >=1.6.0
- cartopy >=0.20
- h5netcdf >=1.0
- dask-core >=2022.7
- cftime >=1.6
- numba >=0.55
- hdf5 >=1.12
- iris >=3.2
- toolz >=0.12
- h5py >=3.6
- distributed >=2022.7
- matplotlib-base >=3.5
- seaborn-base >=0.11
- pint >=0.19
dependencies:
- numpy >=1.23,<2.0a0
- packaging >=22
- pandas >=1.5
- python >=3.9
I guess we need to either bump to xarray 2024.5 now or wait until 2026 quarter 2.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I guess we need to either bump to xarray 2024.5 now or wait until 2026 quarter 2.
xarray=2024.06.0 according to numpy/numpy#26191 (comment) (unsure if it's the repodata patch that's wrong, or that linked thread is wrong, but I did find pydata/xarray#8946).
How about we delay the numpy 2.0+ bump for another quarter, i.e. leave this PR in draft until November/December 2025?
|
seisman reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Sep 18, 2025
seisman
changed the title
SPEC 0: Bump minimum supported version to NumPy 2.0
SPEC 0: Bump minimum supported version to NumPy 2.0 and Xarray 2024.5
Oct 8, 2025
|
|
long_name: z
|
|
|
long_name: z
|
|
|
|
|
|
>>> da.coords["x"] # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS can be removed here
|
>>> da.coords["x"] # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS |
|
>>> da.coords["x"] |
Also can remove it at L118 above, and at
|
>>> raster.coords # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE |
Then you'll need to update the repr to include the Size: ?kB. Could maybe use https://github.com/max-sixty/pytest-accept to help automate this a little bit.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
weiji14
weiji14 approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
maintenance
Boring but important stuff for the core devs
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.
|