NumPy 2.2.0 Release Notes#

Highlights#

We’ll choose highlights for this release near the end of the release cycle.

Expired deprecations#

  • bool(np.array([])) and other empty arrays will now raise an error. Use arr.size > 0 instead to check whether an array has no elements.

    (gh-27160)

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)

Changes#

  • numpy.fix now won’t perform casting to a floating data-type for integer and boolean data-type input arrays.

    (gh-26766)

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 but NPY_PROMOTION_STATE=weak while _set_promotion_state and _get_promotion_state are removed. In case code used _no_nep50_warning, a contextlib.nullcontext could be used to replace it when not available.

(gh-27156)