You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The NumPy 2.4.1 is a patch release that fixes bugs discoved after the
2.4.0 release. In particular, the typo SeedlessSequence is preserved to
enable wheels using the random Cython API and built against NumPy < 2.4.0
to run without errors.
This release supports Python versions 3.11-3.14
Contributors
A total of 9 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
Alexander Shadchin
Bill Tompkins +
Charles Harris
Joren Hammudoglu
Marten van Kerkwijk
Nathan Goldbaum
Raghuveer Devulapalli
Ralf Gommers
Sebastian Berg
Pull requests merged
A total of 15 pull requests were merged for this release.
#30490: MAINT: Prepare 2.4.x for further development
The NumPy 2.4.0 release continues the work to improve free threaded Python
support, user dtypes implementation, and annotations. There are many expired
deprecations and bug fixes as well.
This release supports Python versions 3.11-3.14
Highlights
Apart from annotations and same_value kwarg, the 2.4 highlights are mostly
of interest to downstream developers. They should help in implementing new user
dtypes.
Many annotation improvements. In particular, runtime signature introspection.
New casting kwarg 'same_value' for casting by value.
New PyUFunc_AddLoopsFromSpec function that can be used to add user sort
loops using the ArrayMethod API.
New __numpy_dtype__ protocol.
Deprecations
Setting the strides attribute is deprecated
Setting the strides attribute is now deprecated since mutating
an array is unsafe if an array is shared, especially by multiple
threads. As an alternative, you can create a new view (no copy) via:
np.lib.stride_tricks.strided_window_view if applicable,
np.lib.stride_tricks.as_strided for the general case,
or the np.ndarray constructor (buffer is the original array) for a
light-weight version.
Positional out argument to np.maximum, np.minimum is deprecated
Passing the output array out positionally to numpy.maximum and numpy.minimum is deprecated. For example, np.maximum(a, b, c) will emit
a deprecation warning, since c is treated as the output buffer rather than
a third input.
Always pass the output with the keyword form, e.g. np.maximum(a, b, out=c).
This makes intent clear and simplifies type annotations.
When creating a new dtype a VisibleDeprecationWarning will be given if align= is not a boolean. This is mainly to prevent accidentally passing a
subarray align flag where it has no effect, such as np.dtype("f8", 3)
instead of np.dtype(("f8", 3)). We strongly suggest to always pass align= as a keyword argument.
Assertion and warning control utilities are deprecated
np.testing.assert_warns and np.testing.suppress_warnings are
deprecated. Use warnings.catch_warnings, warnings.filterwarnings, pytest.warns, or pytest.filterwarnings instead.
The numpy.fix function will be deprecated in a future release. It is
recommended to use numpy.trunc instead, as it provides the same
functionality of truncating decimal values to their integer parts. Static type
checkers might already report a warning for the use of numpy.fix.
in-place modification of ndarray.shape is pending deprecation
Setting the ndarray.shape attribute directly will be deprecated in a future
release. Instead of modifying the shape in place, it is recommended to use the numpy.reshape function. Static type checkers might already report a
warning for assignments to ndarray.shape.
Raise TypeError on attempt to convert array with ndim > 0 to scalar
Conversion of an array with ndim > 0 to a scalar was deprecated in NumPy
1.25. Now, attempting to do so raises TypeError. Ensure you extract a
single element from your array before performing this operation.
The fix_imports parameter was deprecated in NumPy 2.1.0 and is now removed.
This flag has been ignored since NumPy 1.17 and was only needed to support
loading files in Python 2 that were written in Python 3.
The newshape parameter was deprecated in NumPy 2.1.0 and has been
removed from numpy.reshape. Pass it positionally or use shape=
on newer NumPy versions.
numpy.array2string and numpy.sum deprecations finalized
The following long-deprecated APIs have been removed or converted to errors:
The style parameter has been removed from numpy.array2string.
This argument had no effect since Numpy 1.14.0. Any arguments following
it, such as formatter have now been made keyword-only.
Calling np.sum(generator) directly on a generator object now raises a TypeError. This behavior was deprecated in NumPy 1.15.0. Use np.sum(np.fromiter(generator)) or the python sum builtin instead.
NumPy's C extension modules have begun to use multi-phase initialisation, as
defined by PEP 489. As part of this, a new explicit check has been added that
each such module is only imported once per Python process. This comes with
the side-effect that deleting numpy from sys.modules and re-importing
it will now fail with an ImportError. This has always been unsafe, with
unexpected side-effects, though did not previously raise an error.
numpy.round now always returns a copy. Previously, it returned a view
for integer inputs for decimals >= 0 and a copy in all other cases.
This change brings round in line with ceil, floor and trunc.
Type-checkers will no longer accept calls to numpy.arange with start as a keyword argument. This was done for compatibility with
the Array API standard. At runtime it is still possible to use numpy.arange with start as a keyword argument.
The Macro NPY_ALIGNMENT_REQUIRED has been removed The macro was defined in
the npy_cpu.h file, so might be regarded as semi public. As it turns out,
with modern compilers and hardware it is almost always the case that
alignment is required, so numpy no longer uses the macro. It is unlikely
anyone uses it, but you might want to compile with the -Wundef flag or
equivalent to be sure.
The NPY_SORTKIND enum has been enhanced with new variables
This is of interest if you are using PyArray_Sort or PyArray_ArgSort.
We have changed the semantics of the old names in the NPY_SORTKIND enum and
added new ones. The changes are backward compatible, and no recompilation is
needed. The new names of interest are:
NPY_SORT_DEFAULT -- default sort (same value as NPY_QUICKSORT)
NPY_SORT_STABLE -- the sort must be stable (same value as NPY_MERGESORT)
NPY_SORT_DESCENDING -- the sort must be descending
The semantic change is that NPY_HEAPSORT is mapped to NPY_QUICKSORT when used.
Note that NPY_SORT_DESCENDING is not yet implemented.
New NPY_DT_get_constant slot for DType constant retrieval
A new slot NPY_DT_get_constant has been added to the DType API, allowing
dtype implementations to provide constant values such as machine limits and
special values. The slot function has the signature:
int get_constant(PyArray_Descr *descr, int constant_id, void *ptr)
It returns 1 on success, 0 if the constant is not available, or -1 on error.
The function is always called with the GIL held and may write to unaligned memory.
Integer constants (marked with the 1 << 16 bit) return npy_intp values,
while floating-point constants return values of the dtype's native type.
Implementing this can be used by user DTypes to provide numpy.finfo values.
A new PyUFunc_AddLoopsFromSpecs convenience function has been added to the C API.
This function allows adding multiple ufunc loops from their specs in one call
using a NULL-terminated array of PyUFunc_LoopSlot structs. It allows
registering sorting and argsorting loops using the new ArrayMethod API.
The casting kwarg now has a 'same_value' option that checks the actual
values can be round-trip cast without changing value. Currently it is only
implemented in ndarray.astype. This will raise a ValueError if any of the
values in the array would change as a result of the cast, including rounding of
floats or overflowing of ints.
StringDType fill_value support in numpy.ma.MaskedArray
Masked arrays now accept and preserve a Python str as their fill_value
when using the variable‑width StringDType (kind 'T'), including through
slicing and views. The default is 'N/A' and may be overridden by any valid
string. This fixes issue gh‑29421
and was implemented in pull request gh‑29423.
The ndmax option is now available for numpy.array.
It explicitly limits the maximum number of dimensions created from nested sequences.
This is particularly useful when creating arrays of list-like objects with dtype=object.
By default, NumPy recurses through all nesting levels to create the highest possible
dimensional array, but this behavior may not be desired when the intent is to preserve
nested structures as objects. The ndmax parameter provides explicit control over
this recursion depth.
Ufuncs called with a where mask and without an out positional or kwarg will
now emit a warning. This usage tends to trip up users who expect some value in
output locations where the mask is False (the ufunc will not touch those
locations). The warning can be suppressed by using out=None.
DType sorting and argsorting supports the ArrayMethod API
User-defined dtypes can now implement custom sorting and argsorting using the ArrayMethod API. This mechanism can be used in place of the PyArray_ArrFuncs slots which may be deprecated in the future.
The sorting and argsorting methods are registered by passing the arraymethod
specs that implement the operations to the new PyUFunc_AddLoopsFromSpecs
function. See the ArrayMethod API documentation for details.
NumPy now has a new __numpy_dtype__ protocol. NumPy will check
for this attribute when converting to a NumPy dtype via np.dtype(obj)
or any dtype= argument.
Downstream projects are encouraged to implement this for all dtype like
objects which may previously have used a .dtype attribute that returned
a NumPy dtype.
We expect to deprecate .dtype in the future to prevent interpreting
array-like objects with a .dtype attribute as a dtype.
If you wish you can implement __numpy_dtype__ to ensure an earlier
warning or error (.dtype is ignored if this is found).
The flatiter object now shares the same index preparation logic as ndarray, ensuring consistent behavior and fixing several issues where
invalid indices were previously accepted or misinterpreted.
Key fixes and improvements:
Stricter index validation
Boolean non-array indices like arr.flat[[True, True]] were
incorrectly treated as arr.flat[np.array([1, 1], dtype=int)].
They now raise an index error. Note that indices that match the
iterator's shape are expected to not raise in the future and be
handled as regular boolean indices. Use np.asarray(<index>) if
you want to match that behavior.
Float non-array indices were also cast to integer and incorrectly
treated as arr.flat[np.array([1.0, 1.0], dtype=int)]. This is now
deprecated and will be removed in a future version.
0-dimensional boolean indices like arr.flat[True] are also
deprecated and will be removed in a future version.
Consistent error types:
Certain invalid flatiter indices that previously raised ValueError
now correctly raise IndexError, aligning with ndarray behavior.
Improved error messages:
The error message for unsupported index operations now provides more
specific details, including explicitly listing the valid index types,
instead of the generic IndexError: unsupported index operation.
The error message generated by assert_array_compare which is used by functions
like assert_allclose, assert_array_less etc. now also includes information
about the indices at which the assertion fails.
Show unit information in __repr__ for datetime64("NaT")
When a datetime64 object is "Not a Time" (NaT), its __repr__ method now
includes the time unit of the datetime64 type. This makes it consistent with
the behavior of a timedelta64 object.
The speed of calculations on scalars has been improved by about a factor 6 for
ufuncs that take only one input (like np.sin(scalar)), reducing the speed
difference from their math equivalents from a factor 19 to 3 (the speed
for arrays is left unchanged).
The numpy.finfo class has been completely refactored to obtain floating-point
constants directly from C compiler macros rather than deriving them at runtime.
This provides better accuracy, platform compatibility and corrected
several attribute calculations:
Constants like eps, min, max, smallest_normal, and smallest_subnormal now come directly from standard C macros (FLT_EPSILON, DBL_MIN, etc.), ensuring platform-correct values.
The deprecated MachAr runtime discovery mechanism has been removed.
Derived attributes have been corrected to match standard definitions: machep and negep now use int(log2(eps)); nexp accounts for
all exponent patterns; nmant excludes the implicit bit; and minexp
follows the C standard definition.
longdouble constants, Specifically smallest_normal now follows the
C standard definitions as per respecitive platform.
Special handling added for PowerPC's IBM double-double format.
New test suite added in test_finfo.py to validate all finfo properties against expected machine arithmetic values for
float16, float32, and float64 types.
Multiple axes are now supported in numpy.trim_zeros
The axis argument of numpy.trim_zeros now accepts a sequence; for example np.trim_zeros(x, axis=(0, 1)) will trim the zeros from a multi-dimensional
array x along axes 0 and 1. This fixes issue gh‑29945 and was implemented
in pull request gh‑29947.
Runtime signature introspection support has been significantly improved
Many NumPy functions, classes, and methods that previously raised ValueError when passed to inspect.signature() now return meaningful
signatures. This improves support for runtime type checking, IDE autocomplete,
documentation generation, and runtime introspection capabilities across the
NumPy API.
Over three hundred classes and functions have been updated in total, including,
but not limited to, core classes such as ndarray, generic, dtype, ufunc, broadcast, nditer, etc., most methods of ndarray and
scalar types, array constructor functions (array, empty, arange, fromiter, etc.), all ufuncs, and many other commonly used functions,
including dot, concat, where, bincount, can_cast, and
numerous others.
Performance improvements to np.unique for string dtypes
The hash-based algorithm for unique extraction provides an order-of-magnitude
speedup on large string arrays. In an internal benchmark with about 1 billion
string elements, the hash-based np.unique completed in roughly 33.5 seconds,
compared to 498 seconds with the sort-based method -- about 15× faster for
unsorted unique operations on strings. This improvement greatly reduces the
time to find unique values in very large string datasets.
The numpy.ndindex function now uses itertools.product internally,
providing significant improvements in performance for large iteration spaces,
while maintaining the original behavior and interface. For example, for an
array of shape (50, 60, 90) the NumPy ndindex benchmark improves
performance by a factor 5.2.
Performance improvements to np.unique for complex dtypes
The hash-based algorithm for unique extraction now also supports
complex dtypes, offering noticeable performance gains.
In our benchmarks on complex128 arrays with 200,000 elements,
the hash-based approach was about 1.4--1.5× faster
than the sort-based baseline when there were 20% of unique values,
and about 5× faster when there were 0.2% of unique values.
Multiplication between a string and integer now raises OverflowError instead
of MemoryError if the result of the multiplication would create a string that
is too large to be represented. This follows Python's behavior.
unique_values for string dtypes may return unsorted data
np.unique now supports hash‐based duplicate removal for string dtypes.
This enhancement extends the hash-table algorithm to byte strings ('S'),
Unicode strings ('U'), and the experimental string dtype ('T', StringDType).
As a result, calling np.unique() on an array of strings will use
the faster hash-based method to obtain unique values.
Note that this hash-based method does not guarantee that the returned unique values will be sorted.
This also works for StringDType arrays containing None (missing values)
when using equal_nan=True (treating missing values as equal).
IMPORTANT: The default setting for cpu-baseline on x86 has been raised
to x86-64-v2 microarchitecture. This can be changed to none during build
time to support older CPUs, though SIMD optimizations for pre-2009 processors
are no longer maintained.
NumPy has reorganized x86 CPU features into microarchitecture-based groups
instead of individual features, aligning with Linux distribution standards and
Google Highway requirements.
Key changes:
Replaced individual x86 features with microarchitecture levels: X86_V2, X86_V3, and X86_V4
Raised the baseline to X86_V2
Improved - operator behavior to properly exclude successor features that
imply the excluded feature
Added meson redirections for removed feature names to maintain backward
compatibility
Removed compiler compatibility workarounds for partial feature support (e.g.,
AVX512 without mask operations)
Removed legacy AMD features (XOP, FMA4) and discontinued Intel Xeon Phi
support
The array interface now accepts NULL pointers (NumPy will do its own dummy
allocation, though). Previously, these incorrectly triggered an undocumented
scalar path. In the unlikely event that the scalar path was actually desired,
you can (for now) achieve the previous behavior via the correct scalar path by
not providing a data field at all.
unique_values for complex dtypes may return unsorted data
np.unique now supports hash‐based duplicate removal for complex dtypes. This
enhancement extends the hash‐table algorithm to all complex types ('c'), and
their extended precision variants. The hash‐based method provides faster
extraction of unique values but does not guarantee that the result will be
sorted.
Sorting kind='heapsort' now maps to kind='quicksort'
It is unlikely that this change will be noticed, but if you do see a change in
execution time or unstable argsort order, that is likely the cause. Please let
us know if there is a performance regression. Congratulate us if it is improved
:)
The npymath and npyrandom libraries now have a .lib rather than a .a file extension on win-arm64, for compatibility for building with MSVC
and setuptools. Please note that using these static libraries is
discouraged and for existing projects using it, it's best to use it with a
matching compiler toolchain, which is clang-cl on Windows on Arm.
The NumPy 2.3.5 release is a patch release split between a number of maintenance
updates and bug fixes. This release supports Python versions 3.11-3.14.
Contributors
A total of 10 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
Aaron Kollasch +
Charles Harris
Joren Hammudoglu
Matti Picus
Nathan Goldbaum
Rafael Laboissière +
Sayed Awad
Sebastian Berg
Warren Weckesser
Yasir Ashfaq +
Pull requests merged
A total of 16 pull requests were merged for this release.
#29979: MAINT: Prepare 2.3.x for further development
#30026: SIMD, BLD: Backport FPMATH mode on x86-32 and filter successor...
The NumPy 2.3.4 release is a patch release split between a number of maintenance
updates and bug fixes. This release supports Python versions 3.11-3.14. This
release is based on Python 3.14.0 final.
Changes
The npymath and npyrandom libraries now have a .lib rather than a .a file extension on win-arm64, for compatibility for building with MSVC and setuptools. Please note that using these static libraries is discouraged
and for existing projects using it, it's best to use it with a matching
compiler toolchain, which is clang-cl on Windows on Arm.
The NumPy 2.3.3 release is a patch release split between a number of maintenance
updates and bug fixes. This release supports Python versions 3.11-3.14. Note
that the 3.14.0 final is currently expected in Oct, 2025. This release is based
on 3.14.0rc2.
Contributors
A total of 13 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
Aleksandr A. Voyt +
Bernard Roesler +
Charles Harris
Hunter Hogan +
Joren Hammudoglu
Maanas Arora
Matti Picus
Nathan Goldbaum
Raghuveer Devulapalli
Sanjay Kumar Sakamuri Kamalakar +
Tobias Markus +
Warren Weckesser
Zebreus +
Pull requests merged
A total of 23 pull requests were merged for this release.
#29440: MAINT: Prepare 2.3.x for further development.
#29446: BUG: Fix test_configtool_pkgconfigdir to resolve PKG_CONFIG_DIR...
#29447: BLD: allow targeting webassembly without emscripten
852ae5bed3478b92f093e30f785c98e0cb62fa0a939ed057c31716e18a7a22b9 numpy-2.3.2-cp311-cp311-macosx_10_9_x86_64.whl
7a0e27186e781a69959d0230dd9909b5e26024f8da10683bd6344baea1885168 numpy-2.3.2-cp311-cp311-macosx_11_0_arm64.whl
f0a1a8476ad77a228e41619af2fa9505cf69df928e9aaa165746584ea17fed2b numpy-2.3.2-cp311-cp311-macosx_14_0_arm64.whl
cbc95b3813920145032412f7e33d12080f11dc776262df1712e1638207dde9e8 numpy-2.3.2-cp311-cp311-macosx_14_0_x86_64.whl
f75018be4980a7324edc5930fe39aa391d5734531b1926968605416ff58c332d numpy-2.3.2-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
20b8200721840f5621b7bd03f8dcd78de33ec522fc40dc2641aa09537df010c3 numpy-2.3.2-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
1f91e5c028504660d606340a084db4b216567ded1056ea2b4be4f9d10b67197f numpy-2.3.2-cp311-cp311-musllinux_1_2_aarch64.whl
fb1752a3bb9a3ad2d6b090b88a9a0ae1cd6f004ef95f75825e2f382c183b2097 numpy-2.3.2-cp311-cp311-musllinux_1_2_x86_64.whl
4ae6863868aaee2f57503c7a5052b3a2807cf7a3914475e637a0ecd366ced220 numpy-2.3.2-cp311-cp311-win32.whl
240259d6564f1c65424bcd10f435145a7644a65a6811cfc3201c4a429ba79170 numpy-2.3.2-cp311-cp311-win_amd64.whl
4209f874d45f921bde2cff1ffcd8a3695f545ad2ffbef6d3d3c6768162efab89 numpy-2.3.2-cp311-cp311-win_arm64.whl
bc3186bea41fae9d8e90c2b4fb5f0a1f5a690682da79b92574d63f56b529080b numpy-2.3.2-cp312-cp312-macosx_10_13_x86_64.whl
2f4f0215edb189048a3c03bd5b19345bdfa7b45a7a6f72ae5945d2a28272727f numpy-2.3.2-cp312-cp312-macosx_11_0_arm64.whl
8b1224a734cd509f70816455c3cffe13a4f599b1bf7130f913ba0e2c0b2006c0 numpy-2.3.2-cp312-cp312-macosx_14_0_arm64.whl
3dcf02866b977a38ba3ec10215220609ab9667378a9e2150615673f3ffd6c73b numpy-2.3.2-cp312-cp312-macosx_14_0_x86_64.whl
572d5512df5470f50ada8d1972c5f1082d9a0b7aa5944db8084077570cf98370 numpy-2.3.2-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
8145dd6d10df13c559d1e4314df29695613575183fa2e2d11fac4c208c8a1f73 numpy-2.3.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
103ea7063fa624af04a791c39f97070bf93b96d7af7eb23530cd087dc8dbe9dc numpy-2.3.2-cp312-cp312-musllinux_1_2_aarch64.whl
fc927d7f289d14f5e037be917539620603294454130b6de200091e23d27dc9be numpy-2.3.2-cp312-cp312-musllinux_1_2_x86_64.whl
d95f59afe7f808c103be692175008bab926b59309ade3e6d25009e9a171f7036 numpy-2.3.2-cp312-cp312-win32.whl
9e196ade2400c0c737d93465327d1ae7c06c7cb8a1756121ebf54b06ca183c7f numpy-2.3.2-cp312-cp312-win_amd64.whl
ee807923782faaf60d0d7331f5e86da7d5e3079e28b291973c545476c2b00d07 numpy-2.3.2-cp312-cp312-win_arm64.whl
c8d9727f5316a256425892b043736d63e89ed15bbfe6556c5ff4d9d4448ff3b3 numpy-2.3.2-cp313-cp313-macosx_10_13_x86_64.whl
efc81393f25f14d11c9d161e46e6ee348637c0a1e8a54bf9dedc472a3fae993b numpy-2.3.2-cp313-cp313-macosx_11_0_arm64.whl
dd937f088a2df683cbb79dda9a772b62a3e5a8a7e76690612c2737f38c6ef1b6 numpy-2.3.2-cp313-cp313-macosx_14_0_arm64.whl
11e58218c0c46c80509186e460d79fbdc9ca1eb8d8aee39d8f2dc768eb781089 numpy-2.3.2-cp313-cp313-macosx_14_0_x86_64.whl
5ad4ebcb683a1f99f4f392cc522ee20a18b2bb12a2c1c42c3d48d5a1adc9d3d2 numpy-2.3.2-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
9
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/ZauJulio/FeaturesAnalyzer).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjQyLjkyLjEiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->
renovatebot
changed the title
fix(deps): update dependency numpy to v2.2.2
fix(deps): update dependency numpy to v2.2.3
Feb 13, 2025
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.
This PR contains the following updates:
==2.2.1→==2.4.2Release Notes
numpy/numpy (numpy)
v2.4.2Compare Source
v2.4.1: 2.4.1 (Jan 10, 2026)Compare Source
NumPy 2.4.1 Release Notes
The NumPy 2.4.1 is a patch release that fixes bugs discoved after the
2.4.0 release. In particular, the typo
SeedlessSequenceis preserved toenable wheels using the random Cython API and built against NumPy < 2.4.0
to run without errors.
This release supports Python versions 3.11-3.14
Contributors
A total of 9 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
Pull requests merged
A total of 15 pull requests were merged for this release.
numpy.select: fixdefaultparameter docstring...numpy.select: allow passing array-likedefault...v2.4.0: 2.4.0 (Dec 20, 2025)Compare Source
NumPy 2.4.0 Release Notes
The NumPy 2.4.0 release continues the work to improve free threaded Python
support, user dtypes implementation, and annotations. There are many expired
deprecations and bug fixes as well.
This release supports Python versions 3.11-3.14
Highlights
Apart from annotations and
same_valuekwarg, the 2.4 highlights are mostlyof interest to downstream developers. They should help in implementing new user
dtypes.
castingkwarg'same_value'for casting by value.PyUFunc_AddLoopsFromSpecfunction that can be used to add user sortloops using the
ArrayMethodAPI.__numpy_dtype__protocol.Deprecations
Setting the
stridesattribute is deprecatedSetting the strides attribute is now deprecated since mutating
an array is unsafe if an array is shared, especially by multiple
threads. As an alternative, you can create a new view (no copy) via:
np.lib.stride_tricks.strided_window_viewif applicable,np.lib.stride_tricks.as_stridedfor the general case,np.ndarrayconstructor (bufferis the original array) for alight-weight version.
(gh-28925)
Positional
outargument tonp.maximum,np.minimumis deprecatedPassing the output array
outpositionally tonumpy.maximumandnumpy.minimumis deprecated. For example,np.maximum(a, b, c)will emita deprecation warning, since
cis treated as the output buffer rather thana third input.
Always pass the output with the keyword form, e.g.
np.maximum(a, b, out=c).This makes intent clear and simplifies type annotations.
(gh-29052)
align=must be passed as boolean tonp.dtype()When creating a new
dtypeaVisibleDeprecationWarningwill be given ifalign=is not a boolean. This is mainly to prevent accidentally passing asubarray align flag where it has no effect, such as
np.dtype("f8", 3)instead of
np.dtype(("f8", 3)). We strongly suggest to always passalign=as a keyword argument.(gh-29301)
Assertion and warning control utilities are deprecated
np.testing.assert_warnsandnp.testing.suppress_warningsaredeprecated. Use
warnings.catch_warnings,warnings.filterwarnings,pytest.warns, orpytest.filterwarningsinstead.(gh-29550)
np.fixis pending deprecationThe
numpy.fixfunction will be deprecated in a future release. It isrecommended to use
numpy.truncinstead, as it provides the samefunctionality of truncating decimal values to their integer parts. Static type
checkers might already report a warning for the use of
numpy.fix.(gh-30168)
in-place modification of
ndarray.shapeis pending deprecationSetting the
ndarray.shapeattribute directly will be deprecated in a futurerelease. Instead of modifying the shape in place, it is recommended to use the
numpy.reshapefunction. Static type checkers might already report awarning for assignments to
ndarray.shape.(gh-30282)
Deprecation of
numpy.lib.user_array.containerThe
numpy.lib.user_array.containerclass is deprecated and will be removedin a future version.
(gh-30284)
Expired deprecations
Removed deprecated
MachArruntime discovery mechanism.(gh-29836)
Raise
TypeErroron attempt to convert array withndim > 0to scalarConversion of an array with
ndim > 0to a scalar was deprecated in NumPy1.25. Now, attempting to do so raises
TypeError. Ensure you extract asingle element from your array before performing this operation.
(gh-29841)
Removed numpy.linalg.linalg and numpy.fft.helper
The following were deprecated in NumPy 2.0 and have been moved to private
modules:
numpy.linalg.linalgUse
numpy.linalginstead.numpy.fft.helperUse
numpy.fftinstead.(gh-29909)
Removed
interpolationparameter from quantile and percentile functionsThe
interpolationparameter was deprecated in NumPy 1.22.0 and has beenremoved from the following functions:
numpy.percentilenumpy.nanpercentilenumpy.quantilenumpy.nanquantileUse the
methodparameter instead.(gh-29973)
Removed
numpy.in1dnumpy.in1dhas been deprecated since NumPy 2.0 and is now removed in favor ofnumpy.isin.(gh-29978)
Removed
numpy.ndindex.ndincr()The
ndindex.ndincr()method has been deprecated since NumPy 1.20 and is nowremoved; use
next(ndindex)instead.(gh-29980)
Removed
fix_importsparameter fromnumpy.saveThe
fix_importsparameter was deprecated in NumPy 2.1.0 and is now removed.This flag has been ignored since NumPy 1.17 and was only needed to support
loading files in Python 2 that were written in Python 3.
(gh-29984)
Removal of four undocumented
ndarray.ctypesmethodsFour undocumented methods of the
ndarray.ctypesobject have been removed:_ctypes.get_data()(use_ctypes.datainstead)_ctypes.get_shape()(use_ctypes.shapeinstead)_ctypes.get_strides()(use_ctypes.stridesinstead)_ctypes.get_as_parameter()(use_ctypes._as_parameter_instead)These methods have been deprecated since NumPy 1.21.
(gh-29986)
Removed
newshapeparameter fromnumpy.reshapeThe
newshapeparameter was deprecated in NumPy 2.1.0 and has beenremoved from
numpy.reshape. Pass it positionally or useshape=on newer NumPy versions.
(gh-29994)
Removal of deprecated functions and arguments
The following long-deprecated APIs have been removed:
numpy.trapz--- deprecated since NumPy 2.0 (2023-08-18). Usenumpy.trapezoidorscipy.integratefunctions instead.dispfunction --- deprecated from 2.0 release and no longer functional. Useyour own printing function instead.
biasandddofarguments innumpy.corrcoef--- these had no effectsince NumPy 1.10.
(gh-29997)
Removed
delimitorparameter fromnumpy.ma.mrecords.fromtextfile()The
delimitorparameter was deprecated in NumPy 1.22.0 and has beenremoved from
numpy.ma.mrecords.fromtextfile(). Usedelimiterinstead.(gh-30021)
numpy.array2stringandnumpy.sumdeprecations finalizedThe following long-deprecated APIs have been removed or converted to errors:
styleparameter has been removed fromnumpy.array2string.This argument had no effect since Numpy 1.14.0. Any arguments following
it, such as
formatterhave now been made keyword-only.np.sum(generator)directly on a generator object now raises aTypeError. This behavior was deprecated in NumPy 1.15.0. Usenp.sum(np.fromiter(generator))or the pythonsumbuiltin instead.(gh-30068)
Compatibility notes
NumPy's C extension modules have begun to use multi-phase initialisation, as
defined by PEP 489. As part of this, a new explicit check has been added that
each such module is only imported once per Python process. This comes with
the side-effect that deleting
numpyfromsys.modulesand re-importingit will now fail with an
ImportError. This has always been unsafe, withunexpected side-effects, though did not previously raise an error.
(gh-29030)
numpy.roundnow always returns a copy. Previously, it returned a viewfor integer inputs for
decimals >= 0and a copy in all other cases.This change brings
roundin line withceil,floorandtrunc.(gh-29137)
Type-checkers will no longer accept calls to
numpy.arangewithstartas a keyword argument. This was done for compatibility withthe Array API standard. At runtime it is still possible to use
numpy.arangewithstartas a keyword argument.(gh-30147)
The Macro NPY_ALIGNMENT_REQUIRED has been removed The macro was defined in
the
npy_cpu.hfile, so might be regarded as semi public. As it turns out,with modern compilers and hardware it is almost always the case that
alignment is required, so numpy no longer uses the macro. It is unlikely
anyone uses it, but you might want to compile with the
-Wundefflag orequivalent to be sure.
(gh-29094)
C API changes
The NPY_SORTKIND enum has been enhanced with new variables
This is of interest if you are using
PyArray_SortorPyArray_ArgSort.We have changed the semantics of the old names in the
NPY_SORTKINDenum andadded new ones. The changes are backward compatible, and no recompilation is
needed. The new names of interest are:
NPY_SORT_DEFAULT-- default sort (same value asNPY_QUICKSORT)NPY_SORT_STABLE-- the sort must be stable (same value asNPY_MERGESORT)NPY_SORT_DESCENDING-- the sort must be descendingThe semantic change is that
NPY_HEAPSORTis mapped toNPY_QUICKSORTwhen used.Note that
NPY_SORT_DESCENDINGis not yet implemented.(gh-29642)
New
NPY_DT_get_constantslot for DType constant retrievalA new slot
NPY_DT_get_constanthas been added to the DType API, allowingdtype implementations to provide constant values such as machine limits and
special values. The slot function has the signature:
It returns 1 on success, 0 if the constant is not available, or -1 on error.
The function is always called with the GIL held and may write to unaligned memory.
Integer constants (marked with the
1 << 16bit) returnnpy_intpvalues,while floating-point constants return values of the dtype's native type.
Implementing this can be used by user DTypes to provide
numpy.finfovalues.(gh-29836)
A new
PyUFunc_AddLoopsFromSpecsconvenience function has been added to the C API.This function allows adding multiple ufunc loops from their specs in one call
using a NULL-terminated array of
PyUFunc_LoopSlotstructs. It allowsregistering sorting and argsorting loops using the new ArrayMethod API.
(gh-29900)
New Features
Let
np.sizeaccept multiple axes.(gh-29240)
Extend
numpy.padto accept a dictionary for thepad_widthargument.(gh-29273)
'same_value'for casting by valueThe
castingkwarg now has a'same_value'option that checks the actualvalues can be round-trip cast without changing value. Currently it is only
implemented in
ndarray.astype. This will raise aValueErrorif any of thevalues in the array would change as a result of the cast, including rounding of
floats or overflowing of ints.
(gh-29129)
StringDTypefill_value support innumpy.ma.MaskedArrayMasked arrays now accept and preserve a Python
stras theirfill_valuewhen using the variable‑width
StringDType(kind'T'), including throughslicing and views. The default is
'N/A'and may be overridden by any validstring. This fixes issue gh‑29421
and was implemented in pull request gh‑29423.
(gh-29423)
ndmaxoption fornumpy.arrayThe
ndmaxoption is now available fornumpy.array.It explicitly limits the maximum number of dimensions created from nested sequences.
This is particularly useful when creating arrays of list-like objects with
dtype=object.By default, NumPy recurses through all nesting levels to create the highest possible
dimensional array, but this behavior may not be desired when the intent is to preserve
nested structures as objects. The
ndmaxparameter provides explicit control overthis recursion depth.
(gh-29569)
Warning emitted when using
wherewithoutoutUfuncs called with a
wheremask and without anoutpositional or kwarg willnow emit a warning. This usage tends to trip up users who expect some value in
output locations where the mask is
False(the ufunc will not touch thoselocations). The warning can be suppressed by using
out=None.(gh-29813)
DType sorting and argsorting supports the ArrayMethod API
User-defined dtypes can now implement custom sorting and argsorting using the
ArrayMethodAPI. This mechanism can be used in place of thePyArray_ArrFuncsslots which may be deprecated in the future.The sorting and argsorting methods are registered by passing the arraymethod
specs that implement the operations to the new
PyUFunc_AddLoopsFromSpecsfunction. See the
ArrayMethodAPI documentation for details.(gh-29900)
New
__numpy_dtype__protocolNumPy now has a new
__numpy_dtype__protocol. NumPy will checkfor this attribute when converting to a NumPy dtype via
np.dtype(obj)or any
dtype=argument.Downstream projects are encouraged to implement this for all dtype like
objects which may previously have used a
.dtypeattribute that returneda NumPy dtype.
We expect to deprecate
.dtypein the future to prevent interpretingarray-like objects with a
.dtypeattribute as a dtype.If you wish you can implement
__numpy_dtype__to ensure an earlierwarning or error (
.dtypeis ignored if this is found).(gh-30179)
Improvements
Fix
flatiterindexing edge casesThe
flatiterobject now shares the same index preparation logic asndarray, ensuring consistent behavior and fixing several issues whereinvalid indices were previously accepted or misinterpreted.
Key fixes and improvements:
Stricter index validation
arr.flat[[True, True]]wereincorrectly treated as
arr.flat[np.array([1, 1], dtype=int)].They now raise an index error. Note that indices that match the
iterator's shape are expected to not raise in the future and be
handled as regular boolean indices. Use
np.asarray(<index>)ifyou want to match that behavior.
treated as
arr.flat[np.array([1.0, 1.0], dtype=int)]. This is nowdeprecated and will be removed in a future version.
arr.flat[True]are alsodeprecated and will be removed in a future version.
Consistent error types:
Certain invalid
flatiterindices that previously raisedValueErrornow correctly raise
IndexError, aligning withndarraybehavior.Improved error messages:
The error message for unsupported index operations now provides more
specific details, including explicitly listing the valid index types,
instead of the generic
IndexError: unsupported index operation.(gh-28590)
Improved error handling in
np.quantile[np.quantile]{.title-ref} now raises errors if:
np.nannp.inf(gh-28595)
Improved error message for
assert_array_compareThe error message generated by
assert_array_comparewhich is used by functionslike
assert_allclose,assert_array_lessetc. now also includes informationabout the indices at which the assertion fails.
(gh-29112)
Show unit information in
__repr__fordatetime64("NaT")When a
datetime64object is "Not a Time" (NaT), its__repr__method nowincludes the time unit of the datetime64 type. This makes it consistent with
the behavior of a
timedelta64object.(gh-29396)
Performance increase for scalar calculations
The speed of calculations on scalars has been improved by about a factor 6 for
ufuncs that take only one input (like
np.sin(scalar)), reducing the speeddifference from their
mathequivalents from a factor 19 to 3 (the speedfor arrays is left unchanged).
(gh-29819)
numpy.finfoRefactorThe
numpy.finfoclass has been completely refactored to obtain floating-pointconstants directly from C compiler macros rather than deriving them at runtime.
This provides better accuracy, platform compatibility and corrected
several attribute calculations:
eps,min,max,smallest_normal, andsmallest_subnormalnow come directly from standard C macros (FLT_EPSILON,DBL_MIN, etc.), ensuring platform-correct values.MachArruntime discovery mechanism has been removed.machepandnegepnow useint(log2(eps));nexpaccounts forall exponent patterns;
nmantexcludes the implicit bit; andminexpfollows the C standard definition.
smallest_normalnow follows theC standard definitions as per respecitive platform.
test_finfo.pyto validate allfinfoproperties against expected machine arithmetic values forfloat16, float32, and float64 types.
(gh-29836)
Multiple axes are now supported in
numpy.trim_zerosThe
axisargument ofnumpy.trim_zerosnow accepts a sequence; for examplenp.trim_zeros(x, axis=(0, 1))will trim the zeros from a multi-dimensionalarray
xalong axes 0 and 1. This fixes issuegh‑29945 and was implemented
in pull request gh‑29947.
(gh-29947)
Runtime signature introspection support has been significantly improved
Many NumPy functions, classes, and methods that previously raised
ValueErrorwhen passed toinspect.signature()now return meaningfulsignatures. This improves support for runtime type checking, IDE autocomplete,
documentation generation, and runtime introspection capabilities across the
NumPy API.
Over three hundred classes and functions have been updated in total, including,
but not limited to, core classes such as
ndarray,generic,dtype,ufunc,broadcast,nditer, etc., most methods ofndarrayandscalar types, array constructor functions (
array,empty,arange,fromiter, etc.), allufuncs, and many other commonly used functions,including
dot,concat,where,bincount,can_cast, andnumerous others.
(gh-30208)
Performance improvements and changes
Performance improvements to
np.uniquefor string dtypesThe hash-based algorithm for unique extraction provides an order-of-magnitude
speedup on large string arrays. In an internal benchmark with about 1 billion
string elements, the hash-based np.unique completed in roughly 33.5 seconds,
compared to 498 seconds with the sort-based method -- about 15× faster for
unsorted unique operations on strings. This improvement greatly reduces the
time to find unique values in very large string datasets.
(gh-28767)
Rewrite of
np.ndindexusingitertools.productThe
numpy.ndindexfunction now usesitertools.productinternally,providing significant improvements in performance for large iteration spaces,
while maintaining the original behavior and interface. For example, for an
array of shape (50, 60, 90) the NumPy
ndindexbenchmark improvesperformance by a factor 5.2.
(gh-29165)
Performance improvements to
np.uniquefor complex dtypesThe hash-based algorithm for unique extraction now also supports
complex dtypes, offering noticeable performance gains.
In our benchmarks on complex128 arrays with 200,000 elements,
the hash-based approach was about 1.4--1.5× faster
than the sort-based baseline when there were 20% of unique values,
and about 5× faster when there were 0.2% of unique values.
(gh-29537)
Changes
Multiplication between a string and integer now raises OverflowError instead
of MemoryError if the result of the multiplication would create a string that
is too large to be represented. This follows Python's behavior.
(gh-29060)
The accuracy of
np.quantileandnp.percentilefor 16- and 32-bitfloating point input data has been improved.
(gh-29105)
unique_valuesfor string dtypes may return unsorted datanp.unique now supports hash‐based duplicate removal for string dtypes.
This enhancement extends the hash-table algorithm to byte strings ('S'),
Unicode strings ('U'), and the experimental string dtype ('T', StringDType).
As a result, calling np.unique() on an array of strings will use
the faster hash-based method to obtain unique values.
Note that this hash-based method does not guarantee that the returned unique values will be sorted.
This also works for StringDType arrays containing None (missing values)
when using equal_nan=True (treating missing values as equal).
(gh-28767)
Modulate dispatched x86 CPU features
IMPORTANT: The default setting for
cpu-baselineon x86 has been raisedto
x86-64-v2microarchitecture. This can be changed to none during buildtime to support older CPUs, though SIMD optimizations for pre-2009 processors
are no longer maintained.
NumPy has reorganized x86 CPU features into microarchitecture-based groups
instead of individual features, aligning with Linux distribution standards and
Google Highway requirements.
Key changes:
X86_V2,X86_V3, andX86_V4X86_V2-operator behavior to properly exclude successor features thatimply the excluded feature
compatibility
AVX512 without mask operations)
support
New Feature Group Hierarchy:
Name Implies Includes
X86_V2SSESSE2SSE3SSSE3SSE4_1SSE4_2POPCNTCX16LAHFX86_V3X86_V2AVXAVX2FMA3BMIBMI2LZCNTF16CMOVBEX86_V4X86_V3AVX512FAVX512CDAVX512VLAVX512BWAVX512DQAVX512_ICLX86_V4AVX512VBMIAVX512VBMI2AVX512VNNIAVX512BITALGAVX512VPOPCNTDQAVX512IFMAVAESGFNIVPCLMULQDQAVX512_SPRAVX512_ICLAVX512FP16These groups correspond to CPU generations:
X86_V2: x86-64-v2 microarchitectures (CPUs since 2009)X86_V3: x86-64-v3 microarchitectures (CPUs since 2015)X86_V4: x86-64-v4 microarchitectures (AVX-512 capable CPUs)AVX512_ICL: Intel Ice Lake and similar CPUsAVX512_SPR: Intel Sapphire Rapids and newer CPUsOn 32-bit x86,
cx16is excluded fromX86_V2.Documentation has been updated with details on using these new feature groups
with the current meson build system.
(gh-28896)
Fix bug in
matmulfor non-contiguous out kwarg parameterIn some cases, if
outwas non-contiguous,np.matmulwould cause memorycorruption or a c-level assert. This was new to v2.3.0 and fixed in v2.3.1.
(gh-29179)
__array_interface__with NULL pointer changedThe array interface now accepts NULL pointers (NumPy will do its own dummy
allocation, though). Previously, these incorrectly triggered an undocumented
scalar path. In the unlikely event that the scalar path was actually desired,
you can (for now) achieve the previous behavior via the correct scalar path by
not providing a
datafield at all.(gh-29338)
unique_valuesfor complex dtypes may return unsorted datanp.unique now supports hash‐based duplicate removal for complex dtypes. This
enhancement extends the hash‐table algorithm to all complex types ('c'), and
their extended precision variants. The hash‐based method provides faster
extraction of unique values but does not guarantee that the result will be
sorted.
(gh-29537)
Sorting
kind='heapsort'now maps tokind='quicksort'It is unlikely that this change will be noticed, but if you do see a change in
execution time or unstable argsort order, that is likely the cause. Please let
us know if there is a performance regression. Congratulate us if it is improved
:)
(gh-29642)
numpy.typing.DTypeLikeno longer acceptsNoneThe type alias
numpy.typing.DTypeLikeno longer acceptsNone. Instead ofit should now be
instead.
(gh-29739)
The
npymathandnpyrandomlibraries now have a.librather than a.afile extension on win-arm64, for compatibility for building with MSVCand
setuptools. Please note that using these static libraries isdiscouraged and for existing projects using it, it's best to use it with a
matching compiler toolchain, which is
clang-clon Windows on Arm.(gh-29750)
v2.3.5: 2.3.5 (Nov 16, 2025)Compare Source
NumPy 2.3.5 Release Notes
The NumPy 2.3.5 release is a patch release split between a number of maintenance
updates and bug fixes. This release supports Python versions 3.11-3.14.
Contributors
A total of 10 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
Pull requests merged
A total of 16 pull requests were merged for this release.
orderparameter docs ofma.asanyarray...v2.3.4: (Oct 15, 2025)Compare Source
NumPy 2.3.4 Release Notes
The NumPy 2.3.4 release is a patch release split between a number of maintenance
updates and bug fixes. This release supports Python versions 3.11-3.14. This
release is based on Python 3.14.0 final.
Changes
The
npymathandnpyrandomlibraries now have a.librather than a.afile extension on win-arm64, for compatibility for building with MSVC andsetuptools. Please note that using these static libraries is discouragedand for existing projects using it, it's best to use it with a matching
compiler toolchain, which is
clang-clon Windows on Arm.(gh-29750)
Contributors
A total of 17 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
Pull requests merged
A total of 30 pull requests were merged for this release.
dtyperefcount in__array__(#29715)__slots__(#29901)testing._private(#29902)errstate(#29914)@classmethodarg to clsv2.3.3: 2.3.3 (Sep 9, 2025)Compare Source
NumPy 2.3.3 Release Notes
The NumPy 2.3.3 release is a patch release split between a number of maintenance
updates and bug fixes. This release supports Python versions 3.11-3.14. Note
that the 3.14.0 final is currently expected in Oct, 2025. This release is based
on 3.14.0rc2.
Contributors
A total of 13 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
Pull requests merged
A total of 23 pull requests were merged for this release.
sortedkwarg touniquev2.3.2: (Jul 24, 2025)Compare Source
NumPy 2.3.2 Release Notes
The NumPy 2.3.2 release is a patch release with a number of bug fixes
and maintenance updates. The highlights are:
This release supports Python versions 3.11-3.14
Contributors
A total of 9 people contributed to this release. People with a "+" by
their names contributed a patch for the first time.
Pull requests merged
A total of 16 pull requests were merged for this release.
np.char.arrayandnp.char.asarray...squareonarr \*\* 2(#29392)Checksums
MD5
SHA256