NumPy 2.2.0 Release Notes
The NumPy 2.2.0 release is quick release that brings us back into sync
with the usual twice yearly release cycle. There have been an number of
small cleanups, as well as work bringing the new StringDType to
completion and improving support for free threaded Python. Highlights
are:
- New functions
matvec
andvecmat
, see below. - Many improved annotations.
- Improved support for the new StringDType.
- Improved support for free threaded Python
- Fixes for f2py
This release supports Python versions 3.10-3.13.
Deprecations
-
_add_newdoc_ufunc
is now deprecated.ufunc.__doc__ = newdoc
should be used instead.(gh-27735)
Expired deprecations
-
bool(np.array([]))
and other empty arrays will now raise an error.
Usearr.size > 0
instead to check whether an array has no
elements.(gh-27160)
Compatibility notes
-
numpy.cov
now properly transposes single-row (2d
array) design matrices whenrowvar=False
. Previously, single-row
design matrices would return a scalar in this scenario, which is not
correct, so this is a behavior change and an array of the
appropriate shape will now be returned.(gh-27661)
New Features
-
New functions for matrix-vector and vector-matrix products
Two new generalized ufuncs were defined:
numpy.matvec
- matrix-vector product, treating the
arguments as stacks of matrices and column vectors,
respectively.numpy.vecmat
- vector-matrix product, treating the
arguments as stacks of column vectors and matrices,
respectively. For complex vectors, the conjugate is taken.
These add to the existing
numpy.matmul
as well as to
numpy.vecdot
, which was added in numpy 2.0.Note that
numpy.matmul
never takes a complex
conjugate, also not when its left input is a vector, while both
numpy.vecdot
andnumpy.vecmat
do take
the conjugate for complex vectors on the left-hand side (which are
taken to be the ones that are transposed, following the physics
convention).(gh-25675)
-
np.complexfloating[T, T]
can now also be written as
np.complexfloating[T]
(gh-27420)
-
UFuncs now support
__dict__
attribute and allow overriding
__doc__
(either directly or viaufunc.__dict__["__doc__"]
).
__dict__
can be used to also override other properties, such as
__module__
or__qualname__
.(gh-27735)
-
The "nbit" type parameter of
np.number
and its subtypes now
defaults totyping.Any
. This way, type-checkers will infer
annotations such asx: np.floating
asx: np.floating[Any]
, even
in strict mode.(gh-27736)
Improvements
-
The
datetime64
andtimedelta64
hashes now correctly match the
Pythons builtindatetime
andtimedelta
ones. The hashes now
evaluated equal even for equal values with different time units.(gh-14622)
-
Fixed a number of issues around promotion for string ufuncs with
StringDType arguments. Mixing StringDType and the fixed-width DTypes
using the string ufuncs should now generate much more uniform
results.(gh-27636)
-
Improved support for empty
memmap
. Previously an empty
memmap
would fail unless a non-zerooffset
was set.
Now a zero-sizememmap
is supported even if
offset=0
. To achieve this, if amemmap
is mapped to
an empty file that file is padded with a single byte.(gh-27723)
-
A regression has been fixed which allows F2PY users to expose variables
to Python in modules with only assignments, and also fixes situations
where multiple modules are present within a single source file.(gh-27695)
Performance improvements and changes
-
Improved multithreaded scaling on the free-threaded build when many
threads simultaneously call the same ufunc operations.(gh-27896)
-
NumPy now uses fast-on-failure attribute lookups for protocols. This
can greatly reduce overheads of function calls or array creation
especially with custom Python objects. The largest improvements will
be seen on Python 3.12 or newer.(gh-27119)
-
OpenBLAS on x86_64 and i686 is built with fewer kernels. Based on
benchmarking, there are 5 clusters of performance around these
kernels:PRESCOTT NEHALEM SANDYBRIDGE HASWELL SKYLAKEX
. -
OpenBLAS on windows is linked without quadmath, simplifying
licensing -
Due to a regression in OpenBLAS on windows, the performance
improvements when using multiple threads for OpenBLAS 0.3.26 were
reverted.(gh-27147)
-
NumPy now indicates hugepages also for large
np.zeros
allocations
on linux. Thus should generally improve performance.(gh-27808)
Changes
-
numpy.fix
now won't perform casting to a floating
data-type for integer and boolean data-type input arrays.(gh-26766)
-
The type annotations of
numpy.float64
andnumpy.complex128
now
reflect that they are also subtypes of the built-infloat
and
complex
types, respectively. This update prevents static
type-checkers from reporting errors in cases such as:x: float = numpy.float64(6.28) # valid z: complex = numpy.complex128(-1j) # valid
(gh-27334)
-
The
repr
of arrays large enough to be summarized (i.e., where
elements are replaced with...
) now includes theshape
of the
array, similar to what already was the case for arrays with zero
size and non-obvious shape. With this change, the shape is always
given when it cannot be inferred from the values. Note that while
written asshape=...
, this argument cannot actually be passed in
to thenp.array
constructor. If you encounter problems, e.g., due
to failing doctests, you can use the print optionlegacy=2.1
to
get the old behaviour.(gh-27482)
-
Calling
__array_wrap__
directly on NumPy arrays or scalars now
does the right thing whenreturn_scalar
is passed (Added in NumPy
2). It is further safe now to call the scalar__array_wrap__
on a
non-scalar result.(gh-27807)
-
Bump the musllinux CI image and wheels to 1_2 from 1_1. This is because
1_1 is end of life.(gh-27088)
-
The NEP 50 promotion state settings are now removed. They were always
meant as temporary means for testing. A warning will be given if the
environment variable is set to anything butNPY_PROMOTION_STATE=weak
while_set_promotion_state
and_get_promotion_state
are removed. In
case code used_no_nep50_warning
, acontextlib.nullcontext
could be
used to replace it when not available.(gh-27156)
Checksums
MD5
1b58b9e275e80364cd02dafb3f8daf35 numpy-2.2.0-cp310-cp310-macosx_10_9_x86_64.whl
7d3773d9b665b2d7cfec0cc0b760e69e numpy-2.2.0-cp310-cp310-macosx_11_0_arm64.whl
8ef666a462d3765ccfd5288f2fdf8e08 numpy-2.2.0-cp310-cp310-macosx_14_0_arm64.whl
e4f9e3117075ffe53d7993253c774158 numpy-2.2.0-cp310-cp310-macosx_14_0_x86_64.whl
fd60e410e5db402a2d0c0cb4dd23281d numpy-2.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
64c083cdbd91eb8670cd72b619f3a039 numpy-2.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
c3c75c2299f5163770e2e42f0dee5276 numpy-2.2.0-cp310-cp310-musllinux_1_2_aarch64.whl
f6ab05f787221bbaf8fb4a9778af5467 numpy-2.2.0-cp310-cp310-musllinux_1_2_x86_64.whl
9b04caec124cadf90005ccdb662aad9f numpy-2.2.0-cp310-cp310-win32.whl
58934f23b6bc71fb1f984b688c1c6136 numpy-2.2.0-cp310-cp310-win_amd64.whl
769e53438154e53ba490fb4f816c083e numpy-2.2.0-cp311-cp311-macosx_10_9_x86_64.whl
aa8060c013c04133b63780025eef4451 numpy-2.2.0-cp311-cp311-macosx_11_0_arm64.whl
72c10ef28a0ddffe6bf2495954ab82e0 numpy-2.2.0-cp311-cp311-macosx_14_0_arm64.whl
946b2510c86eb48e374e6987582c9b46 numpy-2.2.0-cp311-cp311-macosx_14_0_x86_64.whl
3f5203ae901ddd78cb298582eda07627 numpy-2.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
fd14624d40100a5eb0181bf393394448 numpy-2.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
7c86d51d89dbc5a6860d65641ea131ef numpy-2.2.0-cp311-cp311-musllinux_1_2_aarch64.whl
895c6588c74019b94fb3c740b9e9a0f5 numpy-2.2.0-cp311-cp311-musllinux_1_2_x86_64.whl
1468ae1cb59a43991b199cfa6f1e5679 numpy-2.2.0-cp311-cp311-win32.whl
48a3792698a81917320b91a30c0bacf4 numpy-2.2.0-cp311-cp311-win_amd64.whl
db4377351f167d82adc66b16965d11bd numpy-2.2.0-cp312-cp312-macosx_10_13_x86_64.whl
3f3978b5e480ed18d55b1799d9a534ff numpy-2.2.0-cp312-cp312-macosx_11_0_arm64.whl
584b4063eb66688b607f7e7bdca58011 numpy-2.2.0-cp312-cp312-macosx_14_0_arm64.whl
dfacf4ee4842d845f5e12f912ebc2055 numpy-2.2.0-cp312-cp312-macosx_14_0_x86_64.whl
2f10d9bc44635078a6222ed50c9fd0f2 numpy-2.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
bb69665b4b68b7af82939132972e8261 numpy-2.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
92e9b03039ab737e6799dbd9d057fce2 numpy-2.2.0-cp312-cp312-musllinux_1_2_aarch64.whl
a4198f53e3906394012ab88dffff4077 numpy-2.2.0-cp312-cp312-musllinux_1_2_x86_64.whl
f9cb2f38ae8272ab5eb4b209c59be45f numpy-2.2.0-cp312-cp312-win32.whl
6ffe9e1abf69bb8c4ee2e913b1badfde numpy-2.2.0-cp312-cp312-win_amd64.whl
330838b6e06481341b35f8d4b6b50bbb numpy-2.2.0-cp313-cp313-macosx_10_13_x86_64.whl
4fb63be6d2b92acfba0c2eaedce82e06 numpy-2.2.0-cp313-cp313-macosx_11_0_arm64.whl
e4086f43f9ce29b5adf939e1b5150f03 numpy-2.2.0-cp313-cp313-macosx_14_0_arm64.whl
ba74e1f7142954127fb2aef544a6b05e numpy-2.2.0-cp313-cp313-macosx_14_0_x86_64.whl
83f51806139d5adc70a2e309d0300ad1 numpy-2.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
bf9af9abb1e30521b3491f0748ba6199 numpy-2.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
4d30c57bd7103b36a4bf7a4a9e25e10d numpy-2.2.0-cp313-cp313-musllinux_1_2_aarch64.whl
5b12557dde538f99fd87d1682638a212 numpy-2.2.0-cp313-cp313-musllinux_1_2_x86_64.whl
ee7689d2ecbcbd7c883f69099bd41892 numpy-2.2.0-cp313-cp313-win32.whl
370a2b14681c6dc4af8596f62d96bb20 numpy-2.2.0-cp313-cp313-win_amd64.whl
e6fd32fb42fd89c7659e799d65c19557 numpy-2.2.0-cp313-cp313t-macosx_10_13_x86_64.whl
8e9b0579f2e22f38f57399ab18d6e651 numpy-2.2.0-cp313-cp313t-macosx_11_0_arm64.whl
71a7ee75208a633a8c36d4ed5b551c33 numpy-2.2.0-cp313-cp313t-macosx_14_0_arm64.whl
3d76dfe8c2e26dc42b97fdf086ce1fa5 numpy-2.2.0-cp313-cp313t-macosx_14_0_x86_64.whl
b70ea00b40fb7d1b5d84868d8a073afb numpy-2.2.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
a6bc7090a4e2b1e9deabd0671c691129 numpy-2.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
9789193a075e8d494851fe7955a23af7 numpy-2.2.0-cp313-cp313t-musllinux_1_2_aarch64.whl
8c199d25bd806f737950428232b0dfa5 numpy-2.2.0-cp313-cp313t-musllinux_1_2_x86_64.whl
1f566cfe4880ca30a591a828634da429 numpy-2.2.0-cp313-cp313t-win32.whl
eb9ea9f8fba78e7ae5b1415de1ee5c2c numpy-2.2.0-cp313-cp313t-win_amd64.whl
9fbe2640c73e4f391019db5af6e854f5 numpy-2.2.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl
fc89986fda7ba19c7c50712f1fc1e342 numpy-2.2.0-pp310-pypy310_pp73-macosx_14_0_x86_64.whl
d76c5769a3fdfb9e25b3c1a951bd021f numpy-2.2.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
c138d726fee19ec6ba85eaa2ba9a3390 numpy-2.2.0-pp310-pypy310_pp73-win_amd64.whl
81a58d5fd26fe983162dc3cea2989b7a numpy-2.2.0.tar.gz
SHA256
1e25507d85da11ff5066269d0bd25d06e0a0f2e908415534f3e603d2a78e4ffa numpy-2.2.0-cp310-cp310-macosx_10_9_x86_64.whl
a62eb442011776e4036af5c8b1a00b706c5bc02dc15eb5344b0c750428c94219 numpy-2.2.0-cp310-cp310-macosx_11_0_arm64.whl
b606b1aaf802e6468c2608c65ff7ece53eae1a6874b3765f69b8ceb20c5fa78e numpy-2.2.0-cp310-cp310-macosx_14_0_arm64.whl
36b2b43146f646642b425dd2027730f99bac962618ec2052932157e213a040e9 numpy-2.2.0-cp310-cp310-macosx_14_0_x86_64.whl
7fe8f3583e0607ad4e43a954e35c1748b553bfe9fdac8635c02058023277d1b3 numpy-2.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
122fd2fcfafdefc889c64ad99c228d5a1f9692c3a83f56c292618a59aa60ae83 numpy-2.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
3f2f5cddeaa4424a0a118924b988746db6ffa8565e5829b1841a8a3bd73eb59a numpy-2.2.0-cp310-cp310-musllinux_1_2_aarch64.whl
7fe4bb0695fe986a9e4deec3b6857003b4cfe5c5e4aac0b95f6a658c14635e31 numpy-2.2.0-cp310-cp310-musllinux_1_2_x86_64.whl
b30042fe92dbd79f1ba7f6898fada10bdaad1847c44f2dff9a16147e00a93661 numpy-2.2.0-cp310-cp310-win32.whl
54dc1d6d66f8d37843ed281773c7174f03bf7ad826523f73435deb88ba60d2d4 numpy-2.2.0-cp310-cp310-win_amd64.whl
9874bc2ff574c40ab7a5cbb7464bf9b045d617e36754a7bc93f933d52bd9ffc6 numpy-2.2.0-cp311-cp311-macosx_10_9_x86_64.whl
0da8495970f6b101ddd0c38ace92edea30e7e12b9a926b57f5fabb1ecc25bb90 numpy-2.2.0-cp311-cp311-macosx_11_0_arm64.whl
0557eebc699c1c34cccdd8c3778c9294e8196df27d713706895edc6f57d29608 numpy-2.2.0-cp311-cp311-macosx_14_0_arm64.whl
3579eaeb5e07f3ded59298ce22b65f877a86ba8e9fe701f5576c99bb17c283da numpy-2.2.0-cp311-cp311-macosx_14_0_x86_64.whl
40deb10198bbaa531509aad0cd2f9fadb26c8b94070831e2208e7df543562b74 numpy-2.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
c2aed8fcf8abc3020d6a9ccb31dbc9e7d7819c56a348cc88fd44be269b37427e numpy-2.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
a222d764352c773aa5ebde02dd84dba3279c81c6db2e482d62a3fa54e5ece69b numpy-2.2.0-cp311-cp311-musllinux_1_2_aarch64.whl
4e58666988605e251d42c2818c7d3d8991555381be26399303053b58a5bbf30d numpy-2.2.0-cp311-cp311-musllinux_1_2_x86_64.whl
4723a50e1523e1de4fccd1b9a6dcea750c2102461e9a02b2ac55ffeae09a4410 numpy-2.2.0-cp311-cp311-win32.whl
16757cf28621e43e252c560d25b15f18a2f11da94fea344bf26c599b9cf54b73 numpy-2.2.0-cp311-cp311-win_amd64.whl
cff210198bb4cae3f3c100444c5eaa573a823f05c253e7188e1362a5555235b3 numpy-2.2.0-cp312-cp312-macosx_10_13_x86_64.whl
58b92a5828bd4d9aa0952492b7de803135038de47343b2aa3cc23f3b71a3dc4e numpy-2.2.0-cp312-cp312-macosx_11_0_arm64.whl
ebe5e59545401fbb1b24da76f006ab19734ae71e703cdb4a8b347e84a0cece67 numpy-2.2.0-cp312-cp312-macosx_14_0_arm64.whl
e2b8cd48a9942ed3f85b95ca4105c45758438c7ed28fff1e4ce3e57c3b589d8e numpy-2.2.0-cp312-cp312-macosx_14_0_x86_64.whl
57fcc997ffc0bef234b8875a54d4058afa92b0b0c4223fc1f62f24b3b5e86038 numpy-2.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
85ad7d11b309bd132d74397fcf2920933c9d1dc865487128f5c03d580f2c3d03 numpy-2.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
cb24cca1968b21355cc6f3da1a20cd1cebd8a023e3c5b09b432444617949085a numpy-2.2.0-cp312-cp312-musllinux_1_2_aarch64.whl
0798b138c291d792f8ea40fe3768610f3c7dd2574389e37c3f26573757c8f7ef numpy-2.2.0-cp312-cp312-musllinux_1_2_x86_64.whl
afe8fb968743d40435c3827632fd36c5fbde633b0423da7692e426529b1759b1 numpy-2.2.0-cp312-cp312-win32.whl
3a4199f519e57d517ebd48cb76b36c82da0360781c6a0353e64c0cac30ecaad3 numpy-2.2.0-cp312-cp312-win_amd64.whl
f8c8b141ef9699ae777c6278b52c706b653bf15d135d302754f6b2e90eb30367 numpy-2.2.0-cp313-cp313-macosx_10_13_x86_64.whl
0f0986e917aca18f7a567b812ef7ca9391288e2acb7a4308aa9d265bd724bdae numpy-2.2.0-cp313-cp313-macosx_11_0_arm64.whl
1c92113619f7b272838b8d6702a7f8ebe5edea0df48166c47929611d0b4dea69 numpy-2.2.0-cp313-cp313-macosx_14_0_arm64.whl
5a145e956b374e72ad1dff82779177d4a3c62bc8248f41b80cb5122e68f22d13 numpy-2.2.0-cp313-cp313-macosx_14_0_x86_64.whl
18142b497d70a34b01642b9feabb70156311b326fdddd875a9981f34a369b671 numpy-2.2.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
a7d41d1612c1a82b64697e894b75db6758d4f21c3ec069d841e60ebe54b5b571 numpy-2.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
a98f6f20465e7618c83252c02041517bd2f7ea29be5378f09667a8f654a5918d numpy-2.2.0-cp313-cp313-musllinux_1_2_aarch64.whl
e09d40edfdb4e260cb1567d8ae770ccf3b8b7e9f0d9b5c2a9992696b30ce2742 numpy-2.2.0-cp313-cp313-musllinux_1_2_x86_64.whl
3905a5fffcc23e597ee4d9fb3fcd209bd658c352657548db7316e810ca80458e numpy-2.2.0-cp313-cp313-win32.whl
a184288538e6ad699cbe6b24859206e38ce5fba28f3bcfa51c90d0502c1582b2 numpy-2.2.0-cp313-cp313-win_amd64.whl
7832f9e8eb00be32f15fdfb9a981d6955ea9adc8574c521d48710171b6c55e95 numpy-2.2.0-cp313-cp313t-macosx_10_13_x86_64.whl
f0dd071b95bbca244f4cb7f70b77d2ff3aaaba7fa16dc41f58d14854a6204e6c numpy-2.2.0-cp313-cp313t-macosx_11_0_arm64.whl
b0b227dcff8cdc3efbce66d4e50891f04d0a387cce282fe1e66199146a6a8fca numpy-2.2.0-cp313-cp313t-macosx_14_0_arm64.whl
6ab153263a7c5ccaf6dfe7e53447b74f77789f28ecb278c3b5d49db7ece10d6d numpy-2.2.0-cp313-cp313t-macosx_14_0_x86_64.whl
e500aba968a48e9019e42c0c199b7ec0696a97fa69037bea163b55398e390529 numpy-2.2.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
440cfb3db4c5029775803794f8638fbdbf71ec702caf32735f53b008e1eaece3 numpy-2.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
a55dc7a7f0b6198b07ec0cd445fbb98b05234e8b00c5ac4874a63372ba98d4ab numpy-2.2.0-cp313-cp313t-musllinux_1_2_aarch64.whl
4bddbaa30d78c86329b26bd6aaaea06b1e47444da99eddac7bf1e2fab717bd72 numpy-2.2.0-cp313-cp313t-musllinux_1_2_x86_64.whl
30bf971c12e4365153afb31fc73f441d4da157153f3400b82db32d04de1e4066 numpy-2.2.0-cp313-cp313t-win32.whl
d35717333b39d1b6bb8433fa758a55f1081543de527171543a2b710551d40881 numpy-2.2.0-cp313-cp313t-win_amd64.whl
e12c6c1ce84628c52d6367863773f7c8c8241be554e8b79686e91a43f1733773 numpy-2.2.0-pp310-pypy310_pp73-macosx_10_15_x86_64.whl
b6207dc8fb3c8cb5668e885cef9ec7f70189bec4e276f0ff70d5aa078d32c88e numpy-2.2.0-pp310-pypy310_pp73-macosx_14_0_x86_64.whl
a50aeff71d0f97b6450d33940c7181b08be1441c6c193e678211bff11aa725e7 numpy-2.2.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
df12a1f99b99f569a7c2ae59aa2d31724e8d835fc7f33e14f4792e3071d11221 numpy-2.2.0-pp310-pypy310_pp73-win_amd64.whl
140dd80ff8981a583a60980be1a655068f8adebf7a45a06a6858c873fcdcd4a0 numpy-2.2.0.tar.gz