NumPy 2.2.0 Release Notes
The NumPy 2.2.0 release is a 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 bothnumpy.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 emptymemmap
would
fail unless a non-zerooffset
was set. Now a zero-sizememmap
is
supported even ifoffset=0
. To achieve this, if amemmap
is mapped to
an empty file that file is padded with a single byte.(gh-27723)
-
f2py
handles multiple modules and exposes variables again. 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
-
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
andcomplex
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)
-
NEP 50 promotion state option removed
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
83746dfc1b7774a6677a69c705b83afe numpy-2.2.0rc1-cp310-cp310-macosx_10_9_x86_64.whl
e69c45cf5ea08fdf2a5527190a7d6549 numpy-2.2.0rc1-cp310-cp310-macosx_11_0_arm64.whl
d4f8048977139cb229875c201f605369 numpy-2.2.0rc1-cp310-cp310-macosx_14_0_arm64.whl
8710578b7f4ceef7f73b6d234ad3a82a numpy-2.2.0rc1-cp310-cp310-macosx_14_0_x86_64.whl
899d1f24d8e5570695a024908d100174 numpy-2.2.0rc1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
cb768ee568bed2e4f55d47f43c655bc2 numpy-2.2.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
5a40726db153ca1984598323cc59eb9b numpy-2.2.0rc1-cp310-cp310-musllinux_1_2_aarch64.whl
450e5e05bdc5551c0a4df2a8d7f09925 numpy-2.2.0rc1-cp310-cp310-musllinux_1_2_x86_64.whl
1c34c86b0abaa5d2a75677044a7fca07 numpy-2.2.0rc1-cp310-cp310-win32.whl
d679ad13f3892325fd4542931ee74852 numpy-2.2.0rc1-cp310-cp310-win_amd64.whl
a7a8cf5fa2e3d4bd0131ad48c0215f50 numpy-2.2.0rc1-cp311-cp311-macosx_10_9_x86_64.whl
aa6c629290d8b05b44fbbf805fb39dbe numpy-2.2.0rc1-cp311-cp311-macosx_11_0_arm64.whl
a04fe8ac96a5226686ec4190db8511d6 numpy-2.2.0rc1-cp311-cp311-macosx_14_0_arm64.whl
50aedb2a570a7867e860d98eb816bec4 numpy-2.2.0rc1-cp311-cp311-macosx_14_0_x86_64.whl
cd034c5179ee4cc5669ae36be0deb6ab numpy-2.2.0rc1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
67e3336cdcdcf72cd07978a465e61ebd numpy-2.2.0rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
45456522fc3996937f1b1ad8bd7f85b2 numpy-2.2.0rc1-cp311-cp311-musllinux_1_2_aarch64.whl
244dcedc05e96c843853738bc2d37bdb numpy-2.2.0rc1-cp311-cp311-musllinux_1_2_x86_64.whl
da24dd620b6509740a1d8aebe4d1306c numpy-2.2.0rc1-cp311-cp311-win32.whl
472e5f997dc437b8115ba4ef70a6a266 numpy-2.2.0rc1-cp311-cp311-win_amd64.whl
6e4ec4f92f8b0768d679419360098a89 numpy-2.2.0rc1-cp312-cp312-macosx_10_13_x86_64.whl
e15a1756fbe98aa61cb8d98de1d516fc numpy-2.2.0rc1-cp312-cp312-macosx_11_0_arm64.whl
6c58bba6f453ad22a651f6f0f6416899 numpy-2.2.0rc1-cp312-cp312-macosx_14_0_arm64.whl
1a00dd2343f8ec48350b39f72e2c4fa1 numpy-2.2.0rc1-cp312-cp312-macosx_14_0_x86_64.whl
cbe9b6d14530bdfb75ef61f4328f6b9e numpy-2.2.0rc1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
a4f14055b4cfafab7035f35e61c6cebb numpy-2.2.0rc1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
8c3c80295b92ae839fcb1fc2ab2edf0e numpy-2.2.0rc1-cp312-cp312-musllinux_1_2_aarch64.whl
1a5aac9894d1959e1cbbcf58e3aa98d1 numpy-2.2.0rc1-cp312-cp312-musllinux_1_2_x86_64.whl
03577c58315ae4b28c3111be0af0c18a numpy-2.2.0rc1-cp312-cp312-win32.whl
c8ed06acb7e1b885081e682a391524d8 numpy-2.2.0rc1-cp312-cp312-win_amd64.whl
53955ed28cb43f004ccd9f2f1e07b0d4 numpy-2.2.0rc1-cp313-cp313-macosx_10_13_x86_64.whl
dffe0e20843d5e331358206b535c47f7 numpy-2.2.0rc1-cp313-cp313-macosx_11_0_arm64.whl
1f22dc1bc3dd3bf645a35a8c58e07ac3 numpy-2.2.0rc1-cp313-cp313-macosx_14_0_arm64.whl
57bb0a9d61444162269751eb861bef75 numpy-2.2.0rc1-cp313-cp313-macosx_14_0_x86_64.whl
b38fd53f8f162a833b89e32b52d6f0b5 numpy-2.2.0rc1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
f8975385402dfa988efe0121adcb3b83 numpy-2.2.0rc1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
8b739c89e3c67210467ac0855623da47 numpy-2.2.0rc1-cp313-cp313-musllinux_1_2_aarch64.whl
902e1f704a187a85f02f71877ed69baf numpy-2.2.0rc1-cp313-cp313-musllinux_1_2_x86_64.whl
fc33a9a4c895b2463672d01e75431a8f numpy-2.2.0rc1-cp313-cp313-win32.whl
f57eb3377cf0acf5ce165034e5d3d061 numpy-2.2.0rc1-cp313-cp313-win_amd64.whl
4dff6567391c376daf27f2a144a4142d numpy-2.2.0rc1-cp313-cp313t-macosx_10_13_x86_64.whl
5195eeac3d355592ec97db04cea7fb43 numpy-2.2.0rc1-cp313-cp313t-macosx_11_0_arm64.whl
9a5e6fb707b1bc448d6f5eb226757581 numpy-2.2.0rc1-cp313-cp313t-macosx_14_0_arm64.whl
455ef245987926bb966565de0f68d00f numpy-2.2.0rc1-cp313-cp313t-macosx_14_0_x86_64.whl
f10882cf7238a03896903b337bce2b05 numpy-2.2.0rc1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
8889da4b211ca3edba34518306115a81 numpy-2.2.0rc1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
1d29f0a150c39b500b4f0b1e4c625e9b numpy-2.2.0rc1-cp313-cp313t-musllinux_1_2_aarch64.whl
dcf499ab9d350e3414368a106c714256 numpy-2.2.0rc1-cp313-cp313t-musllinux_1_2_x86_64.whl
af48c02a9130ad93e93a55ebf87b5c78 numpy-2.2.0rc1-cp313-cp313t-win32.whl
290c12deaff6df2e54569563a8f1316a numpy-2.2.0rc1-cp313-cp313t-win_amd64.whl
fce62da0e31ae09237cf241c77e54498 numpy-2.2.0rc1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl
85acaaaa495d92bc52631a6a0654fd8e numpy-2.2.0rc1-pp310-pypy310_pp73-macosx_14_0_x86_64.whl
cb0482e5c60d706b9b0e9ce8dac9d8a6 numpy-2.2.0rc1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
67390891e461b1983aadab51bc96a78b numpy-2.2.0rc1-pp310-pypy310_pp73-win_amd64.whl
4836fdb3009f043287f011b5f6d18208 numpy-2.2.0rc1.tar.gz
SHA256
acd4f4e9f8c3c04c9a695333d4f475ec2f7a577342b469b411f7ffb2a2888fdc numpy-2.2.0rc1-cp310-cp310-macosx_10_9_x86_64.whl
8c3cd769a38a363fe21077ad137ee43be639464e5f257821a4cc4d4e2016deea numpy-2.2.0rc1-cp310-cp310-macosx_11_0_arm64.whl
72fa15a5f801faf598e6633a6efcb5661085f509f8f6631a0c2c86be06631b78 numpy-2.2.0rc1-cp310-cp310-macosx_14_0_arm64.whl
44d55304a7397d6e89707af99ea8e980a101a7ff01dd768aaaca16b2312c799b numpy-2.2.0rc1-cp310-cp310-macosx_14_0_x86_64.whl
8a25595d5951ad46bec827dfee09328b8da041fc3f7f13f63880274ed4ec215e numpy-2.2.0rc1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
c335bd4e3395b8209a011b97e5f9876092fb2dc283933d39620a30c1fa82dfab numpy-2.2.0rc1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
5ac124ab756ad56a14cdfcdc69cc220befbfb1162fdf3ca4f6eb1a0ace634c56 numpy-2.2.0rc1-cp310-cp310-musllinux_1_2_aarch64.whl
2f7861ff2b862e2536f2256acf5dcf1909e927a5f5e940dfd488eecd178a96b6 numpy-2.2.0rc1-cp310-cp310-musllinux_1_2_x86_64.whl
e2d4b5a37cf5df43ffdabe0ebea150d5ec0a1796ad7122b3a780f1ab646708c8 numpy-2.2.0rc1-cp310-cp310-win32.whl
7a3261b3b7d1403a65112dbad568eee7de596cebd0267e27e7daaa9e08dd396a numpy-2.2.0rc1-cp310-cp310-win_amd64.whl
61915861927b8e20223b7ccbe40ebf3f52220c0fca43be8423087348c7c00418 numpy-2.2.0rc1-cp311-cp311-macosx_10_9_x86_64.whl
8815f7e6d48dbcf4f14704d79b90c8fee1a68a42886d42e9c8209092e684bd99 numpy-2.2.0rc1-cp311-cp311-macosx_11_0_arm64.whl
3e80348e6d187573dc2bb6b1d862fc32353db371ae063d25b2199f65adc96ff1 numpy-2.2.0rc1-cp311-cp311-macosx_14_0_arm64.whl
8fb79fe9bfefb2b43f701090f70413fb535f10bfdfab1981b7c02bd406cc39dd numpy-2.2.0rc1-cp311-cp311-macosx_14_0_x86_64.whl
042b6a87c48307955049b338981ff9278fa5e7ff3166bbd0d3294f40726d22d5 numpy-2.2.0rc1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
94251286fd3cec5552f217030af4cae68f7a1db4f1791765e597b6d9c0a7647a numpy-2.2.0rc1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
ffaa01305af250d733d9940c694d206a0c7d1ea2bd5a01bcb5ff7e48c3e6adac numpy-2.2.0rc1-cp311-cp311-musllinux_1_2_aarch64.whl
37e6413ed8f66df534631058771ca362939e243da725b5e8537d8c64b664e9b2 numpy-2.2.0rc1-cp311-cp311-musllinux_1_2_x86_64.whl
7bd86cdae85da5fa8763fbe9acfdb4748e1f10bef5e6524bffdfdd2b21bfd56f numpy-2.2.0rc1-cp311-cp311-win32.whl
27f2593fe479dff6f4398563ca2fbf7a416fd8d3a8ad7a35fecbc8ba959000ab numpy-2.2.0rc1-cp311-cp311-win_amd64.whl
f721298f4c39b4619b16ba0d341ff5e043d4123dfb796bd84835538bf8abad2b numpy-2.2.0rc1-cp312-cp312-macosx_10_13_x86_64.whl
aed72fe759ada921342b4a8ae0893cc7778b07d2f36a78445c70d5ea633c3b25 numpy-2.2.0rc1-cp312-cp312-macosx_11_0_arm64.whl
c940b9623e29db06b7d0d3c93c560d42bbd73a76f6d27c41d3fd09c0a15f7773 numpy-2.2.0rc1-cp312-cp312-macosx_14_0_arm64.whl
a783f561c34be98eb25f8cce029b63434d2dfe79702a1d53e9a0fd63c0391dc8 numpy-2.2.0rc1-cp312-cp312-macosx_14_0_x86_64.whl
d0db426baa0d9547d9ac3ea08110e9bba400fab7a036235d9baddf61fd931af8 numpy-2.2.0rc1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
7925618745531971be54a87e0b85dfe83c69dac9dfd8e46c8aaae520af05792b numpy-2.2.0rc1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
5d7a819d4d31bf9998c907105d97a082919b659ff8d44cef2c4f78d0ac16af47 numpy-2.2.0rc1-cp312-cp312-musllinux_1_2_aarch64.whl
0b6cb83ab76b101b87211ab6227e010789adf4a98ee4af07a2480d1d2f61d195 numpy-2.2.0rc1-cp312-cp312-musllinux_1_2_x86_64.whl
dc86f8502db8dfbe3474a34395e453849d03f0717227f7bda57a235cbbee3575 numpy-2.2.0rc1-cp312-cp312-win32.whl
a87c1a4d808de26157440153bb9c51d7dc4778c6cd730026406298b75fa5c2df numpy-2.2.0rc1-cp312-cp312-win_amd64.whl
c2ef440fc343cc11e8e1591bf77b0f4f21b0684feabdf7b3ec3d768b8cce7a05 numpy-2.2.0rc1-cp313-cp313-macosx_10_13_x86_64.whl
4332ddb4f40e85f6cdf1594279b35e847a20054c3269f7f2e848b6075cb8f4b3 numpy-2.2.0rc1-cp313-cp313-macosx_11_0_arm64.whl
dc532dd1c767864614f383cad63edf864f78df3533b6444d94af099583c8fb39 numpy-2.2.0rc1-cp313-cp313-macosx_14_0_arm64.whl
ecc601c633667ea5eed0c16f987e4c715ee951d0bfa3658f76b690e8dceaddfd numpy-2.2.0rc1-cp313-cp313-macosx_14_0_x86_64.whl
38405f26748e7ed4c7b31e5f8c24f385e1daf4954628f6143f5a09047e220ca9 numpy-2.2.0rc1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
e515a7d5f5e1b32eb9e761de4f0327aceee27ec07cc655d26424a5e86d3c8d0d numpy-2.2.0rc1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
fd3981aa01428eef69fe5ff2e97e3ca8e65e677ffacc7c447e164ae2aaf521fb numpy-2.2.0rc1-cp313-cp313-musllinux_1_2_aarch64.whl
61a04f035bd4f87d6c0592eaa06061f9f16bf0e11d546e3b9252ccf83f0917a6 numpy-2.2.0rc1-cp313-cp313-musllinux_1_2_x86_64.whl
1b18bf71975be1728042ba232d7406ae2f6fed8431684851fda4b909ab6e20ce numpy-2.2.0rc1-cp313-cp313-win32.whl
5776d7b395dcf180bc807a9374aca05b6569e5e5e4bdcbf112aa452a471405e0 numpy-2.2.0rc1-cp313-cp313-win_amd64.whl
3f0d900e60e783fa9965729fa2a17021add82d769bf298cdb407abcbbf316e28 numpy-2.2.0rc1-cp313-cp313t-macosx_10_13_x86_64.whl
def9537da892cd995f81646df94021fbf0dce690d518daaabc0902bc8ce42cd9 numpy-2.2.0rc1-cp313-cp313t-macosx_11_0_arm64.whl
f2b59a4e85367107dced5b3c7374a5e828ddb7c5c4e1d98176d09b177e23edd0 numpy-2.2.0rc1-cp313-cp313t-macosx_14_0_arm64.whl
9c3bdfe13209bf4f81aea5f8dd2843ab17c9a9273133d491c220636bfd51432d numpy-2.2.0rc1-cp313-cp313t-macosx_14_0_x86_64.whl
b0b742731c2721445a03e469f286c9ddf15dd80e52622ea4487ddc10a7869fe9 numpy-2.2.0rc1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
8c43d7beaab6509f1467175cc7cfdcc048581b91ba55e149cc39af758209b166 numpy-2.2.0rc1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
598b88170e0f361d2f6d8cc9ec18d798af07a2e9b30b95ba2d76415b7c3cc433 numpy-2.2.0rc1-cp313-cp313t-musllinux_1_2_aarch64.whl
ddb4720b057048d7ac3ce973256e89e1e7481f71b5a214a0a3be936aeda014e7 numpy-2.2.0rc1-cp313-cp313t-musllinux_1_2_x86_64.whl
64b994b9054ab051d137fff61bb6244aa1e7a80defa42c507355b562cc44a561 numpy-2.2.0rc1-cp313-cp313t-win32.whl
67d2f5c34f231e7ed59189c20f8b7472b77cff85277bcd80537417eee61977db numpy-2.2.0rc1-cp313-cp313t-win_amd64.whl
d4bbc95647ce01252827d4c6ea5de42460ea66d75831333f2b92f088b60e1b43 numpy-2.2.0rc1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl
d8d13dd7b6f1f14c43ff68e81c8edcb035f572d87507b5f629e78a7d8c61e9f4 numpy-2.2.0rc1-pp310-pypy310_pp73-macosx_14_0_x86_64.whl
d12bf735dc4e7dfa8c66b2fd47547bcf91c9996585324959e2c5a2f5360e1c8f numpy-2.2.0rc1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
8d7de626a5e554b074890258e63d0b06eff2af48da034fe5ffef8743578b1e0b numpy-2.2.0rc1-pp310-pypy310_pp73-win_amd64.whl
d3c343e027351fbb3f7ddb0024857cd10837d6a77b40b33e39ff6706ed7ceec1 numpy-2.2.0rc1.tar.gz