GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@seisman seisman commented Sep 16, 2025 •
edited by weiji14
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

All reactions
seisman added 2 commits September 16, 2025 22:15
@seisman
SPEC 0: Bump minimum supported versions to NumPy 2.0
1abd1f2
@seisman
Remove workarounds for NumPy < 2.0
d1d79d2
@seisman seisman added this to the 0.17.0 milestone Sep 16, 2025
@seisman seisman added the maintenance Boring but important stuff for the core devs label Sep 16, 2025
@seisman
seisman marked this pull request as draft September 16, 2025 14:27
@seisman

seisman commented Sep 16, 2025

Copy link
Copy Markdown
Member Author

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman
seisman force-pushed the spec0/numpy branch from d14b09a to 70c70c3 Compare September 16, 2025 14:44
@seisman
Fix two tests due to the removal of conftest.py
5ce69a2
@seisman
seisman force-pushed the spec0/numpy branch from 70c70c3 to 5ce69a2 Compare September 16, 2025 14:48
@seisman 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
@seisman
Merge branch 'main' into spec0/numpy
88adf9a
@seisman
seisman marked this pull request as ready for review September 17, 2025 00:48
@seisman seisman added needs review This PR has higher priority and needs review. and removed needs review This PR has higher priority and needs review. labels Sep 17, 2025
@weiji14

weiji14 commented Sep 17, 2025

Copy link
Copy Markdown
Member
      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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman

seisman commented Sep 17, 2025

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@weiji14

weiji14 commented Sep 17, 2025

Copy link
Copy Markdown
Member

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
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman
seisman marked this pull request as draft September 17, 2025 02:03
@weiji14 weiji14 modified the milestones: 0.17.0, 0.18.0 Sep 17, 2025
This was referenced Sep 18, 2025
Remove the workaround for different DataArray representations in doctests #3445
Closed
Release PyGMT v0.17.0 #4100
Closed
seisman added 2 commits October 8, 2025 22:29
@seisman
Merge branch 'main' into spec0/numpy
f0753eb
@seisman
Bump to xarray 2024.5
1b97f25
@seisman 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
weiji14
weiji14 reviewed Oct 8, 2025
View reviewed changes
Comment thread pygmt/datatypes/image.py Outdated
long_name: z
long_name: z

>>> da.coords["x"] # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS

@weiji14 weiji14 Oct 8, 2025

Copy link
Copy Markdown
Member

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

Suggested change
>>> da.coords["x"] # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
>>> da.coords["x"]

Also can remove it at L118 above, and at

pygmt/pygmt/datasets/tile_map.py

Line 125 in f93bae4

>>> 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.

All reactions
seisman added 4 commits October 9, 2025 08:08
@seisman
Merge branch 'main' into spec0/numpy
5c7e25c
@seisman
Update to xarray repr for xarray>=2024.02
7d3c1d1
@seisman
Fix doctests
e1a0e4e
@seisman
Fix int to int64, but it may not work on Windows
0bc407b
@seisman
seisman marked this pull request as ready for review October 9, 2025 02:58
@seisman seisman added the needs review This PR has higher priority and needs review. label Oct 9, 2025
seisman added 2 commits October 12, 2025 21:45
@seisman
Merge branch 'main' into spec0/numpy
69e5417
@seisman
Merge branch 'main' into spec0/numpy
14c53bb
@seisman
seisman requested a review from a team October 14, 2025 13:07
weiji14
weiji14 approved these changes Oct 14, 2025
View reviewed changes
Comment thread requirements.txt

@weiji14 weiji14 Oct 14, 2025

Copy link
Copy Markdown
Member

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.

We can probably delete this requirements.txt file (in a separate PR). This was kept during the transition to pyproject.toml (#812 (comment)), and also because the view at https://github.com/GenericMappingTools/pygmt/network/dependencies didn't support pyproject.toml before, but now it does.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman
seisman merged commit 17d570e into main Oct 15, 2025
@seisman
seisman deleted the spec0/numpy branch October 15, 2025 00:26
@seisman seisman removed the needs review This PR has higher priority and needs review. label Oct 15, 2025
@seisman seisman mentioned this pull request Oct 15, 2025
Remove the requirements.txt file #4163
Merged
@seisman seisman mentioned this pull request May 22, 2026
SPEC 0: Bump minimum supported version to NumPy 2.1, pandas 2.3 and xarray 2024.7 #4650
Merged
5 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@weiji14 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

Projects

None yet

Milestone

0.18.0

Development

Successfully merging this pull request may close these issues.

Remove the workaround for different DataArray representations in doctests

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@seisman @weiji14
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.