What’s New in NumPy 2.1 to 2.5

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

This page was written in October 2026. The current release was NumPy 2.5.4 (2026-10-10). Examples target Python 3.13 or 3.14 and were run on Python 3.13, with NumPy 2.5.4. Release dates come from the NumPy files on PyPI, because the release-note pages of the manual do not print dates. Items from the development version are labelled upcoming; they are not in any release and may change before 2.6.0.

NumPy 2.0 (2024-06-16) is covered in Migrating to NumPy 2.x, because its changes are mostly breaking. This page covers what arrived afterwards and what you can use now. NumPy releases a minor version about every six months and a patch release every month or two; the 2.5 line was released on 2026-06-21.

Timeline of NumPy releases from 2.0 in June 2024 to the upcoming 2.6, with headline changes
Figure 1. NumPy 2.0 to 2.6: release dates and headline changes

Release summary

Release Date Python Headline

2.1.0

2024-08-18

3.10 to 3.13

numpy.unstack, array API 2023.12, DLPack v1, preliminary free-threaded Python 3.13

2.2.0

2024-12-08

3.10 to 3.13

matvec and vecmat, better typing, StringDType improvements, F2PY fixes

2.3.0

2025-06-07

3.11 to 3.13

numpy.strings.slice, OpenMP build option, array API 2024.12, Windows on ARM preview

2.4.0

2025-12-20

3.11 to 3.14

casting="same_value", ndmax, __numpy_dtype__, many removals

2.5.0

2026-06-21

3.12 to 3.14

descending=True sorts, numpy.distutils removed, eig always complex, Python 3.11 dropped

2.5.4 (patch)

2026-10-10

3.12 to 3.15

Fixes, svd and lstsq error on infinite inputs, Python 3.15 supported

2.6 (upcoming)

not released

not yet stated

Shape typing, top_k, minmax, mypy plugin removed

The minimum Python version moves with the Scientific Python SPEC 0 policy (SPEC 0 supports a Python version for 36 months and core packages for 24 months), which is why each release drops the oldest supported Python. See The Scientific Python Stack for the policy and Installation and Versions for how to install and pin a version.

NumPy 2.1 (2024-08-18)

Highlights: support for Python 3.13, the array API standard 2023.12, and preliminary support for free-threaded Python.

New and changed:

  • numpy.unstack(array, axis=0) splits an array into a tuple of arrays along an axis, the inverse of numpy.stack.

  • reshape accepts shape and copy keyword arguments; asanyarray accepts copy and device; numpy.astype accepts device.

  • numpy.cumulative_sum and numpy.cumulative_prod are array-API-compatible versions of cumsum and cumprod that can include a starting value.

  • numpy.clip accepts min and max keywords in place of a_min and a_max.

  • DLPack v1 is supported.

  • override_repr option for numpy.printoptions; the print options now live in a ContextVar, so they are thread- and asyncio-safe.

  • f2py --freethreading-compatible produces extension modules that keep the GIL disabled on free-threaded CPython.

  • numpy.save uses pickle protocol 4 for object arrays; ma.cov and ma.corrcoef are much faster.

import numpy as np

print(np.unstack(np.arange(6).reshape(2, 3)))
print(np.cumulative_sum([1, 2, 3], include_initial=True))

Output:

(array([0, 1, 2]), array([3, 4, 5]))
[0 1 3 6]

Compatibility notes worth reading: copyto and full now treat Python int and float scalars as safe casts under NEP 50, so np.copyto(int8_arr, 1000) always raises; floor, ceil and trunc no longer turn integer inputs into floats; the C-API symbols are hidden by default; and histogram auto-binning returns bin sizes of at least 1 for integer data. Deprecated: the fix_imports argument of numpy.save (removed in 2.4) and non-integer input to bincount (an error in 2.5).

NumPy 2.2 (2024-12-08)

Highlights: the new matvec and vecmat functions, many typing improvements, better StringDType support, better free-threading support and F2PY fixes.

  • numpy.matvec(A, v) multiplies a stack of matrices by a stack of column vectors; numpy.vecmat(v, A) multiplies a stack of vectors by a stack of matrices. Like vecdot, vecmat takes the complex conjugate of complex vectors on the left-hand side. matmul never conjugates.

  • Ufuncs got a __dict__ and a writable __doc__.

  • bool(np.array([])) and the truth value of any empty array now raises. Use arr.size > 0.

  • numpy.cov with a single-row 2-D input and rowvar=False returns an array instead of a scalar.

  • _add_newdoc_ufunc was deprecated.

print(np.matvec(np.eye(2), np.array([1.0, 2.0])), np.vecdot([1, 2, 3], [4, 5, 6]))

Output:

[1. 2.] 32

NumPy 2.3 (2025-06-07)

Highlights: interactive examples in the documentation (experimental, run in the browser through Pyodide), an OpenMP build option, preliminary Windows on ARM support, better free-threading support and better annotations. The array API version reported by NumPy moved from 2023.12 to 2024.12.

  • numpy.strings.slice slices every element of a string array natively, with full slice semantics.

  • np.unique uses a hash table for some dtypes and has a new sorted parameter, so the result may be unsorted unless you ask for sorted=True.

  • out=... (an Ellipsis) in a ufunc guarantees an array result instead of a scalar.

  • OpenMP: -Denable_openmp=true (off by default) lets np.sort and np.argsort run in parallel, up to 3.5 times faster on x86 with AVX2 or AVX-512.

  • np.matmul uses BLAS for non-contiguous operands by copying when needed; np.dot reports floating-point exceptions; np.isclose warns when atol or rtol is NaN or infinite.

  • Typing: numpy.typing.mypy_plugin and numpy.typing.NBitBase are deprecated. The dtype, ndarray and flatiter type parameters got defaults.

  • Removals (expired deprecations): np.tostring, the np.compat package, fromstring in binary mode, bincount(minlength=None), deprecated C macros such as NPY_OWNDATA, and several others.

  • Platform: Linux wheels use manylinux_2_28, dropping CentOS 7, Debian 9 and Ubuntu 18.04. Python 3.10 support was dropped.

print(np.strings.slice(np.array(["hello", "world"]), 1, 4))
print(np.unique(np.array([3, 1, 3, 2]), sorted=True))

Output:

['ell' 'orl']
[1 2 3]

Behaviour changes to check in your own results: count_nonzero(axis=None) returns a NumPy scalar, take_along_axis defaults to axis=-1, float16 and float32 switch to scientific notation based on precision (use np.printoptions(legacy="2.2") for the old output), and automatic histogram binning changed to avoid out-of-memory errors on low-variance data.

NumPy 2.4 (2025-12-20)

Highlights: better annotations, casting="same_value", a new C function for registering sort loops (PyUFunc_AddLoopsFromSpecs) and the __numpy_dtype__ protocol for dtype-like objects. Python 3.14 is supported.

  • casting="same_value" (currently in ndarray.astype only) raises ValueError if any value would change in the cast.

  • ndmax in numpy.array limits how many dimensions are created from nested sequences.

  • np.size accepts several axes; np.pad accepts a dict for pad_width; StringDType fill values work in masked arrays.

  • __numpy_dtype__ is checked in np.dtype(obj) and dtype= arguments, before .dtype.

  • Warnings: a ufunc with where= and no out= warns, since the unselected positions are uninitialised.

  • Deprecations: setting ndarray.strides, positional out in np.maximum and np.minimum, non-boolean align= in np.dtype, np.testing.assert_warns and suppress_warnings; pending: np.fix and in-place shape assignment.

  • Removals: np.trapz, np.in1d, interpolation= in the percentile and quantile family, newshape= in reshape, fix_imports in np.save, numpy.linalg.linalg, numpy.fft.helper, and conversion of an array with ndim > 0 to a scalar (a TypeError). np.sum(generator) now raises.

  • Compatibility: np.round always returns a copy; kind="heapsort" maps to quicksort; the x86 baseline is x86-64-v2; numpy.typing.DTypeLike no longer accepts None; deleting numpy from sys.modules and importing it again raises ImportError.

try:
    np.array([1.5, 2.0]).astype(np.int64, casting="same_value")
except ValueError as e:
    print("ValueError:", e)
print(np.array([1.0, 2.0]).astype(np.int64, casting="same_value"))
print(np.array([[1, 2], [3, 4]], dtype=object, ndmax=1))

Output:

ValueError: could not cast 'same_value' double to long
[1 2]
[list([1, 2]) list([3, 4])]

NumPy 2.5 (2026-06-21)

NumPy 2.5.0 is described in the release notes as a transitional release. It supports Python 3.12 to 3.14 and dropped Python 3.11. Highlights: removal of numpy.distutils, many expired and many new deprecations, many typing improvements, better free-threading support, and descending sorts.

  • Descending sorts: numpy.sort and numpy.argsort accept descending=True; NaNs sort to the end in both directions. It works for all built-in dtypes except void, object and generic, and the SIMD fast paths do not apply to descending order, so it can be slower.

  • numpy.dtypes.register_dlpack_dtype registers user dtypes for DLPack.

  • Pattern matching: ndarray is a sequence type for match and case (PEP 634).

  • N-dimensional polynomial evaluation: polyvalnd, chebvalnd, legvalnd, hermvalnd, hermevalnd and lagvalnd.

  • F2PY: allocatable module variables show in dir(); intent(inplace) keeps a separate copy.

  • Removals: numpy.distutils, np.row_stack, recfromtxt and recfromcsv, the 'a' dtype alias, np.cross with 2-D vectors, np.finfo(None).

  • Deprecations: numpy.char.chararray and numpy.char.array, setting arr.dtype or arr.shape and resizing in place, the generic timedelta64 unit (including arr + 1), np.fix, np.ma.round_, np.typename, and non-integer inputs to triu_indices and relatives.

  • Compatibility: linalg.eig and eigvals always return complex arrays; Generator.binomial and multinomial produce different values for the same seed (two corrections to the BTPE sampler); datetime64 arithmetic raises OverflowError on int64 overflow; meshgrid returns a tuple; from_dlpack raises BufferError; NumPy’s Cython headers need Cython 3.0 or later; the MSVC minimum is 19.35.

print(np.sort(np.array([3, 1, 2]), descending=True))
match np.arange(3):
    case [0, *rest]:
        print("match", rest)
w = np.linalg.eigvals(np.array([[2.0, 0], [0, 3.0]]))
print(w.dtype)

Output:

[3 2 1]
match [np.int64(1), np.int64(2)]
complex128

Patch releases 2.5.1 to 2.5.4

The patch releases fix bugs and are safe to take. The manual’s stable pages are built from the 2.5.0 tag, so the notes for 2.5.1 to 2.5.4 are published on the development documentation site, not under the stable URLs.

Release Date Notable content

2.5.1

2026-07-04

Datetime Cython API compatible with older NumPy; fixes for memory leaks in reduceat and accumulate; a segfault in MT19937 with recursive seed lists; NpyString deadlocks. The minimum GCC to build NumPy is now 10.3.0.

2.5.2

2026-08-09

Bug fixes.

2.5.3

2026-09-06

Bug fixes.

2.5.4

2026-10-10

Python 3.12 to 3.15; svd and lstsq raise for inputs with infinities and no longer hang on some LAPACK builds; cond handles non-finite inputs more consistently; equal StringDType NaN sentinels hash equally; a MaskedArray fill_value that cannot be represented in a new dtype is reset to the default.

NumPy 2.6 (upcoming)

The development version was 2.6.dev0 and the 2.6.0 notes were marked "Unreleased". Everything in this section is subject to change and cannot be used from a released package.

  • Shape typing for almost all of the NumPy API.

  • New functions: numpy.top_k (largest or smallest k values along an axis), numpy.minmax (minimum and maximum in one pass), numpy.ma.assert_array_equal, and abstract dtype classes in numpy.dtypes such as NumberAbstractDType, usable with numpy.isdtype. None of them exist in 2.5.4, as hasattr(np, "top_k") confirms.

  • Removed: numpy.typing.mypy_plugin, deprecated since 2.3; the 'full', 'f', 'economic' and 'e' modes of numpy.linalg.qr.

  • Deprecated: importing numpy.linalg.lapack_lite; np.dot with a.ndim >= 2 and b.ndim > 2 (use matmul or tensordot).

  • Future change: numpy.append scalar promotion will follow numpy.concatenate; affected calls emit a FutureWarning.

  • Behaviour: ndarray.resize raises on read-only arrays; inequality comparisons of StringDType NaN-like values return True; Python scalars in ufunc.outer and ufunc.at become weak.

  • Performance: descending sorts and partitions get SIMD paths on x86; faster ufunc calls through inner-loop caching.

  • The minimum GCC to build is 10.3.0.

Official pages that are out of date

The manual is generally accurate, but a few pages lag behind the release notes. Where they disagree, follow the release notes and test the behaviour.

  • The page on discrete Fourier transforms still says numpy.fft promotes float32 and complex64 to float64 and complex128. The 2.0 notes say the transforms now compute natively in single and long double precision, and on NumPy 2.5.4 np.fft.fft of a float32 array returned complex64. See Discrete Fourier Transforms.

  • The array API page says the main namespace is compatible with the 2024.12 standard and refers to "NumPy 2.3.0", although it is built from 2.5. On NumPy 2.5.4, np.__array_api_version__ printed 2025.12. Do not rely on one number: treat the standard as a moving target and test the functions you use. See The Array API Standard.

  • The "Using Python as glue" chapter is a 2008 text that the manual itself marks as out of date, and some of its code listings contain bugs.

Where older books and tutorials are outdated

A longer, dated table of removed names and changed behaviour, organised by pattern and by book, is in Migrating to NumPy 2.x. The shortlist below shows which release made which common tutorial idiom obsolete.

Idiom in material written before Obsolete since Use today

np.random.seed(42) then np.random.randn(...)

Discouraged since the Generator API (NumPy 1.17, 2019); the legacy stream is frozen

rng = np.random.default_rng(42)

np.float_, np.infty, np.NaN, np.product

2.0 (2024-06-16)

np.float64, np.inf, np.nan, np.prod

np.trapz, np.in1d, quantile(..., interpolation=...)

2.4 (2025-12-20)

np.trapezoid, np.isin, method=

np.row_stack, numpy.distutils

2.5 (2026-06-21)

np.vstack, Meson

sorted(arr)[::-1] or np.sort(a)[::-1] for descending order

2.5 offers descending=True

np.sort(a, descending=True)

a.astype(int) hoping to catch lossy casts

2.4 offers casting="same_value"

a.astype(np.int64, casting="same_value")

np.stack followed by a loop to split rows

2.1 adds np.unstack

np.unstack(a)

np.array([1.5])[0] printing as 1.5

2.0 (NEP 51)

np.float64(1.5)

Tutorials on the older library lines (NumPy 1.13 to 1.26, roughly 2017 to 2024) are right about array ideas and wrong about names, printed output and promotion of scalars. Treat a code listing as a sketch that needs checking against the release notes.