pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
42.6k stars 17.57k forks source link

BUG: 2.2.2 pep517 build fails #58274

Open kloczek opened 2 months ago

kloczek commented 2 months ago

Pandas version checks

Reproducible Example

- clone repo
- `python3 -sBm build -w --no-isolation`

Issue Description

Looks like something is wrong and pep517 based build fails

Build fails with ```console + /usr/bin/python3 -sBm build -w --no-isolation * Getting build dependencies for wheel... * Building wheel... + meson setup /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2 /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/.mesonpy-3bx4fkmn -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --vsenv --native-file=/home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/.mesonpy-3bx4fkmn/meson-python-native-file.ini The Meson build system Version: 1.4.0 Source dir: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2 Build dir: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/.mesonpy-3bx4fkmn Build type: native build Project name: pandas Project version: 2.2.2 C compiler for the host machine: /usr/bin/gcc (gcc 14.0.1 "gcc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)") C linker for the host machine: /usr/bin/gcc ld.bfd 2.42.50.20240318 C++ compiler for the host machine: /usr/bin/g++ (gcc 14.0.1 "g++ (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)") C++ linker for the host machine: /usr/bin/g++ ld.bfd 2.42.50.20240318 Cython compiler for the host machine: cython (cython 3.0.10) Host machine cpu family: x86_64 Host machine cpu: x86_64 Program python found: YES (/usr/bin/python3) Found pkg-config: YES (/usr/bin/pkg-config) 2.1.1 Run-time dependency python found: YES 3.10 Build targets in project: 54 pandas 2.2.2 User defined options Native files: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/.mesonpy-3bx4fkmn/meson-python-native-file.ini buildtype : release vsenv : true b_ndebug : if-release b_vscrt : md Found ninja-1.12.0 at /usr/bin/ninja Visual Studio environment is needed to run Ninja. It is recommended to use Meson wrapper: /usr/bin/meson compile -C . + /usr/bin/ninja [34/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/conversion.pyx FAILED: pandas/_libs/tslibs/conversion.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/tslibs/conversion.pyx.c cython -M --fast-fail -3 --include-dir /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/.mesonpy-3bx4fkmn/pandas/_libs/tslibs '-X always_allow_keywords=true' /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/conversion.pyx -o pandas/_libs/tslibs/conversion.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/tslibs/conversion.pyx.c Error compiling Cython file: ------------------------------------------------------------ ... ts = datetime.combine(ts, time()) return convert_datetime_to_tsobject( ts, tz, nanos=0, reso=NPY_DATETIMEUNIT.NPY_FR_s ) else: pandas_libs.tslibs.period import Period ^ ------------------------------------------------------------ /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/conversion.pyx:421:34: Syntax error in simple statement list [37/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/testing.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [38/152] Compiling C object pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/meson-generated_pandas__libs_byteswap.pyx.c.o pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c: In function ‘__pyx_pf_6pandas_5_libs_8byteswap_read_float_with_byteswap’: pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c:2477:61: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘Py_ssize_t’ {aka ‘long int’} [-Wsign-compare] 2477 | __pyx_t_2 = ((__pyx_v_offset + (sizeof(__pyx_v_value))) < __pyx_t_1); | ^ pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c: In function ‘__pyx_pf_6pandas_5_libs_8byteswap_2read_double_with_byteswap’: pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c:2747:61: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘Py_ssize_t’ {aka ‘long int’} [-Wsign-compare] 2747 | __pyx_t_2 = ((__pyx_v_offset + (sizeof(__pyx_v_value))) < __pyx_t_1); | ^ pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c: In function ‘__pyx_pf_6pandas_5_libs_8byteswap_4read_uint16_with_byteswap’: pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c:3015:59: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘Py_ssize_t’ {aka ‘long int’} [-Wsign-compare] 3015 | __pyx_t_2 = ((__pyx_v_offset + (sizeof(__pyx_v_res))) < __pyx_t_1); | ^ pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c: In function ‘__pyx_pf_6pandas_5_libs_8byteswap_6read_uint32_with_byteswap’: pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c:3265:59: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘Py_ssize_t’ {aka ‘long int’} [-Wsign-compare] 3265 | __pyx_t_2 = ((__pyx_v_offset + (sizeof(__pyx_v_res))) < __pyx_t_1); | ^ pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c: In function ‘__pyx_pf_6pandas_5_libs_8byteswap_8read_uint64_with_byteswap’: pandas/_libs/byteswap.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/byteswap.pyx.c:3515:59: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘Py_ssize_t’ {aka ‘long int’} [-Wsign-compare] 3515 | __pyx_t_2 = ((__pyx_v_offset + (sizeof(__pyx_v_res))) < __pyx_t_1); | ^ [39/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/nattype.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/nattype.pyx:79:0: Global name __nat_unpickle matched from within class scope in contradiction to to Python 'class private name' rules. This may change in a future release. warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/nattype.pyx:79:0: Global name __nat_unpickle matched from within class scope in contradiction to to Python 'class private name' rules. This may change in a future release. [40/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/np_datetime.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [44/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/tzconversion.pyx FAILED: pandas/_libs/tslibs/tzconversion.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/tslibs/tzconversion.pyx.c cython -M --fast-fail -3 --include-dir /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/.mesonpy-3bx4fkmn/pandas/_libs/tslibs '-X always_allow_keywords=true' /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/tzconversion.pyx -o pandas/_libs/tslibs/tzconversion.cpython-310-x86_64-linux-gnu.so.p/pandas/_libs/tslibs/tzconversion.pyx.c Error compiling Cython file: ------------------------------------------------------------ ... elif nonexistent == "shift_forward": shift_forward = True elif nonexistent == "shift_backward": shift_backward = True elif PyDelta_Check(nonexistent): pandas_libs.tslibs.timedeltas import delta_to_nanoseconds ^ ------------------------------------------------------------ /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/tzconversion.pyx:283:38: Syntax error in simple statement list [45/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/missing.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [48/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/hashing.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [49/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/timezones.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [53/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/ops.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [55/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/parsing.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [58/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslib.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [59/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/strptime.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [61/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/parsers.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/parsers.pyx:1605:18: noexcept clause is ignored for function returning Python object [62/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/internals.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [65/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/timedeltas.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [66/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/timestamps.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [67/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/period.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [68/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/offsets.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [69/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/index.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [70/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/lib.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [72/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/interval.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [74/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/hashtable.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [75/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/algos.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object [76/152] Compiling Cython source /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/groupby.pyx warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:188:38: noexcept clause is ignored for function returning Python object warning: /home/tkloczko/rpmbuild/BUILD/pandas-2.2.2/pandas/_libs/tslibs/util.pxd:193:40: noexcept clause is ignored for function returning Python object ninja: build stopped: subcommand failed. ERROR Backend subprocess exited when trying to invoke build_wheel ```

Expected Behavior

pep517 build should not fail.

Installed Versions

List of installed modules in build env: ```console Package Version ------------------ ----------- arrow 1.3.0 attrs 23.2.0 beautifulsoup4 4.12.3 build 1.2.1 contourpy 1.2.1 cycler 0.12.1 Cython 3.0.10 et_xmlfile 1.1.0 exceptiongroup 1.1.3 execnet 2.0.2 fonttools 4.51.0 gitdb 4.0.11 GitPython 3.1.43 greenlet 3.0.3 hypothesis 6.100.0 importlib_metadata 7.1.0 iniconfig 2.0.0 installer 0.7.0 Jinja2 3.1.3 kiwisolver 1.4.5 lxml 5.2.1 MarkupSafe 2.1.5 matplotlib 3.8.4 numpy 1.26.5 olefile 0.47 openpyxl 3.1.2 packaging 24.0 pillow 10.3.0 pluggy 1.4.0 pyparsing 3.1.2 pyproject_hooks 1.0.0 pyproject-metadata 0.7.1 pytest 8.1.1 pytest-asyncio 0.23.6 pytest-xdist 3.5.0 python-dateutil 2.9.0.post0 pytz 2024.1 setuptools 69.4.0 smmap 5.0.0 sortedcontainers 2.4.0 soupsieve 2.5 SQLAlchemy 2.0.29 tokenize_rt 5.2.0 tomli 2.0.1 typing_extensions 4.11.0 versioneer 0.29 wheel 0.43.0 xlrd 2.0.1 zipp 3.18.1 ```
lithomas1 commented 2 months ago
else:
        pandas_libs.tslibs.period import Period

This line looks suspicious.

It looks like this line is from pandas/_libs/tslibs/conversion.pyx, but it doesn't seem to match the pandas source code on github.

Can you make sure your local copy of pandas isn't corrupted?

priyapandey26 commented 2 months ago

Hi @kloczek could you please share the steps in more detail? For me the steps you share clone and build its work as accepted.

kloczek commented 2 months ago

I'm building all binaries with LTO enabled so maybe some symbols are not correctly exported 🤔 Will try to have look on that in hour or two when will back home. Another possible cause could be use relative imports which always causes some issues on testing with procedure which I've described as commonly used on packaging (not only in my distro but in Fedora and few other which needs some procedure working from non-root account possibly without tox/venv). if you have any propositions of of any diagnostics please rop some line or two so when I'll back home will try to test that as well.

PS. BTW: As your module is using cython .. did you try to use cython-lint? 🤔 (maybe this could show something)

kloczek commented 2 months ago

My typical packaging procedure consist out of few steps:

lithomas1 commented 2 months ago

Hm, it could be the issue with relative imports.

I had a look at the second error and it does something like https://github.com/pandas-dev/pandas/blob/8131381c9eb6264d7abb6fe66ef8b892933af5c4/pandas/_libs/tslibs/tzconversion.pyx#L282-L284

Can you try patching the sources to do from pandas._libs.tslibs.timedeltas import delta_to_nanoseconds here? (and from pandas._libs.tslibs.period import Period) for the other one?

(If this works, I'll try to put up a fix for the next release).

I'm curious how the relative import gets butchered like that though.