Skip to content

[Python] Require numpy 2.x #48473

Closed
Closed

Description

@alippai

Describe the enhancement requested

Numpy 1.26 (last of the 1.x version) has reached end of life in September 2025

Component(s)

Python, Packaging, Release, Documentation, Integration

Activity

  1. changed the title [-]Drop numpy 1.x support[/-] [+]Require numpy 2.x and pandas 2.x[/+] on Dec 12, 2025
  2. changed the title [-]Require numpy 2.x and pandas 2.x[/-] [+][Python] Require numpy 2.x and pandas 2.x[/+] on Dec 12, 2025
  3. pitrou commented on Dec 12, 2025

    @pitrou
    Member

    @jorisvandenbossche @rok @AlenkaF Does this sound reasonable?

  4. rok commented on Dec 12, 2025

    @rok
    Member

    Last 1.x was more than 24 months ago, so it sounds ok. I would appreciate @jorisvandenbossche 's opinion though.

  5. jorisvandenbossche commented on Dec 12, 2025

    @jorisvandenbossche
    Member

    Yes, definitely, it is time to drop pandas 1.x support

    For numpy 1.26 we might want wait a bit longer, although nowadays I think most projects have updated

  6. jorisvandenbossche commented on Dec 19, 2025

    @jorisvandenbossche
    Member

    Recommendation from NumPy developer to only drop 1.26 the earliest mid 2026: scientific-python/specs#386 (comment) (and as Arrow, we might even want to be a bit more conservative)

  7. pitrou commented on Dec 19, 2025

    @pitrou
    Member

    Recommendation from NumPy developer to only drop 1.26 the earliest mid 2026: scientific-python/specs#386 (comment) (and as Arrow, we might even want to be a bit more conservative)

    I see. Well, it depends what the cost is for us of still supporting 1.26, I'd say.

  8. changed the title [-][Python] Require numpy 2.x and pandas 2.x[/-] [+][Python] Require numpy 2.x[/+] on Jan 12, 2026
  9. raulcd commented on Apr 2, 2026

    @raulcd
    Member

    We should remove this fix from the musllinux wheels dockerfile when bumping numpy:
    #49639

  10. 24 remaining items

  11. ngoldbaum commented on Aug 6, 2026

    @ngoldbaum
    Contributor

    Do you mean "cleaner" code-wise? i.e. that it is easier to use numpy 2.0 C API things when requiring numpy 2?

    I looked at this today and it turns out it should be possible to get StringDType support working while still allowing NumPy 1.26 at runtime. The extra complexity is that to work with StringDType from C++, you'll need to use the NpyString C API, which is only available on NumPy 2.0 and newer.

    If I have NumPy 1.26 installed and I try to import an extension that declares that it needs to use the NumPy 2.0 C API by setting NPY_TARGET_VERSION=NPY_2_0_API_VERSION, I'll see an ImportError at runtime inside of NumPy's C import_array() hook.

    However, only one extension module needs to do this: all of PyArrow extension modules don't need to use the new NumPy C API version. Instead, you could put the things that need the NumPy 2.0 C API into their own extension module that needs NumPy 2.0 or newer at runtime. Then, you could only import that extension after doing the "regular" numpy import and checking NumPy's version to see if NumPy 2.0 is available at runtime.

    So, not too bad, but definitely more complicated than #48473. I pinged the arrow-dev mailing list to see if anyone would be annoyed with dropping runtime support for older NumPy versions.

    I double-checked and arrow's wheel builds already have a numpy>=2.0.0 bound in the requirements files and Arrow's CI already explicitly tests against NumPy 1.X at runtime to make sure NumPy's simultaneous backward and forward compatibility trick works in-practice.

  12. alippai commented on Aug 7, 2026

    @alippai
    ContributorAuthor

    I made the working PR with the old API a few months ago and there was some pushback that it's confusing, hard to read.
    That can be revived if there is interest, but I believe the NumPy 2.0 should be a solid choice for Arrow 26.

    The extension module trick is cool. Alternatively you can infer that python 3.13-3.14 is Numpy 2.0 for sure (and skip new numpy api support for python 3.10-3.12).

    scientific-python/specs#386 (comment) here is a new update on the SPEC0 confirming the change.

    While we officially don't follow SPEC0, they already dropped NumPy 2.0 and they are dropping NumPy 2.1 now.

  13. added 5 commits that reference this issue on Aug 11, 2026
  14. added 5 commits that reference this issue on Aug 21, 2026
  15. added a commit that references this issue on Aug 21, 2026
  16. raulcd commented on Aug 21, 2026

    @raulcd
    Member

    Issue resolved by pull request 50769
    #50769

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions