Skip to content

MAINT Add Python 3.13 wheels #29789

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

Merged
merged 26 commits into from
Sep 23, 2024
Merged

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Sep 5, 2024

One of the complications due to the fact that pandas does not have a release with Python 3.13 wheels (in contrary to numpy and scipy). For now I used pandas-dev to test the wheels.

The other complication is due to our custom Windows setup (we build a minimal Windows image to avoid relying on system OpenMP #18802) and run the tests in this image which has a few quirks (for example cibuildwheel does not know about it and install CIBW_TEST_REQUIRES inside the host).

Close #29292.

@lesteve lesteve marked this pull request as draft September 5, 2024 15:41
Copy link

github-actions bot commented Sep 5, 2024

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 910aeb9. Link to the linter CI: here

Comment on lines 24 to 26
docker container run \
--rm scikit-learn/minimal-windows \
powershell -Command "python -m pip install -c 'import sklearn; sklearn.show_versions()'"
Copy link
Member

Choose a reason for hiding this comment

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

This trigger the following error:

ERROR: Could not open requirements file: [Errno 2] No such file or directory: 'import sklearn; sklearn.show_versions()'

Is there an issue with the quotes

Copy link
Member

Choose a reason for hiding this comment

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

Oh no there is a pip isntall in the middle.

@lesteve
Copy link
Member Author

lesteve commented Sep 9, 2024

The wheels building on Github Actions was green in commit e139fb7 see build log

@lesteve
Copy link
Member Author

lesteve commented Sep 9, 2024

The wheels building on Linux arm Python 3.13 worked see build log.

The Python 3.13 Linux arm tests passed in a816413 see build log

@lesteve lesteve marked this pull request as ready for review September 9, 2024 16:27
@glemaitre glemaitre self-requested a review September 16, 2024 13:12
@glemaitre
Copy link
Member

Let me check this PR since that we merged 1.5.2 now and we can have this PR for the main branch now.

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @lesteve

platform_id: manylinux_x86_64
manylinux_image: manylinux2014
# TODO: remove next line when Python 3.13 is released
prerelease_pythons: True
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
prerelease_pythons: True

With cibuildwheel v2.20.0, the prerelease_python flag is not required anymore: https://cibuildwheel.pypa.io/en/stable/changelog/#v2200

CPython 3.13 wheels are now built by default - without the CIBW_PRERELEASE_PYTHONS flag.

(We'll still need to keep windows because of the -rc logic when building the image)

@lesteve
Copy link
Member Author

lesteve commented Sep 19, 2024

Probably I should have not done this, but while I worked on this, I found the Dockerfile on Windows a pain to work with, especially for adding custom logic (which I needed to decide to use pandas-dev on Python 3.13) and also an additional layer to pass environment variables to.

This probably doesn't follow Docker best practices but I found constructing the Docker image in a bash script through docker run + docker exec + docker commit a lot more convenient.

My biases are:

  • I am not super motivated to learn how to do a if then else in Powershell and even less so to maintain the code
  • I have a Windows VM on my Linux machine but I am not sure I can install Docker which makes it hard to test locally ... last time I tried installing WSL (just for fun for some reason 😅) I ended up reading tweaking my BIOS to try to enable nested virtualization and I never managed to get it to work ...

Oh and the Python 3.13 free-threaded failure is due to #29864

@thomasjpfan
Copy link
Member

thomasjpfan commented Sep 19, 2024

I have a Windows VM on my Linux machine but I am not sure I can install Docker which makes it hard to test locally

I recently tried this and ended up just dual booting Windows.

This probably doesn't follow Docker best practices but I found constructing the Docker image in a bash script through docker run + docker exec + docker commit a lot more convenient.

I am okay with this. The only reason we use the minimal windows version is to make sure the vendored msvcp140.dll and vcomp140.dll works. In the past, I tried to remove the need to vendor dlls, but could not get it to work.


References:

@lesteve
Copy link
Member Author

lesteve commented Sep 20, 2024

A bit of a side-topic and not related to this PR, but for removing msvcp140.dll, I don't understand the details but it looks like matplotlib use static linking to avoid having to deal with it: https://github.com/matplotlib/matplotlib/pull/28687/files. Looks like they tried delvewheel and thought the static linking was more robust for some reason see nucleic/kiwi#179 (comment) ...

@lesteve
Copy link
Member Author

lesteve commented Sep 23, 2024

Two approvals and the last commit with [cd build] is green, merging this one.

@lesteve lesteve merged commit d4ca146 into scikit-learn:main Sep 23, 2024
55 checks passed
@lesteve lesteve deleted the python3.13-wheels branch September 23, 2024 08:47
@QuLogic
Copy link

QuLogic commented Sep 24, 2024

A bit of a side-topic and not related to this PR, but for removing msvcp140.dll, I don't understand the details but it looks like matplotlib use static linking to avoid having to deal with it: https://github.com/matplotlib/matplotlib/pull/28687/files. Looks like they tried delvewheel and thought the static linking was more robust for some reason see nucleic/kiwi#179 (comment) ...

We statically link to avoid crashes with mixed runtimes: matplotlib/matplotlib#28551

kbharat1210 pushed a commit to kbharat1210/scikit-learn that referenced this pull request Sep 25, 2024
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Oct 2, 2024
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.

Add Python 3.13 development wheel
5 participants