Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
While trying to build this on NetBSD, the following appears in the build log:
pandas/_libs/window/aggregations.cpp: In function 'void __pyx_f_6pandas_5_libs_6window_12aggregations_add_mean(__pyx_t_5numpy_float64_t, Py_ssize_t*, __pyx_t_5numpy_float64_t*, Py_ssize_t*, __pyx_t_5numpy_float64_t*, __pyx_t_5numpy_int64_t*, __pyx_t_5numpy_float64_t*)':
pandas/_libs/window/aggregations.cpp:4784:18: error: 'signbit' was not declared in this scope; did you mean 'std::signbit'?
4784 | __pyx_t_1 = (signbit(__pyx_v_val) != 0);
| ^~~~~~~
| std::signbit
This happens both on NetBSD/amd64 and NetBSD/powerpc, with pandas version 1.5.3.
Issue Description
See above for the build error.
The reason for this build failure on NetBSD is that even though <math.h>
is included,
the <complex>
C++ header is included later, and that includes <cmath>
which #undef
s
the macros defined in <math.h>
, among them signbit()
. So at this point, you have to use
the std::signbit
variant instead, and this has consequences for how those functions should
be imported into the aggregations.pyx
file. This used to be OK in pandas version 1.3.5, but
things have changed in 1.5.3 so that this no longer builds on NetBSD.
I have a suggested change lined up which re-does the import of signbit()
and sqrt()
to come
from the std::
namespace, but don't know if there is a particular reason the change between
1.3.5 and 1.5.3 was introduced.
Expected Behavior
The build should succeed.
Installed Versions
INSTALLED VERSIONS
commit : 2e218d1
python : 3.10.8.final.0
python-bits : 64
OS : NetBSD
OS-release : 9.99.104
Version : NetBSD 9.99.104 (GENERIC) #2: Wed Nov 2 15:11:41 UTC 2022 [email protected]:/usr/obj/sys/arch/amd64/compile/GENERIC
machine : amd64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_US.UTF-8
pandas : 1.5.3
numpy : 1.23.4
pytz : 2022.1
dateutil : 2.8.2
setuptools : 63.4.3
pip : 22.3.1
Cython : 0.29.32
pytest : 7.2.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.9.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : 1.3.5
brotli : 1.0.9
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.2
numba : None
numexpr : 2.8.4
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.9.3
snappy : None
sqlalchemy : None
tables : 3.7.0
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None