BUG: NumbaPendingDeprecationWarning with numba 0.58.0 · Issue #55247 · pandas-dev/pandas (original) (raw)

Pandas version checks

Reproducible Example

import pandas as pd import numpy as np

df = pd.DataFrame({'col1': [1, 2, 3, 4, 5]}) df.col1.rolling(2).apply(np.prod, raw=True, engine='numba')

Running this code with the latest version of numba (0.58.0) results in the following warning:

/srv/temp/p311/lib64/python3.11/site-packages/pandas/core/window/numba_.py:72: NumbaPendingDeprecationWarning: Code using Numba extension API maybe depending on 'old_style' error-capturing, which is deprecated and will be replaced by 'new_style' in a future release. See details at https://numba.readthedocs.io/en/latest/reference/deprecation.html#deprecation-of-old-style-numba-captured-errors
Exception origin:
  File "/srv/temp/p311/lib64/python3.11/site-packages/numba/core/typing/templates.py", line 807, in _build_impl
    raise AssertionError(msg.format(pyfunc))

  result[i] = numba_func(window, *args)

Issue Description

It looks like Numba is deprecating an old style of error capturing and is printing the deprecation warning to alert developers to migrate to the new style. Here are the details:

https://numba.readthedocs.io/en/latest/reference/deprecation.html#deprecation-of-old-style-numba-captured-errors

Expected Behavior

Expected behavior is for the code to run without printing the deprecation warning.

Installed Versions

/srv/temp/p311/lib64/python3.11/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.")

INSTALLED VERSIONS

commit : e86ed37
python : 3.11.4.final.0
python-bits : 64
OS : Linux
OS-release : 6.4.14-200.fc38.x86_64
Version : #1 SMP PREEMPT_DYNAMIC Sat Sep 2 16:36:06 UTC 2023
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 2.1.1
numpy : 1.25.2
pytz : 2023.3.post1
dateutil : 2.8.2
setuptools : 65.5.1
pip : 22.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader : 0.10.0
bs4 : 4.12.2
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.8.0
numba : 0.58.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 13.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.11.2
sqlalchemy : None
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None