Skip to content

Numpy 2.0 Compatibility  #604

Closed
Closed

Description

@jbpezent

The recently released numpy 2.0 appears to be incompatible with latest basemap version 1.4.1. Seems to be a common issue with packages compiled against older versions of numpy. Issue observed on windows 11 with python 3.9 when importing basemap.

BaseMapError

Activity

  1. DWesl commented on Jun 20, 2024

    @DWesl
    Contributor

    As I recall, the fix for this would be adding metadata to the effect of requires: numpy<2.0 to existing binary wheels and (re-)compiling new binary wheels with numpy>=2.0,<3.

    In the meantime, installing basemap from source with pip install --force-reinstall --no-binary :all: basemap should work until basemap does a new release with new binaries (1.4.1post1 might be fastest, but the maintainers might be close enough to 1.4.2 to wait for that). (EDIT: This will compile NumPy and Matplotlib from source, so it will likely take half an hour to an hour)

  2. valeriupredoi commented on Jun 25, 2024

    @valeriupredoi

    @DWesl I can just go open a PR at feedstock with the new pin, and create a new build, in the meantime, if you OK with that? If basemap does indeed support numpy>=2.0.0 at upstream (here), that is 🍺

  3. cvanelteren commented on Sep 5, 2024

    @cvanelteren
    Contributor

    Was able to make it work with

    git clone --depth 1 https://github.com/matplotlib/basemap.git
    cd basemap/packages/basemap
    pip install --force-reinstall --no-binary :all: basemap
    

    Thanks!

  4. DWesl commented on Sep 10, 2024

    @DWesl
    Contributor

    @DWesl I can just go open a PR at feedstock with the new pin, and create a new build, in the meantime, if you OK with that? If basemap does indeed support numpy>=2.0.0 at upstream (here), that is 🍺

    My platform only has up to Python 3.9, so I'm not able to check anything with NumPy 2.0 until someone works out how to compile Python 3.12 there and packages it.

  5. molinav commented on Sep 10, 2024

    @molinav
    Member

    My main concern while I keep the pin numpy<2.0 for now is that NumPy 2.0 brings some API breaking changes that have been waiting around for some years. Since basemap was started very long ago, I would not be surprised that basemap has some old ways of doing things (e.g. using NumPy members that were removed or moved somewhere else).

    Because of that, I would like to invest a bit of time reviewing the source code before pushing a new release with potential bugs (note that the test collection is quite limited). Unfortunately, I have been a bit busy in the last months, but I have not still forgotten the latest open issues and PR.

  6. cvanelteren commented on Jan 8, 2025

    @cvanelteren
    Contributor

    Any news on this?

  7. cvanelteren commented on Jan 24, 2025

    @cvanelteren
    Contributor

    Can you checkout #611? If there are some issues I can include it in the PR

  8. molinav commented on Feb 24, 2025

    @molinav
    Member

    This issue is solved by @cvanelteren's PR #614 and it will be available when basemap 2.0.0 gets released soon.

  9. cvanelteren commented on Feb 24, 2025

    @cvanelteren
    Contributor

    The issue is solved by both of us @molinav -- credit where credit is due;-)

  10. rgommers commented on Apr 13, 2025

    @rgommers

    Hi @molinav, can I ask about expected timing for the basemap 2.0.0 release? I am asking both because I'm tracking it upstream in the NumPy 2.0 ecosystem support tracker, and because the incompatibility with numpy 2.x came up as a blocker in a project I'm involved in regarding testing free-threaded CPython, which requires upgrading lots of packages to support latest NumPy and CPython.

  11. cvanelteren commented on Apr 20, 2025

    @cvanelteren
    Contributor

    2 PRs exist to make this possible (#623 and #622). I would also kindly request to merge these at the earliest convenience to make development on our end progress. Perhaps merge rights can be expanded if time is not available on your end @molinav

  12. GalenReich commented on May 7, 2025

    @GalenReich

    Looking forward to the v2 release 🙌

  13. molinav commented on May 7, 2025

    @molinav
    Member

    @rgommers @cvanelteren @GalenReich Sorry for not being reachable lately. My brain needed to disconnect from technology for some weeks.

    I just came back recently, I am currently catching up on my duties, and I will allocate some time in the upcoming days to finish with this major milestone in the basemap package. Thank you for your patience and sorry for the inconveniences!

  14. cvanelteren commented on May 7, 2025

    @cvanelteren
    Contributor

    @molinav no worries, happy you are up and running. Let me know if you need any help.

  15. cvanelteren commented on May 21, 2025

    @cvanelteren
    Contributor

    Any movement on this @molinav?

  16. rgommers commented on Jun 12, 2025

    @rgommers

    Another gentle ping on this.

    I'll note that basemap is under the Matplotlib umbrella, which conveys a certain credibility. If it's not really going to be maintained going forward, it may also be worth considering at least soft-deprecating it and referring users to other packages that offer similar functionality (like cartopy, as done in the incoming ultraplot link right above this comment). That's not necessarily what I'd like to see happen, but it's been a year since the NumPy 2.0 release and 8 months since the Python 3.13.0 release now, and the lack of activity here is causing real-world problems.

  17. WeatherGod commented on Jun 12, 2025

    @WeatherGod
    Member
  18. cvanelteren commented on Jun 12, 2025

    @cvanelteren
    Contributor

    I’d love to help move this project forward and think we could benefit from expanding the maintainer team. I have two PRs that would get us over the finish line for NumPy 2.0 support, which feels like a meaningful milestone.

    From what I can see, the ongoing maintenance burden is pretty light - mostly just occasional fixes when dependencies introduce breaking changes. The main challenge right now seems to be review bandwidth rather than technical complexity.

    What are your thoughts on bringing on additional maintainers or contributors with merge rights? I’m happy to help with the transition and ongoing maintenance if that would be useful.

  19. cvanelteren commented on Jun 16, 2025

    @cvanelteren
    Contributor

    Thanks so much for your work on the numpy issues, @molinav! I really appreciate the progress you've made. I'd love to get your thoughts on my comment above when you have a chance.
    Looking ahead, I'm wondering if we might consider expanding our contributor base with a good review process in place. This could help keep development moving smoothly rather than having everything depend on one person's availability. What do you think about exploring that approach?

  20. valeriupredoi commented on Jun 16, 2025

    @valeriupredoi

    @molinav you and the others are legends, great many thanks! I have just updated the deps in one of our packages, and all looks to be spiffy with basemap 2.0 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions