Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: aggregations.pyx importing signbit() and sqrt() #51047

Open
3 tasks done
he32 opened this issue Jan 28, 2023 · 5 comments
Open
3 tasks done

BUG: aggregations.pyx importing signbit() and sqrt() #51047

he32 opened this issue Jan 28, 2023 · 5 comments
Labels
Bug Build Library building on various platforms

Comments

@he32
Copy link

he32 commented Jan 28, 2023

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 #undefs
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 he@whatever.no:/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

@he32 he32 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 28, 2023
he32 added a commit to he32/pandas that referenced this issue Jan 28, 2023
This reintroduces how this was done in pandas 1.3.5.
This should fix issue pandas-dev#51047.
@lithomas1 lithomas1 added Build Library building on various platforms and removed Needs Triage Issue that has not been reviewed by a pandas team member labels May 20, 2023
@iansheng
Copy link
Contributor

iansheng commented Aug 9, 2023

Hi, I ran into the same problem as you. Any progress so far?

@he32
Copy link
Author

he32 commented Sep 29, 2023 via email

@barracuda156
Copy link

Same error on MacOS PowerPC:

/usr/bin/gcc-4.2 -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -pipe -Os -arch ppc -isysroot/ -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/window -I/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/numpy/core/include -I/opt/local/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c pandas/_libs/window/aggregations.cpp -o build/temp.macosx-10.6-ppc-cpython-311/pandas/_libs/window/aggregations.o -Wno-error=unreachable-code
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:4800: error: ‘signbit’ was not declared in this scope
pandas/_libs/window/aggregations.cpp: In function ‘void __pyx_f_6pandas_5_libs_6window_12aggregations_remove_mean(__pyx_t_5numpy_float64_t, Py_ssize_t*, __pyx_t_5numpy_float64_t*, Py_ssize_t*, __pyx_t_5numpy_float64_t*)’:
pandas/_libs/window/aggregations.cpp:4967: error: ‘signbit’ was not declared in this scope
error: command '/usr/bin/gcc-4.2' failed with exit code 1

@barracuda156
Copy link

@newacct
Copy link

newacct commented Sep 19, 2024

I have this problem on pandas 1.5.0, but not on 1.4.4. I tracked it down to this commit, from this pull request. This issue says that that pull request removed too much, and causes the signbit() problem, which is the problem we are seeing here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Build Library building on various platforms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants