Skip to content

Conversation

@AlenkaF
Copy link
Member

@AlenkaF AlenkaF commented Aug 12, 2025

Rationale for this change

Ubuntu and Windows wheels started failing on free-threaded build of CPython 3.13 due to cffi not supporting free-threaded CPython 3.13.

What changes are included in this PR?

Free-threaded 3.13 builds use separate requirements with no cffi.

Are these changes tested?

Yes, with the extended builds.

Are there any user-facing changes?

No.

@github-actions
Copy link

⚠️ GitHub issue #47256 has been automatically assigned in GitHub to PR creator.

@github-actions github-actions bot added the awaiting review Awaiting review label Aug 12, 2025
@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit wheel-windows-cp313-cp313t-amd64

@github-actions
Copy link

Revision: fcd62fe215030e748ae65def07e68ebea69b6035

Submitted crossbow builds: ursacomputing/crossbow @ actions-4c2b829fab

Task Status
wheel-windows-cp313-cp313t-amd64 GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit test-ubuntu-22.04-python-313-freethreading

@github-actions
Copy link

Revision: fcd62fe215030e748ae65def07e68ebea69b6035

Submitted crossbow builds: ursacomputing/crossbow @ actions-860e036ce5

Task Status
test-ubuntu-22.04-python-313-freethreading GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

Installing cffi again with a pinned version won't help, as the first install from requirements-*-test.txt already triggers the failure.

Pinning cffi globally isn’t ideal since this only affects the 3.13 free-threaded build.

Instead, we can patch the requirements file directly in the Dockerfile to exclude cffi and re-add it with a pinned version (<2.0.0). This avoids maintaining a separate override file and keeps the change localized to the affected build.

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit test-ubuntu-22.04-python-313-freethreading

@github-actions
Copy link

Revision: d853ccc9ba0371906bec98d56e2641a16f955199

Submitted crossbow builds: ursacomputing/crossbow @ actions-5fc39b3bfa

Task Status
test-ubuntu-22.04-python-313-freethreading GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit wheel-windows-cp313-cp313t-amd64

@github-actions
Copy link

Revision: d853ccc9ba0371906bec98d56e2641a16f955199

Submitted crossbow builds: ursacomputing/crossbow @ actions-2685669349

Task Status
wheel-windows-cp313-cp313t-amd64 GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

The last commit fixes the build failures related to cffi and the CPython 3.13 version discrepancy.

I’m not sure if patching in the Dockerfile is the best approach, so I’m happy to change it if needed—cc @kou.

Now that the cffi failure is resolved, I’m continuing to investigate the Windows Cython failures (see #47308). If I find a fix, I might add it here in the same PR.

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit wheel-windows-*

@github-actions
Copy link

Revision: cc758f4d36e3fdc48c96a85bc82a77b1bbf0d15e

Submitted crossbow builds: ursacomputing/crossbow @ actions-3c0c8c4c06

Task Status
wheel-windows-cp310-cp310-amd64 GitHub Actions
wheel-windows-cp311-cp311-amd64 GitHub Actions
wheel-windows-cp312-cp312-amd64 GitHub Actions
wheel-windows-cp313-cp313-amd64 GitHub Actions
wheel-windows-cp313-cp313t-amd64 GitHub Actions
wheel-windows-cp39-cp39-amd64 GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

Ah, I need to fix the Windows patch issue. Didn't saw that before: https://github.com/ursacomputing/crossbow/actions/runs/16905769938/job/47895087244#step:9:504

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit wheel-windows-*

@AlenkaF AlenkaF changed the title GH-47256: [Python] Pin cffi in free-threaded builds GH-47256: [Python] Pin cffi in free-threaded builds and use newer Win SDK Aug 12, 2025
@AlenkaF AlenkaF changed the title GH-47256: [Python] Pin cffi in free-threaded builds and use newer Win SDK GH-47256: [Python] Pin cffi in free-threaded builds and use newer Win SDK in Windows wheels Aug 12, 2025
@github-actions
Copy link

Revision: caa7067a6fa956364bc905b0c3d185c205c603bd

Submitted crossbow builds: ursacomputing/crossbow @ actions-02fe533f65

Task Status
wheel-windows-cp310-cp310-amd64 GitHub Actions
wheel-windows-cp311-cp311-amd64 GitHub Actions
wheel-windows-cp312-cp312-amd64 GitHub Actions
wheel-windows-cp313-cp313-amd64 GitHub Actions
wheel-windows-cp313-cp313t-amd64 GitHub Actions
wheel-windows-cp39-cp39-amd64 GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit wheel-windows-cp310-cp310-amd64

@github-actions
Copy link

Revision: 55dc4acfcb1f9decc6921276295ce745a90f03cf

Submitted crossbow builds: ursacomputing/crossbow @ actions-b37f110292

Task Status
wheel-windows-cp310-cp310-amd64 GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit wheel-windows-cp310-cp310-amd64

@github-actions
Copy link

Revision: d9e53fd1786daf7a085c2054252c23b27c8b9d75

Submitted crossbow builds: ursacomputing/crossbow @ actions-1131ef4771

Task Status
wheel-windows-cp310-cp310-amd64 GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Aug 12, 2025

@github-actions crossbow submit wheel-windows-cp310-cp310-amd64

@github-actions
Copy link

Revision: 4228c421ce036d96ea2eb947ec2dff1c1ddefac3

Submitted crossbow builds: ursacomputing/crossbow @ actions-bee8b2d046

Task Status
wheel-windows-cp310-cp310-amd64 GitHub Actions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Environment Markers https://packaging.python.org/en/latest/specifications/dependency-specifiers/#environment-markers instead of this approach? Something like:

--- a/python/requirements-test.txt
+++ b/python/requirements-test.txt
@@ -1,4 +1,5 @@
-cffi
+cffi; python_version != '3.13t'
+cffi<2.0.0; python_version == '3.13t'
 hypothesis
 packaging
 pandas

(I'm not sure whether we have a variable to determine free-threaded CPython...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that is much much nicer! Thank you @kou .
I noticed a use of PYTHON_GIL in the free-threaded builds. Looking at python-wheels/github.osx.yml it seems same as what you suggested in this diff.

Copy link
Member Author

@AlenkaF AlenkaF Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, python_version doesn't support detailed versions like 3.13t — it only handles the major.minor format:

Ignoring cffi: markers 'python_version == "3.13t"' don't match your environment

See: https://github.com/ursacomputing/crossbow/actions/runs/16930331373/job/47974180274#step:6:722

Other markers listed in PEP 508 don't help either.
Using something like os.environ.get("PYTHON_GIL") in a requirements file is also ignored by pip, since arbitrary Python expressions aren’t supported in markers.

Not sure about other options — will keep investigating.

Copy link
Contributor

@WillAyd WillAyd Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's surprising that it only handles major and minor versions. I think the docs even show examples with a patch version?

https://packaging.python.org/en/latest/specifications/dependency-specifiers/#specification

I wonder if including a patch number here would be helpful? I'm not sure that Python's packaging story is complete around the t suffix and how version comparisons are handled (my knowledge could also be outdated!)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is surprising, yeah. In the examples shared patch versions are not used in the python_version Environment Marker. For example, this issue led me to believe that python_version only considers the major and minor versions.

As for the t suffix, I’m also not entirely sure about the background there. I vaguely remember hearing at EuroPython that it's going to stay, but I could be misremembering 😬

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Aug 12, 2025
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Aug 27, 2025
# version. However, there is no need to make this strictly the oldest version,
# so it can be broadened to have a single version specification across platforms.
# (`~=x.y.z` specifies a compatible release as `>=x.y.z, == x.y.*`)
numpy~=1.21.3; python_version < "3.11"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this file is for 3.13, these lines can be simplified :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes! Will do.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: 430f26b

@pitrou
Copy link
Member

pitrou commented Aug 27, 2025

@AlenkaF Can you update the PR title to reflect the PR contents?

@AlenkaF AlenkaF changed the title GH-47256: [Python] Pin cffi in free-threaded builds GH-47256: [Python] Do not use cffi in free-threaded 3.13 builds Aug 27, 2025
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Sep 1, 2025
@AlenkaF
Copy link
Member Author

AlenkaF commented Sep 1, 2025

@github-actions crossbow submit test-ubuntu-22.04-python-313-freethreading

@github-actions
Copy link

github-actions bot commented Sep 1, 2025

Revision: 430f26b

Submitted crossbow builds: ursacomputing/crossbow @ actions-c0a94d79aa

Task Status
test-ubuntu-22.04-python-313-freethreading GitHub Actions

@raulcd
Copy link
Member

raulcd commented Sep 1, 2025

@github-actions crossbow submit test-ubuntu-22.04-python-313-freethreading

@github-actions
Copy link

github-actions bot commented Sep 1, 2025

Revision: c5c8e4e

Submitted crossbow builds: ursacomputing/crossbow @ actions-ac6d583157

Task Status
test-ubuntu-22.04-python-313-freethreading GitHub Actions

@AlenkaF
Copy link
Member Author

AlenkaF commented Sep 1, 2025

Should we wait for the Windows wheels issue to be fixed so we can test the changes on wheel-windows-cp313-cp313t-amd64 also?

@raulcd
Copy link
Member

raulcd commented Sep 2, 2025

Should we wait for the Windows wheels issue to be fixed so we can test the changes on wheel-windows-cp313-cp313t-amd64 also?

I don't think we should, the Windows wheel issue is currently "blocked" by vcpkg issues and not being able to properly diagnose due to the lack of logs from vcpkg.

Copy link
Member

@raulcd raulcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Sep 2, 2025
@AlenkaF
Copy link
Member Author

AlenkaF commented Sep 2, 2025

@pitrou mind having one last look before we merge?

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM, thank you.

In the future, we might want to replace this with a requirements-test-free-threaded.txt...

@AlenkaF AlenkaF merged commit 55be8c0 into apache:main Sep 2, 2025
34 of 36 checks passed
@AlenkaF AlenkaF removed the awaiting merge Awaiting merge label Sep 2, 2025
@AlenkaF AlenkaF deleted the fix-windows-builds branch September 2, 2025 07:56
@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 55be8c0.

There weren't enough matching historic benchmark results to make a call on whether there were regressions.

The full Conbench report has more details.

@ngoldbaum
Copy link

Sorry the explicit lack of support for 3.13t in CFFI 2.0.0 caused you all a little headache here. Glad it was all sorted out eventually.

@AlenkaF
Copy link
Member Author

AlenkaF commented Sep 15, 2025

No worries at all, just a minor PR needed. Thanks for all the work on your side @ngoldbaum !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants