unstale

pypi / numpy

numpy

What changed in numpy 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

216 breaking8 security28 deprecations91 new APIs and options8 performance29 behavior and defaults4 tooling88 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

numpy 2472 changes

Breaking changes 216

  • Six-tuple dtype pickle states with versions greater than 1 are rejected.

    2.5.5release notes

  • Casting structured void or subarray dtypes to StringDType now raises TypeError instead of interpreting element bytes as UTF-8.

    2.5.5release notes

  • When a copied fill_value cannot be represented in the new dtype, it resets to that dtype’s default; explicitly supplied fill_value values are still validated and raise as before.

    2.5.4release notes

  • Raises for inputs containing infinities instead of returning garbage results, and fixes hangs for certain such inputs with recent LAPACK implementations.

    2.5.4release notes

  • Casting a fixed-width byte string array with invalid UTF-8 to StringDType now raises TypeError instead of storing invalid bytes.

    2.5.3release notes

  • The struct is opaque for extensions targeting the free-threading-compatible stable ABI, so those extensions can no longer access its fields; the NpyString allocator API remains usable with the descriptor pointer.

    2.5.2release notes

  • The minimum supported GCC version increased from 9.3.0 to 10.3.0, affecting developers building NumPy from source.

    2.5.1release notes

  • The data type alias 'a' has been removed; use 'S' instead.

    2.5.0release notes

  • _add_newdoc_ufunc(ufunc, newdoc) has been removed; assign ufunc.__doc__ instead.

    2.5.0release notes

  • Scalars now export the interface directly and are read-only, rather than exposing an array copy through a __ref entry.

    2.5.0release notes

  • Projects building against NumPy's Cython headers now require Cython 3.0 or newer.

    2.5.0release notes

  • get_array_wrap has been removed.

    2.5.0release notes

  • Windows platforms now require a minimum MSVC 19.35 toolchain, corresponding to Visual Studio 2022 version 17.5 Preview 2 or newer.

    2.5.0release notes

  • For object arrays, imag now returns getattr(element, "imag", 0) elementwise, and the result is read-only.

    2.5.0release notes

  • For object arrays, real now returns getattr(element, "real", element) elementwise, and the result is read-only.

    2.5.0release notes

  • This function has been removed.

    2.5.0release notes

  • Non-integer inputs now raise TypeError.

    2.5.0release notes

  • The re-export of numpy.char.chararray has been removed.

    2.5.0release notes

  • Two-dimensional vectors are no longer supported.

    2.5.0release notes

  • The function now accepts only numpy.ndarray; passing a scalar type raises TypeError.

    2.5.0release notes

  • Addition, subtraction, and integer multiplication now raise OverflowError when results overflow int64 or land on the NaT sentinel.

    2.5.0release notes

  • numpy.distutils has been removed.

    2.5.0release notes

  • Passing None as dtype now raises TypeError.

    2.5.0release notes

  • Unsupported device, dtype, or excessive dimensionality now raises BufferError instead of RuntimeError.

    2.5.0release notes

  • numpy.isreal is affected by the changed object-array imag behavior because it uses arr.imag.

    2.5.0release notes

  • The alias for the standard library math module has been removed.

    2.5.0release notes

  • numpy.linalg.eig now always returns complex arrays, rather than returning values whose type depended on the eigenvalues.

    2.5.0release notes

  • numpy.linalg.eigvals now always returns complex arrays, rather than returning values whose type depended on the eigenvalues.

    2.5.0release notes

  • meshgrid now always returns a tuple, including when sparse is true and copy is false.

    2.5.0release notes

  • Errors in the BTPE sampler's Stirling-series acceptance/rejection step were corrected, so results may differ for the same seed.

    2.5.0release notes

  • Results may differ for the same seed because the BTPE sampler used internally by multinomial had errors corrected.

    2.5.0release notes

  • numpy.row_stack has been removed in favor of numpy.vstack.

    2.5.0release notes

  • Out-of-range Python integers in x or y are no longer silently truncated; they now raise OverflowError.

    2.5.0release notes

  • The C API function now raises OverflowError rather than silently truncating out-of-range Python integers.

    2.5.0release notes

  • NumPy 2.5.0 drops support for Python 3.11; supported Python versions are 3.12–3.14.

    2.5.0release notes

  • recfromtxt and recfromcsv have been removed from numpy.lib._npyio in favor of numpy.genfromtxt.

    2.5.0release notes

  • Copies of structured arrays with identical contiguous dtypes now use memcpy, which may copy padding bytes that were previously left untouched.

    2.5.0release notes

  • Returns rank 0 for empty matrices.

    2.4.5release notes

  • Converting an array with ndim greater than zero to a scalar now raises TypeError; extract a single element first.

    2.4.0release notes

  • The default x86 baseline has been raised to x86-64-v2; builds can set it to none to support older CPUs.

    2.4.0release notes

  • The deprecated, nonfunctional disp function has been removed.

    2.4.0release notes

  • Index preparation now matches ndarray behavior, with stricter validation, corrected IndexError types, and more specific errors; some float and scalar-boolean indices are deprecated.

    2.4.0release notes

  • Sorting with kind='heapsort' now maps to kind='quicksort', potentially changing execution time or unstable argsort order.

    2.4.0release notes

  • The deprecated runtime discovery mechanism has been removed.

    2.4.0release notes

  • The undocumented get_as_parameter method was removed; use _as_parameter_ instead.

    2.4.0release notes

  • The undocumented get_data method was removed; use data instead.

    2.4.0release notes

  • The undocumented get_shape method was removed; use shape instead.

    2.4.0release notes

  • The undocumented get_strides method was removed; use strides instead.

    2.4.0release notes

  • The macro defined in npy_cpu.h has been removed.

    2.4.0release notes

  • When used, NPY_HEAPSORT is mapped to NPY_QUICKSORT.

    2.4.0release notes

  • Deleting numpy from sys.modules and importing it again now fails with ImportError because C extension modules are checked for single import per process.

    2.4.0release notes

  • Type checkers no longer accept start as a keyword argument, though runtime use remains possible.

    2.4.0release notes

  • The style parameter has been removed; arguments following it, such as formatter, are now keyword-only.

    2.4.0release notes

  • The bias argument has been removed because it had no effect.

    2.4.0release notes

  • The ddof argument has been removed because it had no effect.

    2.4.0release notes

  • The deprecated module has been removed; use numpy.fft instead.

    2.4.0release notes

  • Removed in favor of numpy.isin.

    2.4.0release notes

  • The deprecated module has been removed; use numpy.linalg instead.

    2.4.0release notes

  • The delimitor parameter has been removed; use delimiter instead.

    2.4.0release notes

  • The interpolation parameter has been removed; use method instead.

    2.4.0release notes

  • The interpolation parameter has been removed; use method instead.

    2.4.0release notes

  • Removed; use next(ndindex) instead.

    2.4.0release notes

  • The interpolation parameter has been removed; use method instead.

    2.4.0release notes

  • The interpolation parameter has been removed; use method instead.

    2.4.0release notes

  • The newshape parameter has been removed; pass the shape positionally or use shape= on newer NumPy versions.

    2.4.0release notes

  • Always returns a copy, including for integer inputs with nonnegative decimals.

    2.4.0release notes

  • The ignored fix_imports parameter has been removed.

    2.4.0release notes

  • Passing a generator directly now raises TypeError; use numpy.fromiter or Python's sum builtin.

    2.4.0release notes

  • Removed; use numpy.trapezoid or scipy.integrate functions instead.

    2.4.0release notes

  • The type alias no longer accepts None; use DTypeLike | None for optional dtype annotations.

    2.4.0release notes

  • Hash-based unique extraction speeds up string arrays substantially, but returned unique values are not guaranteed to be sorted.

    2.4.0release notes

  • Multiplication that would create an unrepresentably large string now raises OverflowError instead of MemoryError.

    2.4.0release notes

  • New x86 CPU feature group representing x86-64-v3 microarchitectures.

    2.4.0release notes

  • New x86 CPU feature group representing x86-64-v4 microarchitectures.

    2.4.0release notes

  • Negative input now raises ValueError.

    2.3.4release notes

  • The function and method now return booleans for object arrays rather than an argument value; use np.logical_and.reduce for the previous behavior.

    2.0.0release notes

  • The function and method now return booleans for object arrays rather than an argument value; use np.logical_or.reduce for the previous behavior.

    2.0.0release notes

  • The C API exports only static inline function versions of array accessors; struct fields can still be used directly, though discouraged.

    2.0.0release notes

  • Removed; migrate to __array_ufunc__ or rely on __array_wrap__, which is called with context in all cases.

    2.0.0release notes

  • Out-of-bound axis values now error instead of being treated like axis=None; use axis=None explicitly.

    2.0.0release notes

  • The default NumPy integer is now 64-bit on all 64-bit systems, including Windows.

    2.0.0release notes

  • The default integer type on Windows is now int64 instead of int32, matching other platforms.

    2.0.0release notes

  • The relaxed strides debug build option configured with this flag has been removed.

    2.0.0release notes

  • The flags value is now stored unsigned, so the aligned dtype struct flag is positive rather than negative; code checking flags manually may need to adapt.

    2.0.0release notes

  • The related ufunc keyword argument was removed; use the np.errstate() context manager instead.

    2.0.0release notes

  • Ambiguous -m and .pyf combinations are no longer accepted: multiple .pyf files raise an error, while using both -m and a .pyf warns and ignores the -m name.

    2.0.0release notes

  • Removed; replace calls with subprocess.run invoking python -m numpy.f2py.

    2.0.0release notes

  • The default encoding is now None; converters receive str rather than bytes, and returned values are Unicode strings rather than bytes.

    2.0.0release notes

  • This ufunc struct member was removed to simplify improvements to the dispatching system.

    2.0.0release notes

  • The default encoding is now None, so converters receive str rather than bytes; pass encoding explicitly to select behavior.

    2.0.0release notes

  • The advanced indexing MapIter and related API were removed.

    2.0.0release notes

  • Assigning to the .data attribute of an ndarray is disallowed and raises.

    2.0.0release notes

  • This header was removed; replace missing symbols with their prefixed counterparts.

    2.0.0release notes

  • Removed; use np.asarray with a proper dtype instead.

    2.0.0release notes

  • Raises when width is too small.

    2.0.0release notes

  • It can no longer be called with Python int, float, or complex instances because cast results must not depend on scalar values.

    2.0.0release notes

  • Removed; replace np.cast[dtype](arg) with np.asarray(arg, dtype=dtype).

    2.0.0release notes

  • Removed; use np.complex128 instead.

    2.0.0release notes

  • Removed; use np.clongdouble instead.

    2.0.0release notes

  • Removed from the main namespace; use np.char.compare_chararrays instead.

    2.0.0release notes

  • Removed; use np.complex128 instead.

    2.0.0release notes

  • Removed from the public API.

    2.0.0release notes

  • Support for seven data type string aliases has been removed.

    2.0.0release notes

  • np.dtype(("f8", 1)) now returns a shape-1 subarray dtype rather than a non-subarray dtype.

    2.0.0release notes

  • Removed from the main namespace.

    2.0.0release notes

  • Removed; use numpy.promote_types or numpy.result_type instead.

    2.0.0release notes

  • Removed; use np.float64 instead.

    2.0.0release notes

  • Removed from the main namespace; use np.rec.format_parser instead.

    2.0.0release notes

  • Removed; use the np.errstate() context manager instead.

    2.0.0release notes

  • Removed; use np.inf instead.

    2.0.0release notes

  • Removed; use np.inf instead.

    2.0.0release notes

  • Removed; use np.inf instead.

    2.0.0release notes

  • Its C definition now matches size_t/Py_ssize_t rather than intptr_t; pointers may no longer fit in an intp typed array on niche platforms.

    2.0.0release notes

  • Removed; use the issubclass builtin instead.

    2.0.0release notes

  • Removed; use np.clongdouble instead.

    2.0.0release notes

  • Removed; use np.longdouble instead.

    2.0.0release notes

  • Removed.

    2.0.0release notes

  • Removed; use np.asmatrix instead.

    2.0.0release notes

  • Removed; use np.sort(a, axis=0) instead.

    2.0.0release notes

  • Removed; use np.nan instead.

    2.0.0release notes

  • Removed; use np.dtype(<dtype>).itemsize instead.

    2.0.0release notes

  • Now available only from np.lib.npyio.

    2.0.0release notes

  • Removed; use np.round instead.

    2.0.0release notes

  • Removed from the main namespace; use ast.literal_eval instead.

    2.0.0release notes

  • Removed from the main namespace.

    2.0.0release notes

  • Removed; use np.set_printoptions with a formatter for custom printing.

    2.0.0release notes

  • Removed; use np.complex64 instead.

    2.0.0release notes

  • Broadcasting when b has one fewer dimension than a now follows the Array API and changes backward-incompatibly; use np.solve(a, b[..., None])[..., 0] to reconstruct the old behavior.

    2.0.0release notes

  • Removed; use inspect.getsource instead.

    2.0.0release notes

  • Removed; use np.bytes_ instead.

    2.0.0release notes

  • Now available only from np.lib.

    2.0.0release notes

  • Its C definition now matches size_t/Py_ssize_t rather than intptr_t/uintptr_t, which can affect pointer fit on niche platforms.

    2.0.0release notes

  • Removed; use np.str_ instead.

    2.0.0release notes

  • Using NPY_CHAR in PyArray_DescrFromType() raises; use NPY_STRING, NPY_UNICODE, or NPY_VSTRING instead.

    2.0.0release notes

  • This header and its corresponding macros were removed; the notes recommend periodically querying Python signal functions instead.

    2.0.0release notes

  • Removed to avoid confusion.

    2.0.0release notes

  • This macro was removed because it reflected only built-in numeric types and served no internal purpose.

    2.0.0release notes

  • It is now a runtime constant rather than a compile-time constant; stack allocations must use a custom constant and check against it at runtime.

    2.0.0release notes

  • Its value is now 64; uses where it meant axis=None must instead use NPY_RAVEL_AXIS.

    2.0.0release notes

  • NPY_NTYPES was renamed to clarify that it does not include new built-in DTypes.

    2.0.0release notes

  • Use this in conversion helpers and C API functions where NPY_MAXDIMS previously represented axis=None.

    2.0.0release notes

  • The relaxed strides debug build option enabled through this environment variable has been removed.

    2.0.0release notes

  • NumPy 2.0 breaks ABI compatibility: binaries built against NumPy 1.xx will not work with NumPy 2.0.

    2.0.0release notes

  • Underlying C types now use C99 complex types; direct real or imaginary field access is no longer available, and utilities in numpy/npy_math.h should be used.

    2.0.0release notes

  • This deprecated header and its PyArray_CONSTANT macros were removed; the notes mention a script to convert them to NPY_CONSTANT versions.

    2.0.0release notes

  • Scalars now include type information in their representation, for example np.float64(3.0) instead of 3.0; legacy="1.25" can restore the old behavior for now.

    2.0.0release notes

  • Strings are now true when non-empty and false when empty, matching Python; whitespace is true, and the change affects string-to-boolean casts and np.nonzero.

    2.0.0release notes

  • Unstable sorting methods, including the default method, may return slightly different results because of algorithmic changes and SIMD code.

    2.0.0release notes

  • Unstable sorting methods, including the default method, may return slightly different results because of algorithmic changes and SIMD code.

    2.0.0release notes

  • The experimental submodule has been removed; use the main numpy namespace for regular usage or array-api-strict for compliance testing.

    2.0.0release notes

  • copy accepts None, True, and False; False now raises ValueError if a copy is required.

    2.0.0release notes

  • copy accepts None, True, and False; False now raises ValueError if a copy is required.

    2.0.0release notes

  • When returning a sequence of arrays, this function now returns a tuple of ndarrays instead of a list.

    2.0.0release notes

  • When returning a sequence of arrays, this function now returns a tuple of ndarrays instead of a list.

    2.0.0release notes

  • When returning a sequence of arrays, this function now returns a tuple of ndarrays instead of a list.

    2.0.0release notes

  • This function now returns a tuple of ndarrays instead of a list.

    2.0.0release notes

  • A trailing comma in a dtype string now always creates a structured dtype with a single field.

    2.0.0release notes

  • The context manager and decorator is faster and context safe; it can only be entered once now.

    2.0.0release notes

  • Warnings and exceptions in this module are no longer exposed in the main namespace.

    2.0.0release notes

  • When s[i] is -1, the transform now uses the whole input array along axis i.

    2.0.0release notes

  • The submodule was renamed to numpy.fft._helper to mark it private; access public functions through numpy.fft.

    2.0.0release notes

  • FFT routines now calculate natively in float, double, or long double precision according to input precision, and adjust output dtype accordingly.

    2.0.0release notes

  • Now returns a tuple rather than a list, making the return value immutable.

    2.0.0release notes

  • This function now returns a tuple of ndarrays instead of a list.

    2.0.0release notes

  • Integer classes will no longer support conversion of out-of-bounds Python integers to integer arrays; use np.array(value).astype(dtype) for the desired result.

    2.0.0release notes

  • Introduced as a public submodule containing byte_bounds, normalize_axis_tuple, and normalize_axis_index; byte_bounds moved from numpy.lib.utils.

    2.0.0release notes

  • The submodule was renamed to numpy.linalg._linalg to mark it private; access public functions through numpy.linalg.

    2.0.0release notes

  • The default rcond is now machine precision times max(M, N); pass rcond=-1 for the old behavior.

    2.0.0release notes

  • Added as a NumPy integer mapping to C's long; before NumPy 1.24, it aliased Python's int.

    2.0.0release notes

  • This function now returns a tuple of ndarrays instead of a list.

    2.0.0release notes

  • This function now returns a tuple of ndarrays instead of a list.

    2.0.0release notes

  • The legacy="1.25" option can temporarily restore the old scalar representation behavior.

    2.0.0release notes

  • Its buffer size is now tied to numpy.errstate; leaving an errstate context resets the buffer size.

    2.0.0release notes

  • For complex values, sign is now calculated as z / |z|; zero is returned when z==0.

    2.0.0release notes

  • For multidimensional inputs, unique_inverse is now shaped so the input can be reconstructed directly with take or take_along_axis.

    2.0.0release notes

  • Removed; a variable explorer in IDEs such as Spyder or Jupyter Notebook can provide alternatives.

    2.0.0release notes

  • Removed; the notes recommend PyArray_CopyInto or, if needed, PyArray_CopyAnyInto.

    2.0.0release notes

  • Removed; the notes recommend PyArray_CopyInto instead.

    2.0.0release notes

  • This C API macro was removed.

    2.0.0release notes

  • Removed; use standard C string comparison functions.

    2.0.0release notes

  • The ->f slot was removed; use PyDataType_GetArrFuncs to access the functionality.

    2.0.0release notes

  • Removed because its use was unclear and its semantics were incorrect in some use cases.

    2.0.0release notes

  • Removed; create a new empty array or use PyArray_FillWithScalar().

    2.0.0release notes

  • Removed; access to cast functions for custom legacy user dtypes is no longer available through this API.

    2.0.0release notes

  • Now requires importing the NumPy API table and is no longer defined in ndarraytypes.h.

    2.0.0release notes

  • A static inline function for importing the NumPy C API table; it checks whether import was already performed and is lightweight when it was.

    2.0.0release notes

  • Removed as misleading and without known use cases.

    2.0.0release notes

  • This macro moved from ndarraytypes.h to npy_math.h.

    2.0.0release notes

  • Removed; use PyArray_CopyInto instead.

    2.0.0release notes

  • Removed; use Py_REFCNT instead.

    2.0.0release notes

  • Custom legacy user dtypes registered with this API require changes to accommodate the ABI break and support both NumPy 1.x and 2.x.

    2.0.0release notes

  • The expired deprecation is finalized and the C function removed.

    2.0.0release notes

  • Removed; use explicit sizes or types, or go through Python strings.

    2.0.0release notes

  • This API is private now; use the Python API if needed.

    2.0.0release notes

  • sizeof(PyArrayMultiIterObject) no longer includes the full size of the object.

    2.0.0release notes

  • The deprecation expired and the function was removed; use tracemalloc and the np.lib.tracemalloc_domain domain.

    2.0.0release notes

  • Use this function to access descriptor alignment unless compiling only with NumPy 2 support.

    2.0.0release notes

  • Access the c_metadata structured dtype field through the corresponding function rather than directly.

    2.0.0release notes

  • Use this function to access descriptor elsize unless compiling only with NumPy 2 support.

    2.0.0release notes

  • Access the fields structured dtype field through the corresponding function rather than directly.

    2.0.0release notes

  • Dtype-flag functionality is available only after including numpy/ndarrayobject.h, because it requires import_array().

    2.0.0release notes

  • Access dtype flags through this inline function for compatibility with NumPy 1.x and 2.x.

    2.0.0release notes

  • Removed because it had not done anything since at least NumPy 1.7.

    2.0.0release notes

  • Structured dtype fields such as names must now be accessed through functions like this, since those fields do not exist on every descriptor.

    2.0.0release notes

  • Dtype-flag functionality is available only after including numpy/ndarrayobject.h, because it requires import_array().

    2.0.0release notes

  • Use this function to set descriptor elsize unless compiling only with NumPy 2 support.

    2.0.0release notes

  • Access the subarray structured dtype field through the corresponding function rather than directly.

    2.0.0release notes

  • The public and private APIs are clearly split, with a new module structure and each public function available in a single place.

    2.0.0release notes

  • This release supports Python 3.9–3.12.

    2.0.0release notes

  • The types and data arguments are now const-correct; C++ code may be affected.

    2.0.0release notes

  • The types and data arguments are now const-correct; C++ code may be affected.

    2.0.0release notes

  • The types and data arguments are now const-correct; C++ code may be affected.

    2.0.0release notes

  • This C API function was removed.

    2.0.0release notes

  • A static inline function for importing the ufunc API table; it checks whether import was already performed and is lightweight when it was.

    2.0.0release notes

  • The expired deprecation is finalized and the function removed.

    2.0.0release notes

  • Type promotion adopts NEP 50, making promotions depend on input dtypes rather than array data values; mixed-dtype operations may change output dtypes or produce lower precision.

    2.0.0release notes

Security 8

  • Out-of-bounds reads in datetime parsing API errors are avoided.

    2.5.5release notes

  • Setting an array's dtype attribute is deprecated because mutating a shared array is unsafe; use array.view(dtype=new_dtype).

    2.5.0release notes

  • Resizing an array in place is deprecated because mutating a shared array is unsafe; use np.resize instead.

    2.5.0release notes

  • Fixes a heap buffer overflow in timedelta-to-string casts.

    2.4.5release notes

  • Fixes a heap overflow in fixed-width string multiplication.

    2.4.1release notes

  • Setting the strides attribute is deprecated because mutating a shared array is unsafe; create a new view instead.

    2.4.0release notes

  • Setting an array's shape attribute is deprecated; use np.reshape or np.ndarray.reshape to create a new view.

    2.4.0release notesrelease notes

  • Avoids a segmentation fault in string_expandtabs_length_promoter.

    2.3.4release notes

Deprecations 28

  • The numpy.char.array and numpy.char.asarray functions are deprecated; use numpy.array or numpy.asarray with a string or bytes dtype.

    2.5.0release notes

  • This class is deprecated; use an ndarray with a string or bytes dtype instead.

    2.5.0release notes

  • numpy.ma.round_ is deprecated; use numpy.ma.round instead.

    2.5.0release notes

  • The same-kind cast check now tests whether the result can be cast to out; a DeprecationWarning is issued when it cannot.

    2.5.0release notes

  • Using the generic unit is deprecated, as are operations that implicitly rely on it; specify an explicit unit instead.

    2.5.0release notes

  • Non-integer values for M, k, and N are deprecated.

    2.5.0release notes

  • Non-integer values for k are deprecated.

    2.5.0release notes

  • Inputs other than integers are deprecated.

    2.5.0release notes

  • numpy.typename is deprecated because its returned names were outdated and inconsistent; use numpy.dtype.name instead.

    2.5.0release notes

  • A VisibleDeprecationWarning is emitted when align is not a boolean; pass align as a keyword argument.

    2.4.0release notes

  • numpy.fix is deprecated; use numpy.trunc, which provides identical functionality and follows the Array API standard.

    2.4.0release notesrelease notes

  • The container class is deprecated and will be removed in a future version.

    2.4.0release notes

  • Passing out positionally is deprecated; pass it by keyword to distinguish the output buffer from inputs.

    2.4.0release notes

  • Deprecated in favor of warnings.catch_warnings, warnings.filterwarnings, pytest.warns, or pytest.filterwarnings.

    2.4.0release notes

  • Calling a ufunc with where but without out now emits a warning; out=None suppresses it.

    2.4.0release notes

  • Implementations must accept arr, context, return_scalar; support for implementations not accepting all three arguments is deprecated.

    2.0.0release notes

  • Use of keyword arguments x and y is deprecated; pass the first two arguments positionally.

    2.0.0release notes

  • The main-namespace chararray is deprecated; importing it from np.char.chararray avoids a deprecation warning for now.

    2.0.0release notes

  • Deprecated because Python 2 is no longer supported.

    2.0.0release notes

  • Arrays of 2-dimensional vectors are deprecated; use arrays of 3-dimensional vectors instead.

    2.0.0release notes

  • The np.dtype("a") alias for np.dtype(np.bytes_) is deprecated; use the np.dtype("S") alias instead.

    2.0.0release notes

  • Deprecated; use np.isin instead.

    2.0.0release notes

  • Deprecated alias; use np.vstack directly.

    2.0.0release notes

  • Deprecated; use np.trapezoid or a scipy.integrate function instead.

    2.0.0release notes

  • Accessing numpy.core now emits a DeprecationWarning; private internals remain accessible through numpy._core without backward-compatibility guarantees.

    2.0.0release notes

  • A single number in parentheses to indicate a sub-array shape is deprecated; use (2,)i or 2i instead of (2)i.

    2.0.0release notes

  • For n-D transforms, using a non-None s with axes=None is deprecated; pass an explicit sequence of axes to retain current behavior.

    2.0.0release notes

  • Passing an array to s containing None values is deprecated; pass the corresponding default length or omit s for defaults on every axis.

    2.0.0release notes

New APIs and options 91

  • The descending keyword enables descending argsorts; NaNs remain at the end, and the feature supports built-in dtypes except void, object, and generic.

    2.5.0release notes

  • User-dtype authors can register dtypes for DLPack export and import.

    2.5.0release notes

  • The descending keyword enables descending sorts; NaNs remain at the end, and the feature supports built-in dtypes except void, object, and generic.

    2.5.0release notes

  • A new polynomial function evaluates polynomials in arbitrary dimensions.

    2.5.0release notes

  • A new C API accessor macro allows accessing a PyArray_Descr field without direct field access.

    2.5.0release notes

  • User-defined dtypes can implement custom sorting and argsorting with ArrayMethod specs registered through PyUFunc_AddLoopsFromSpecs.

    2.4.0release notes

  • The same_value casting option verifies that values round-trip without changing; it raises ValueError if casting changes any value.

    2.4.0release notes

  • New DType API slot lets dtype implementations provide constants such as machine limits and special values, enabling numpy.finfo support.

    2.4.0release notes

  • New NPY_SORTKIND enum name for default sorting, with the same value as NPY_QUICKSORT.

    2.4.0release notes

  • New NPY_SORTKIND enum name for descending sort; it is not yet implemented.

    2.4.0release notes

  • New NPY_SORTKIND enum name indicating that sorting must be stable.

    2.4.0release notes

  • NumPy checks this protocol when converting objects to dtypes through np.dtype or dtype arguments, allowing dtype-like objects to define conversion explicitly.

    2.4.0release notes

  • The ndmax option limits the maximum dimensions created from nested sequences, useful for preserving nested structures as object elements.

    2.4.0release notes

  • The pad_width argument now accepts a dictionary.

    2.4.0release notes

  • Accepts multiple axes.

    2.4.0release notes

  • The axis argument now accepts a sequence to trim zeros along multiple axes.

    2.4.0release notes

  • New C API function registers multiple ufunc loops from specs in one call, including sorting and argsorting loops using ArrayMethod.

    2.4.0release notes

  • New x86 CPU feature group representing x86-64-v2 microarchitectures.

    2.4.0release notes

  • NumPy passes copy when it is non-default; implementations of the array protocol should accept it with the same meaning as in array constructors.

    2.0.0release notes

  • f2py supports annotating functions and subroutines with bind(c), handling type mapping and preserving unique labels for other C interfaces.

    2.0.0release notes

  • A new public C API is available for creating custom dtypes.

    2.0.0release notes

  • The NEP 42 DType API is public, allowing custom DTypes outside NumPy through the normal import_array() mechanism.

    2.0.0release notes

  • Compile mode accepts the Meson backend; it is the default for Python 3.12 and newer.

    2.0.0release notes

  • Compile mode accepts one or more --dep flags, mapping to dependency() calls in the Meson backend and doing nothing in the distutils backend.

    2.0.0release notes

  • Support for updated Accelerate BLAS/LAPACK, including ILP64, adds arm64 support and performance improvements; it is selected at build time or automatically when no BLAS library is specified and available.

    2.0.0release notes

  • Added an ndarray attribute for Array API standard compatibility.

    2.0.0release notes

  • Added matrix-transpose support for ndarrays and MaskedArrays, equivalent to swapping the last two axes.

    2.0.0release notes

  • Added an ndarray method for Array API standard compatibility.

    2.0.0release notes

  • The new character codes were introduced for the corresponding integer types.

    2.0.0release notes

  • A find ufunc for unicode or byte strings, operating similarly to str.find and used in np.char.

    2.0.0release notes

  • An rfind ufunc for unicode or byte strings, operating similarly to str.rfind and used in np.char.

    2.0.0release notes

  • This functionality is available only after including numpy/ndarrayobject.h, because it requires import_array().

    2.0.0release notes

  • Added to the C API and Cython bindings to facilitate datetime conversions in external libraries.

    2.0.0release notes

  • New CLI script reports the NumPy version and compile flags for using the NumPy C API; --pkgconfigdir locates the pkg-config file.

    2.0.0release notes

  • Added as an alias to improve compatibility with the Array API standard.

    2.0.0release notes

  • Added as an alias to improve compatibility with the Array API standard.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • Added an Array API standard-compatible alternative to the numpy.ndarray.astype method.

    2.0.0release notes

  • Counts the number of 1-bits in NumPy integer types and integer-like objects.

    2.0.0release notes

  • Added as an alias to improve compatibility with the Array API standard.

    2.0.0release notes

  • Introduced as the canonical name for NumPy's boolean dtype; numpy.bool_ is now an alias to it.

    2.0.0release notes

  • Added as an alias to improve compatibility with the Array API standard.

    2.0.0release notes

  • A new variable-length string dtype is available.

    2.0.0release notes

  • A C API is available for working with StringDType arrays, including locking string data and packing or unpacking UTF-8 bytestreams.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • All FFT routines gained an out argument for in-place calculations.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • A new introspection function accompanies canonical dtype names.

    2.0.0release notes

  • A tracing and introspection API reports available hardware-specific kernels and which will be dispatched to.

    2.0.0release notes

  • Added the upper keyword to improve Array API standard compatibility.

    2.0.0release notes

  • Added an Array API-compatible cross product function that accepts three-dimensional vectors only.

    2.0.0release notes

  • Added an Array API standard-compatible variant of numpy.diagonal, with different default axis selection for defining 2-D sub-arrays.

    2.0.0release notes

  • Added an Array API-compatible function that computes the matrix norm of a matrix or stack of matrices.

    2.0.0release notes

  • Added rtol to improve Array API standard compatibility.

    2.0.0release notes

  • Added as an alias for numpy.matrix_transpose.

    2.0.0release notes

  • Added an Array API-compatible outer product function that accepts one-dimensional arrays only.

    2.0.0release notes

  • Added rtol; if neither rcond nor rtol is specified, the rcond default is used. The notes say rcond is planned for future deprecation and removal.

    2.0.0release notes

  • Computes singular values for a matrix or stack of matrices and is compatible with the Array API standard.

    2.0.0release notes

  • Added as an alias to improve compatibility with the Array API standard.

    2.0.0release notes

  • Added an Array API standard-compatible variant of numpy.trace, with different default axis selection for defining 2-D sub-arrays.

    2.0.0release notes

  • Added as an alias for numpy.vecdot.

    2.0.0release notes

  • Added an Array API-compatible function that computes the vector norm of a vector or batch of vectors.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • Added a function to calculate the matrix transpose of an array or stack of arrays by swapping the last two axes.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • A pkg-config file is now included to help build systems use NumPy as a dependency.

    2.0.0release notes

  • A weights keyword is available; only method="inverted_cdf" supports weights.

    2.0.0release notes

  • Added stable to improve Array API standard compatibility.

    2.0.0release notes

  • Added correction as an Array API standard-compatible alternative to ddof; only one of the two arguments can be provided at a time.

    2.0.0release notes

  • A new namespace provides performant ufuncs for string operations.

    2.0.0release notes

  • With strict=True, scalar broadcasting is disabled and input arrays must have the same data type.

    2.0.0release notes

  • With strict=True, scalar broadcasting is disabled and input arrays must have the same data type.

    2.0.0release notes

  • Added as a NumPy integer mapping to C's unsigned long.

    2.0.0release notes

  • Added an Array API-compatible variant of numpy.unique with a fixed set of returned arrays, making it easier to target for JIT compilation.

    2.0.0release notes

  • Added an Array API-compatible variant of numpy.unique with a fixed set of returned arrays, making it easier to target for JIT compilation.

    2.0.0release notes

  • Added an Array API-compatible variant of numpy.unique with a fixed set of returned arrays, making it easier to target for JIT compilation.

    2.0.0release notes

  • Added correction as an Array API standard-compatible alternative to ddof; only one of the two arguments can be provided at a time.

    2.0.0release notes

  • Added a keyword to pass a precalculated mean, avoiding calculating the mean twice when it is also needed.

    2.0.0release notes

  • Added a function that computes the vector dot product of two arrays.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • Added a keyword-only device argument; only device="cpu" is supported.

    2.0.0release notes

  • The main namespace now supports the array API standard.

    2.0.0release notes

  • A new, easier-to-use initialization function is available for the NumPy C API.

    2.0.0release notes

  • Sets an individual memory address like setting an array item, without requiring a NumPy array input.

    2.0.0release notes

  • A new, easier-to-use initialization function is available for the ufunc C API.

    2.0.0release notes

  • Added a variable-width UTF-8 string dtype with support for a user-provided missing-data sentinel, intended as a replacement for object-dtype Python string arrays.

    2.0.0release notes

Performance 8

  • Searching for multiple keys is substantially faster through batched binary search steps; single-key performance remains comparable.

    2.5.0release notes

  • Reductions over all axes now use a fast path for contiguous, aligned, non-object arrays with no special arguments.

    2.5.0release notes

  • Ufuncs scale significantly better on free-threading CPython builds through lock-free dispatch, immortal shared objects, and optimized memory allocation.

    2.5.0release notes

  • Iteration over large iteration spaces is significantly faster while preserving the original behavior and interface.

    2.4.0release notes

  • Single-input ufunc calculations on scalars are about six times faster; array performance is unchanged.

    2.4.0release notes

  • Quicksort uses Google's Highway VQSort on AArch64, improving execution time by up to 16x in some cases.

    2.0.0release notes

  • Fixed-length string operations have been accelerated with ufuncs that also support StringDType.

    2.0.0release notes

  • Sorting functions have been accelerated using Intel x86-simd-sort and Google Highway, with possible hardware-specific speedups.

    2.0.0release notes

Behavior and default changes 29

  • NumPy now uses PyMem_RawMalloc and PyMem_RawFree instead of the system malloc and free; internal allocations can be tracked by tracemalloc.

    2.5.0release notes

  • When dtype or order correction is needed, f2py now keeps a separate corrected array and copies it back after the Fortran call; only equivalent dtype kinds are allowed.

    2.5.0release notes

  • FFT functions now support non-float64 and non-complex128 dtypes and gain preliminary shape-typing support.

    2.5.0release notes

  • Input and output dtypes are more precise, and several functions gain preliminary, backward-compatible shape-typing support.

    2.5.0release notes

  • ndarray and its subclasses now support structural pattern matching with match/case statements.

    2.5.0release notes

  • The function now returns the full dtype descriptor, including parameters, for scalars of user-defined parametric data types.

    2.5.0release notes

  • This C API can now register real and imag ArrayMethods for use by imag and real.

    2.5.0release notes

  • Subclasses with dtype-specific logic should set _set_dtype to None to have arr.view(dtype=new_dtype) call __array_finalize__ with the new dtype, or define a function calling ndarray._set_dtype().

    2.5.0release notes

  • NumPy now supports the stable ABI for free-threaded Python.

    2.5.0release notes

  • Typing now accepts NumPy scalars and arrays as the second argument.

    2.4.5release notes

  • Accepts datetime strings.

    2.4.2release notes

  • The default parameter can accept array-like values.

    2.4.1release notes

  • The array interface accepts NULL data pointers and performs a dummy allocation; omit the data field to use the previous scalar path.

    2.4.0release notes

  • Assertion failure messages now include the indices at which the comparison fails.

    2.4.0release notes

  • The repr of NaT values now includes the datetime64 time unit.

    2.4.0release notes

  • Masked arrays accept and preserve Python strings as fill_value with variable-width StringDType, including through slicing and views; the default is N/A.

    2.4.0release notes

  • Hash-based unique extraction now supports complex dtypes and can return unsorted results.

    2.4.0release notes

  • Now natively supports type mappings defined by the Fortran2003 iso_c_binding intrinsic module.

    2.0.0release notes

  • The maximum number of array dimensions increases from 32 to 64.

    2.0.0release notes

  • Extended to work with unicode and bytes dtypes.

    2.0.0release notes

  • atol and rtol now accept scalars or arrays; arrays must broadcast to the shapes of the first two array arguments.

    2.0.0release notes

  • Now supports strings.

    2.0.0release notes

  • Now an alias to numpy.bool, the canonical name for NumPy's boolean dtype.

    2.0.0release notes

  • Now issues a UserWarning rather than a DeprecationWarning when the datetime string includes a timezone.

    2.0.0release notes

  • All FFT functions now support float32 and longdouble.

    2.0.0release notes

  • atol and rtol now accept scalars or arrays; arrays must broadcast to the shapes of the first two array arguments.

    2.0.0release notes

  • The shape argument now accepts any integer sequence, such as a list or NumPy array, as well as a tuple or int.

    2.0.0release notes

  • Its representation now includes the domain, making plain text and latex representations consistent.

    2.0.0release notes

  • Saving arrays with object dtype now uses pickle protocol 4, allowing objects larger than 4GB and improving speed for large arrays.

    2.0.0release notes

Tooling 4

  • The module now has typing annotations across masked arrays, masks, functions, and methods.

    2.5.0release notes

  • Many functions and methods now have shape-aware return annotations, allowing type-checkers to infer result array dimensions for common operations.

    2.5.0release notes

  • On win-arm64, the library file extension is now .lib instead of .a for MSVC and setuptools compatibility.

    2.4.0release notes

  • On win-arm64, the npymath and npyrandom static libraries now use the .lib extension instead of .a for compatibility with MSVC and setuptools.

    2.3.4release notes

Fixes and other changes 88

  • The item type in the dtype.descr typing is corrected.

    2.5.5release notes

  • MT19937 no longer accepts invalid buffers.

    2.5.5release notes

  • A hang when taking from a zero-size axis is fixed.

    2.5.5release notes

  • Bytes and Unicode counting mixups are fixed.

    2.5.5release notes

  • A crash when using an existing StringDType dtype is fixed.

    2.5.5release notes

  • The dtype is corrected when the first slice contains only NaNs.

    2.5.5release notes

  • Incorrect behavior with strided input and output is fixed.

    2.5.5release notes

  • Complex square-root rescaling is corrected.

    2.5.5release notes

  • Philox no longer accepts invalid buffers.

    2.5.5release notes

  • The number-of-elements calculation is corrected.

    2.5.5release notes

  • SeedSequence.spawn is made thread safe.

    2.5.5release notes

  • Bytes and code-point confusion in string fast search is fixed.

    2.5.5release notes

  • Bounds checking is performed before writing values when converting StringDType values to integers.

    2.5.5release notes

  • Calling ufunc.at with no inputs no longer segfaults.

    2.5.5release notes

  • Calling ufunc.at with a non-writeable first operand now raises an error.

    2.5.5release notes

  • Includes a workaround for an MSVC 19.51 bug.

    2.5.4release notes

  • Fixes truncation of the old and new strings to the length of the input array’s string.

    2.5.4release notes

  • Handles non-finite inputs more consistently.

    2.5.4release notes

  • Instances with equivalent floating-point NaN sentinels now have equal hashes, so dictionary lookups and set deduplication no longer fail because equal dtypes had different hashes.

    2.5.4release notes

  • Includes many typing fixes and improvements.

    2.5.4release notes

  • Fixes two possible crashes in the accumulate implementation.

    2.5.4release notes

  • When a dtype-changing ufunc leaves the copied fill_value invalid for the new dtype, NumPy now uses that dtype’s default fill_value instead of propagating a stale value.

    2.5.3release notes

  • Fixes the stride after removing a multi-index.

    2.5.2release notes

  • Fixes cast errors being swallowed during assignment.

    2.5.2release notes

  • Restores conjugate behavior for legacy user-defined dtypes.

    2.5.2release notes

  • Fixes a reference-count leak for overlapping copies when where is False.

    2.5.2release notes

  • Fixes corruption when reusing a StringDType.

    2.5.2release notes

  • Adds a special case for StringDType.

    2.5.2release notes

  • The release supports Python 3.15 and includes wheels for Python 3.15.0rc1.

    2.5.2release notes

  • Ensures the lock is held when accessing or writing RNG state and fully resets cached state for non-MT19937 RNGs.

    2.5.2release notes

  • Fixes the coerce flag in binary ufunc promotion.

    2.5.2release notes

  • Fixed an output-array leak in accumulate when dtype …

    2.5.1release notes

  • Corrected dtype inference for asarray([]).

    2.5.1release notes

  • The datetime Cython APIs were fixed to be compatible with older NumPy versions, helping downstream projects support those versions.

    2.5.1release notes

  • finfo is more accessible for user-defined dtypes.

    2.5.1release notes

  • Corrected the return type for object_ values.

    2.5.1release notes

  • Fixed a segfault by preventing recursive seed lists.

    2.5.1release notes

  • Fixed a typing regression introduced in NumPy 2.5.0.

    2.5.1release notes

  • Deadlocks when using the NpyString API were fixed.

    2.5.1release notes

  • Fixed an output-array leak in reduceat when dtype …

    2.5.1release notes

  • Fixed a leak in reductions when a ufunc override errors or is …

    2.5.1release notes

  • Fixed several bugs in StringDType operations.

    2.5.1release notes

  • Allocatable module variables wrapped by f2py now appear in dir() output.

    2.5.0release notes

  • numpy.triu_indices now accepts unsigned integers in all cases.

    2.5.0release notes

  • StringDType comparisons now correctly handle embedded NULL bytes.

    2.5.0release notes

  • Fixes a regression in arr.conj().

    2.4.6release notes

  • Fixes non-unitary results from np.linalg.svd(..., hermitian=True).

    2.4.6release notes

  • Fixes support for runtime type checkers.

    2.4.5release notes

  • Maps complex_long_double to NPY_CLONGDOUBLE.

    2.4.5release notes

  • Fixes typing for boolean and non-1D inputs.

    2.4.5release notes

  • Fixes in-place aliasing when out is the input.

    2.4.5release notes

  • Fixes a segfault when __getitem__ raises.

    2.4.5release notes

  • Undo the deprecation of the signature used by old pickles.

    2.4.5release notes

  • Fixes failures with a 0-dimensional out argument.

    2.4.5release notes

  • Fixes the assignability of np.shape for Python lists.

    2.4.5release notes

  • Fixes a memory leak when the fill-zero loop raises.

    2.4.5release notes

  • Prevents a deadlock caused by downstream code importing NumPy during dlopen.

    2.4.5release notes

  • Fixes typing for the axis parameter.

    2.4.5release notes

  • Fixes incorrect temporary elision for new-style user-defined dtypes.

    2.4.5release notes

  • Fixes 64-bit selection by using NPY_SIZEOF_UINTP.

    2.4.4release notes

  • Avoids a warning when a ufunc is called with where=True and no output.

    2.4.4release notes

  • Fixes handling of a bool array weekmask.

    2.4.3release notes

  • Fixes a weak hash function used by np.isin().

    2.4.3release notes

  • Fixes infinite recursion in np.ma.flatten_structured_array.

    2.4.3release notes

  • Adds missing extended precision imports to matlib's typing support.

    2.4.3release notes

  • Fixes the OpenBLAS threading problem on ARM.

    2.4.3release notesrelease notes

  • Fixes memory leaks discovered after the 2.4.1 release.

    2.4.2release notes

  • Updates OpenBLAS to fix hangs.

    2.4.2release notes

  • Fixes the quantile promotion fixup.

    2.4.2release notes

  • Fixes validation of contraction axes.

    2.4.2release notes

  • Fixes a leak in the flat assignment iterator.

    2.4.1release notes

  • Fixes the return type of histogram2d.

    2.4.1release notes

  • Preserves the SeedlessSequence typo so wheels using the random Cython API and built against NumPy < 2.4.0 run without errors.

    2.4.1release notes

  • Many NumPy functions, classes, and methods now return meaningful signatures instead of raising ValueError, improving introspection and tooling support.

    2.4.0release notes

  • Accuracy is improved for 16- and 32-bit floating-point input data.

    2.4.0release notes

  • This release supports Python versions 3.11–3.14.

    2.4.0release notesrelease notes

  • Fixed resize when the array contains references.

    2.3.5release notes

  • Fixed the implementation to avoid negating INT_MIN.

    2.3.5release notes

  • Fixed float16-sort failures on 32-bit x86 MSVC.

    2.3.4release notes

  • Fixed an assertion failure in buffer setup.

    2.3.4release notes

  • A malloc failure now emits MemoryError.

    2.3.4release notes

  • Fixed umath strides for AIX compatibility.

    2.3.4release notes

  • INT_MIN % -1 now returns 0 for all signed integer types.

    2.3.4release notes

  • Fixed negative samples generated by the Wald distribution.

    2.3.4release notes

  • Now handles common blocks with kind specifications from modules.

    2.0.0release notes

  • Python C-API functions can now be used correctly when parsing arguments typed as npy_intp.

    2.0.0release notes

  • The third argument now has str called on it automatically, matching the built-in assert statement's message behavior.

    2.0.0release notes

  • C code can still create intptr_t or uintptr_t typed arrays in a cross-platform way using the p type code.

    2.0.0release notes