Skip to content

[Packaging][Python] PyArrow fails building with nightlies Cython #49138

@raulcd

Description

@raulcd

Describe the bug, including details regarding any error messages, version, and platform.

We use a nightlies version of Cython for free-threaded PyArrow:

https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/cython/3.3.0a0/cython-3.3.0a0-py3-none-any.whl

This is currently failing with:

[13/115] Compiling Cython CXX source for lib...
FAILED: CMakeFiles/lib_pyx /arrow/python/build/temp.linux-x86_64-cpython-313t/CMakeFiles/lib_pyx 
cd /arrow/python/build/temp.linux-x86_64-cpython-313t && /opt/python/cp313-cp313t/bin/python -m cython --cplus --warning-errors --no-c-in-traceback -Xfreethreading_compatible=True --directive embedsignature=True --working /arrow/python --output-file /arrow/python/build/temp.linux-x86_64-cpython-313t/lib.cpp /arrow/python/pyarrow/lib.pyx

Error compiling Cython file:
------------------------------------------------------------
...
    options.field_merge_options = _parse_field_merge_options(
        "default" if promote_options == "none" else promote_options
    )

    with nogil:
        options.unify_schemas = promote_options != "none"
                                                ^
------------------------------------------------------------
pyarrow/table.pxi:6320:48: Coercion from Python not allowed without the GIL

Error compiling Cython file:
------------------------------------------------------------
...
    options.field_merge_options = _parse_field_merge_options(
        "default" if promote_options == "none" else promote_options
    )

    with nogil:
        options.unify_schemas = promote_options != "none"
                                                ^
------------------------------------------------------------
pyarrow/table.pxi:6320:48: Operation not allowed without gil

Taking a look at latest Cython commits the following could be related:
cython/cython@46e961e

I am unsure what the problem is and whether is a regression on Cython or we should fix the comparison to require the GIL.

This is happening both on main and the 23.0.1 maintenance branch so it has to be fixed for the release.

Component(s)

Packaging, Python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions