github numpy/numpy v1.19.0rc2

latest releases: v1.21.6, v1.22.3, v1.22.2...
pre-release23 months ago

NumPy 1.19.0 Release Notes

This NumPy release is marked by the removal of much technical debt:
support for Python 2 has been removed, many deprecations have been
expired, and documentation has been improved. The polishing of the
random module continues apace with bug fixes and better usability from

The Python versions supported for this release are 3.6-3.8. Downstream
developers should use Cython >= 0.29.16 for Python 3.8 support and
OpenBLAS >= 3.7 to avoid problems on the Skylake architecture.


  • Code compatibility with Python versions < 3.6 (including Python 2)
    was dropped from both the python and C code. The shims in
    numpy.compat will remain to support third-party packages, but they
    may be deprecated in a future release. Note that 1.19.x will not
    compile with earlier versions of Python due to the use of f-strings.


Expired deprecations

numpy.insert and numpy.delete can no longer be passed an axis on 0d arrays

This concludes a deprecation from 1.9, where when an axis argument was
passed to a call to ~numpy.insert and ~numpy.delete on a 0d array,
the axis and obj argument and indices would be completely ignored.
In these cases, insert(arr, "nonsense", 42, axis=0) would actually
overwrite the entire array, while delete(arr, "nonsense", axis=0)
would be arr.copy()

Now passing axis on a 0d array raises ~numpy.AxisError.


numpy.delete no longer ignores out-of-bounds indices

This concludes deprecations from 1.8 and 1.9, where np.delete would
ignore both negative and out-of-bounds items in a sequence of indices.
This was at odds with its behavior when passed a single index.

Now out-of-bounds items throw IndexError, and negative items index
from the end.


numpy.insert and numpy.delete no longer accept non-integral indices

This concludes a deprecation from 1.9, where sequences of non-integers
indices were allowed and cast to integers. Now passing sequences of
non-integral indices raises IndexError, just like it does when passing
a single non-integral scalar.


numpy.delete no longer casts boolean indices to integers

This concludes a deprecation from 1.8, where np.delete would cast
boolean arrays and scalars passed as an index argument into integer
indices. The behavior now is to treat boolean arrays as a mask, and to
raise an error on boolean scalars.


Compatibility notes

Changed random variate stream from numpy.random.Generator.dirichlet

A bug in the generation of random variates for the Dirichlet
distribution with small 'alpha' values was fixed by using a different
algorithm when max(alpha) < 0.1. Because of the change, the stream of
variates generated by dirichlet in this case will be different from
previous releases.


Scalar promotion in PyArray_ConvertToCommonType

The promotion of mixed scalars and arrays in
PyArray_ConvertToCommonType has been changed to adhere to those used
by np.result_type. This means that input such as
(1000, np.array([1], dtype=np.uint8))) will now return uint16
dtypes. In most cases the behaviour is unchanged. Note that the use of
this C-API function is generally discouraged. This also fixes
np.choose to behave the same way as the rest of NumPy in this respect.


Fasttake and fastputmask slots are deprecated and NULL'ed

The fasttake and fastputmask slots are now never used and must always be
set to NULL. This will result in no change in behaviour. However, if a
user dtype should set one of these a DeprecationWarning will be given.


np.ediff1d casting behaviour with to_end and to_begin

np.ediff1d now uses the "same_kind" casting rule for its additional
to_end and to_begin arguments. This ensures type safety except when
the input array has a smaller integer type than to_begin or to_end.
In rare cases, the behaviour will be more strict than it was previously
in 1.16 and 1.17. This is necessary to solve issues with floating point


Converting of empty array-like objects to NumPy arrays

Objects with len(obj) == 0 which implement an "array-like"
interface, meaning an object implementing obj.__array__(),
obj.__array_interface__, obj.__array_struct__, or the python buffer
interface and which are also sequences (i.e. Pandas objects) will now
always retain there shape correctly when converted to an array. If such
an object has a shape of (0, 1) previously, it could be converted into
an array of shape (0,) (losing all dimensions after the first 0).


Removed multiarray.int_asbuffer

As part of the continued removal of Python 2 compatibility,
multiarray.int_asbuffer was removed. On Python 3, it threw a
NotImplementedError and was unused internally. It is expected that
there are no downstream use cases for this method with Python 3.


numpy.distutils.compat has been removed

This module contained only the function get_exception(), which was
used as:

except Exception:
    e = get_exception()

Its purpose was to handle the change in syntax introduced in Python 2.6,
from except Exception, e: to except Exception as e:, meaning it was
only necessary for codebases supporting Python 2.5 and older.


issubdtype no longer interprets float as np.floating

numpy.issubdtype had a FutureWarning since NumPy 1.14 which has
expired now. This means that certain input where the second argument was
neither a datatype nor a NumPy scalar type (such as a string or a python
type like int or float) will now be consistent with passing in
np.dtype(arg2).type. This makes the result consistent with
expectations and leads to a false result in some cases which previously
returned true.


Change output of round on scalars to be consistent with Python

Output of the __round__ dunder method and consequently the Python
built-in round has been changed to be a Python int to be consistent
with calling it on Python float objects when called with no arguments.
Previously, it would return a scalar of the np.dtype that was passed


The numpy.ndarray constructor no longer interprets strides=() as strides=None

The former has changed to have the expected meaning of setting
numpy.ndarray.strides to (), while the latter continues to result in
strides being chosen automatically.


C-Level string to datetime casts changed

The C-level casts from strings were simplified. This changed also fixes
string to datetime and timedelta casts to behave correctly (i.e. like
Python casts using string_arr.astype("M8") while previously the cast
would behave like string_arr.astype(np.int_).astype("M8"). This only
affects code using low-level C-API to do manual casts (not full array
casts) of single scalar values or using e.g. PyArray_GetCastFunc, and
should thus not affect the vast majority of users.



Deprecate automatic dtype=object for ragged input

Calling np.array([[1, [1, 2, 3]]) will issue a DeprecationWarning as
per NEP 34. Users should
explicitly use dtype=object to avoid the warning.


Passing shape=0 to factory functions in numpy.rec is deprecated

0 is treated as a special case and is aliased to None in the

  • numpy.core.records.fromarrays
  • numpy.core.records.fromrecords
  • numpy.core.records.fromstring
  • numpy.core.records.fromfile

In future, 0 will not be special cased, and will be treated as an
array length like any other integer.


Deprecation of probably unused C-API functions

The following C-API functions are probably unused and have been

  • PyArray_GetArrayParamsFromObject
  • PyUFunc_GenericFunction
  • PyUFunc_SetUsesArraysAsData

In most cases PyArray_GetArrayParamsFromObject should be replaced by
converting to an array, while PyUFunc_GenericFunction can be replaced
with PyObject_Call (see documentation for details).


Converting certain types to dtypes is Deprecated

The super classes of scalar types, such as np.integer, np.generic,
or np.inexact will now give a deprecation warning when converted to a
dtype (or used in a dtype keyword argument). The reason for this is that
np.integer is converted to np.int_, while it would be expected to
represent any integer (e.g. also int8, int16, etc. For example,
dtype=np.floating is currently identical to dtype=np.float64, even
though also np.float32 is a subclass of np.floating.


Deprecation of round for np.complexfloating scalars

Output of the __round__ dunder method and consequently the Python
built-in round has been deprecated on complex scalars. This does not
affect np.round.


numpy.ndarray.tostring() is deprecated in favor of tobytes()

~numpy.ndarray.tobytes has existed since the 1.9 release, but until
this release ~numpy.ndarray.tostring emitted no warning. The change to
emit a warning brings NumPy in line with the builtin array.array
methods of the same name.


C API changes

Better support for const dimensions in API functions

The following functions now accept a constant array of npy_intp:

  • PyArray_BroadcastToShape
  • PyArray_IntTupleFromIntp
  • PyArray_OverflowMultiplyList

Previously the caller would have to cast away the const-ness to call
these functions.


Const qualify UFunc inner loops

UFuncGenericFunction now expects pointers to const dimension and
strides as arguments. This means inner loops may no longer modify
either dimension or strides. This change leads to an
incompatible-pointer-types warning forcing users to either ignore the
compiler warnings or to const qualify their own loop signatures.


New Features

numpy.frompyfunc now accepts an identity argument

This allows the `numpy.ufunc.identity{.interpreted-text
role="attr"}[ attribute to be set on the resulting ufunc, meaning it can
be used for empty and multi-dimensional calls to


np.str_ scalars now support the buffer protocol

np.str_ arrays are always stored as UCS4, so the corresponding scalars
now expose this through the buffer interface, meaning
memoryview(np.str_('test')) now works.


subok option for numpy.copy

A new kwarg, subok, was added to numpy.copy to allow users to toggle
the behavior of numpy.copy with respect to array subclasses. The
default value is False which is consistent with the behavior of
numpy.copy for previous numpy versions. To create a copy that
preserves an array subclass with numpy.copy, call
np.copy(arr, subok=True). This addition better documents that the
default behavior of numpy.copy differs from the numpy.ndarray.copy
method which respects array subclasses by default.


numpy.linalg.multi_dot now accepts an out argument

out can be used to avoid creating unnecessary copies of the final
product computed by numpy.linalg.multidot.


keepdims parameter for numpy.count_nonzero

The parameter keepdims was added to numpy.count_nonzero. The
parameter has the same meaning as it does in reduction functions such as
numpy.sum or numpy.mean.


equal_nan parameter for numpy.array_equal

The keyword argument equal_nan was added to numpy.array_equal.
equal_nan is a boolean value that toggles whether or not nan values
are considered equal in comparison (default is False). This matches
API used in related functions such as numpy.isclose and



Improve detection of CPU features

Replace npy_cpu_supports which was a gcc specific mechanism to test
support of AVX with more general functions npy_cpu_init and
npy_cpu_have, and expose the results via a NPY_CPU_HAVE c-macro as
well as a python-level __cpu_features__ dictionary.


Use 64-bit integer size on 64-bit platforms in fallback lapack_lite

Use 64-bit integer size on 64-bit platforms in the fallback LAPACK
library, which is used when the system has no LAPACK installed, allowing
it to deal with linear algebra for large arrays.


Use AVX512 intrinsic to implement np.exp when input is np.float64

Use AVX512 intrinsic to implement np.exp when input is np.float64,
which can improve the performance of np.exp with np.float64 input
5-7x faster than before. The module has grown
about 63 KB on linux64.


Ability to disable madvise hugepages

On Linux NumPy has previously added support for madavise hugepages which
can improve performance for very large arrays. Unfortunately, on older
Kernel versions this led to peformance regressions, thus by default the
support has been disabled on kernels before version 4.6. To override the
default, you can use the environment variable:


or set it to 1 to force enabling support. Note that this only makes a
difference if the operating system is set up to use madvise transparent


numpy.einsum accepts NumPy int64 type in subscript list

There is no longer a type error thrown when numpy.einsum is passed a
NumPy int64 array as its subscript list.


np.logaddexp2.identity changed to -inf

The ufunc ~numpy.logaddexp2 now has an identity of -inf, allowing it
to be called on empty sequences. This matches the identity of



Remove handling of extra argument to __array__

A code path and test have been in the code since NumPy 0.4 for a
two-argument variant of __array__(dtype=None, context=None). It was
activated when calling ufunc(op) or ufunc.reduce(op) if
op.__array__ existed. However that variant is not documented, and it
is not clear what the intention was for its use. It has been removed.


numpy.random._bit_generator moved to numpy.random.bit_generator

In order to expose numpy.random.BitGenerator and
numpy.random.SeedSequence to Cython, the _bitgenerator module is now
public as numpy.random.bit_generator

Cython access to the random distributions is provided via a pxd file

c_distributions.pxd provides access to the c functions behind many of
the random distributions from Cython, making it convenient to use and
extend them.


Fixed eigh and cholesky methods in numpy.random.multivariate_normal

Previously, when passing method='eigh' or method='cholesky',
numpy.random.multivariate_normal produced samples from the wrong
distribution. This is now fixed.


Fixed the jumping implementation in MT19937.jumped

This fix changes the stream produced from jumped MT19937 generators. It
does not affect the stream produced using RandomState or MT19937
that are directly seeded.

The translation of the jumping code for the MT19937 contained a reversed
loop ordering. MT19937.jumped matches the Makoto Matsumoto's original
implementation of the Horner and Sliding Window jump methods.




4402625434f1a72bbb92eb2f778746de  numpy-1.19.0rc2-cp36-cp36m-macosx_10_9_x86_64.whl
00dc464c6ea41b0455bfa2ac10743ff4  numpy-1.19.0rc2-cp36-cp36m-manylinux1_i686.whl
79329dbf55bbfd2ab0fa939121ccc78a  numpy-1.19.0rc2-cp36-cp36m-manylinux1_x86_64.whl
5e6da57e789798f724347ef60f3c92a6  numpy-1.19.0rc2-cp36-cp36m-manylinux2010_i686.whl
bdae85b54774be5b653dec764566506f  numpy-1.19.0rc2-cp36-cp36m-manylinux2010_x86_64.whl
5584ce67eb578fb27821577a5490dd50  numpy-1.19.0rc2-cp36-cp36m-manylinux2014_aarch64.whl
a59cdc4f173a0e03fea4b89c71151d2a  numpy-1.19.0rc2-cp36-cp36m-win32.whl
04be1471f39e3283a77988804fc839fe  numpy-1.19.0rc2-cp36-cp36m-win_amd64.whl
5fb6f812e8c581b1a65ef69bccdc1bb4  numpy-1.19.0rc2-cp37-cp37m-macosx_10_9_x86_64.whl
14d63aba4c1aa6ca7a757d8be68cd696  numpy-1.19.0rc2-cp37-cp37m-manylinux1_i686.whl
e253be865c122d87908218fe660862c3  numpy-1.19.0rc2-cp37-cp37m-manylinux1_x86_64.whl
78576e10b9bf48837aae9d6b7a231219  numpy-1.19.0rc2-cp37-cp37m-manylinux2010_i686.whl
790ca051a69e393ede6952c0588a4ccb  numpy-1.19.0rc2-cp37-cp37m-manylinux2010_x86_64.whl
70ff604feed46336810fc8b539d0ab79  numpy-1.19.0rc2-cp37-cp37m-manylinux2014_aarch64.whl
925bd569daf0c2d1ed441ba1022c74d8  numpy-1.19.0rc2-cp37-cp37m-win32.whl
773f795f1c9ce00beed2646b4e496155  numpy-1.19.0rc2-cp37-cp37m-win_amd64.whl
265faec32b8bd19ad46d71f0fdc23eba  numpy-1.19.0rc2-cp38-cp38-macosx_10_9_x86_64.whl
34d0ed75f82bced398cf8d42f40faf2f  numpy-1.19.0rc2-cp38-cp38-manylinux1_i686.whl
6c4e77576987f13d894cc3b763da3372  numpy-1.19.0rc2-cp38-cp38-manylinux1_x86_64.whl
be31ca0f2dbef9450dfd737fdf9ea297  numpy-1.19.0rc2-cp38-cp38-manylinux2010_i686.whl
d7a19658651a4290c289b7736a3d0471  numpy-1.19.0rc2-cp38-cp38-manylinux2010_x86_64.whl
118e4b75b557b29ea284cb1f97ab76ee  numpy-1.19.0rc2-cp38-cp38-manylinux2014_aarch64.whl
8b1325b84fa1dea25137595bcc3fba4d  numpy-1.19.0rc2-cp38-cp38-win32.whl
022defe479409b7b5604c38df63ba330  numpy-1.19.0rc2-cp38-cp38-win_amd64.whl
1ba5b606b95e0fee55ec99da3b15fae5  numpy-1.19.0rc2-pp36-pypy36_pp73-manylinux2010_x86_64.whl
b24c70ce8bed9e03ef08730127f4d30b  numpy-1.19.0rc2.tar.gz


6068db7fc6e34aed8a2d4ea4041fbeff3485a05452524d307c70da708ea40d63  numpy-1.19.0rc2-cp36-cp36m-macosx_10_9_x86_64.whl
e1c4e32318501ec8e8fa3dead802dd1b913dcf8eddeb2b0370f35b58c71d6018  numpy-1.19.0rc2-cp36-cp36m-manylinux1_i686.whl
01e17a9c1fdc7b97c75ad926f816694397be76251222a6f6cb50bbe3218cf3e5  numpy-1.19.0rc2-cp36-cp36m-manylinux1_x86_64.whl
9e8bf8bb69ef268eaab6483b354039aabb737c3aaab4ad526e4ad7c95a87bd3c  numpy-1.19.0rc2-cp36-cp36m-manylinux2010_i686.whl
c49cc2b4e1b40bd836b2077d1cfee738577d2a411268eccace4f01dc22ef90ed  numpy-1.19.0rc2-cp36-cp36m-manylinux2010_x86_64.whl
3eb013e193de97ec196441f6bdf9a1bea84dfbfb2421d5cccfdbba3aa2d60ec0  numpy-1.19.0rc2-cp36-cp36m-manylinux2014_aarch64.whl
307da8faeb1e84bbee082004c06aa41510e52321025d4a54a16ca48f8329ca4f  numpy-1.19.0rc2-cp36-cp36m-win32.whl
7c716527392f34c217f18672aac79e88f4747e2717bd0c0c99755b197a5f5197  numpy-1.19.0rc2-cp36-cp36m-win_amd64.whl
c2f32979427df01cda8834af714dfacd06dce92f6c9275482a2e2932c67e67a1  numpy-1.19.0rc2-cp37-cp37m-macosx_10_9_x86_64.whl
d9b07673ac07cd02b1ba4d7eb920cd762d1559cc40af63d8e2b16774fdc3aa36  numpy-1.19.0rc2-cp37-cp37m-manylinux1_i686.whl
5e5b36b986a28d6651f6c8ebed084290e30833f50a7e0fe04f916b59d5113863  numpy-1.19.0rc2-cp37-cp37m-manylinux1_x86_64.whl
707be2715ca33f98335fdc84e3a79de4d85c7dd6b24aff6a57e45bf393205eb5  numpy-1.19.0rc2-cp37-cp37m-manylinux2010_i686.whl
cf6a8eb39bd191584de2f47dcc40155ffc902a32cff2a985ac58d93c035b306a  numpy-1.19.0rc2-cp37-cp37m-manylinux2010_x86_64.whl
ec6c41348e05e2bee6b34cedb5bb38f7e53dee7e0791a4a63e1425dbee5ef326  numpy-1.19.0rc2-cp37-cp37m-manylinux2014_aarch64.whl
45c0a742198566b46479231cb4f189f69c4fd8fe1331f1217f9c58496fe52fc2  numpy-1.19.0rc2-cp37-cp37m-win32.whl
32073a47eeb37172f23f4f432efb2068c6b13b04d3eb4f0558056430ee3f32c5  numpy-1.19.0rc2-cp37-cp37m-win_amd64.whl
7526a8dbc68d730785a57ec18541b194d4ac7402843addb0d706174668f5be16  numpy-1.19.0rc2-cp38-cp38-macosx_10_9_x86_64.whl
b82511ae4d8e3dbf727c91bf6c761f882750428e888e0c1795b57f3c4b8cfc1e  numpy-1.19.0rc2-cp38-cp38-manylinux1_i686.whl
159741a29c33b5e2829e4fcdcd712c35651f1b7571672002453f27fe438459d4  numpy-1.19.0rc2-cp38-cp38-manylinux1_x86_64.whl
e9ad332f8ff6f53dba38f39f3832a2f9fd4627039bc3a2baddb699fdf445adb1  numpy-1.19.0rc2-cp38-cp38-manylinux2010_i686.whl
93bb0c1f9c69e5ce97e8d6b45c472a050bfa1e433c4c70c4568718c60cc7c306  numpy-1.19.0rc2-cp38-cp38-manylinux2010_x86_64.whl
53564bfd09dda34cd74d11cbc1aad88b7fd2ad8b1d6eae6b4274ac789f30d6c0  numpy-1.19.0rc2-cp38-cp38-manylinux2014_aarch64.whl
dd21db931bdeb5d6ecffe36673bbaee4510f7e79b9afdbbdc2bf9c157ec8734c  numpy-1.19.0rc2-cp38-cp38-win32.whl
612878ef8025af60c9d43556e45d93fa07d2e6a960e252a475575d3018e361cc  numpy-1.19.0rc2-cp38-cp38-win_amd64.whl
e20452ad415c56cec51f52080adb4eccc4891ee86cf6b194e2434d09d42a183d  numpy-1.19.0rc2-pp36-pypy36_pp73-manylinux2010_x86_64.whl
39814c52f65c89385028da97da574d5e2a74de5c52d6273cae755982c91597bc  numpy-1.19.0rc2.tar.gz

Don't miss a new numpy release

NewReleases is sending notifications on new releases.