-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
CI Build musllinux wheels #28490
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
CI Build musllinux wheels #28490
Conversation
Have you tried using the produced wheel in an alpine container? I am a bit surprised that this would "just work", but maybe cibuildwheel does some clever magic ... For now, I am going to reopen the associated issue and trigger a wheel build to see what happens in this PR. |
Not yet, but will try! As far as I could see, cibuildwheel is meant for exactly this, but I'm not familiar with the project/cibuildwheel, so I could be mistaken. |
@lesteve I tried the following: CIBW_PROJECT_REQUIRES_PYTHON=">=3.12" CIBW_BUILD=cp312-musllinux_x86_64 cibuildwheel --platform=linux --output-dir wheelhouse --archs x86_64
cd wheelhouse
docker run --platform linux/amd64 -i -t -v ./scikit_learn-1.5.dev0-cp312-cp312-musllinux_1_1_x86_64.whl:/scikit_learn-1.5.dev0-cp312-cp312-musllinux_1_1_x86_64.whl python:3.12-alpine /bin/ash
# ---------------- IN DOCKER CONTAINER ------------- #
pip install scikit_learn-1.5.dev0-cp312-cp312-musllinux_1_1_x86_64.whl
# installed successfully
python
# ------------- IN PYTHON CONSOLE ------------ #
>>> import sklearn
>>> dir(sklearn)
['_BUILT_WITH_MESON', '__SKLEARN_SETUP__', '__all__', '__builtins__', '__cached__', '__check_build', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', '__version__', '_config', '_distributor_init', 'base', 'clone', 'config_context', 'exceptions', 'externals', 'get_config', 'logger', 'logging', 'os', 'random', 'set_config', 'setup_module', 'show_versions', 'sys', 'utils'] Looks like it works as far as I can tell. |
Indeed, it looks like cibuildwheel detects that scikit-learn can be built with Meson, which I thought was indeed a prerequisite to allow cross-compilation. Meson support was added once month ago or so in #28040. That would be great if you could try running the scikit-learn tests in your container, something like Something more that can be fixed later, there seems to be an issue with the changes in this PR. From one of the muslinux build log it looks like the wheel created is not a musllinux one (no musllinux in the wheel name):
|
Running it now, will add a comment once it's finished. (currently at 25% and no unexpected fails (other than xfail) yet)
I think that's not the final product of the build step right? At the end of the build step, the following gets logged:
|
Tests have run successfully:
|
OK great if the test pass locally. I think you are right that a musllinux wheel is produced in the end. Looking closer it also looks the tests are running and they pass. So I guess it is up to us (scikit-learn maintainers) to decide whether we want to have scikit-learn wheels on PyPI. In the mean-time, as I noted in #27004 (comment), there seems to be community-maintained wheels for musllinux. Quickly testing it seems like the command below works inside an Alpine container:
|
@lesteve Anything you expect from me except for being patient? Let me know if there's anything I can/should do! |
There is nothing else to do on your side, this PR and your local tests were already quite useful, thanks for this! |
Looking at this, I'd vote for providing the wheels. What are the downsides? More wheels being built, so more chances for something to go wrong? It might not be easy to stop providing them again? Are there hidden assumptions in scikit-learn's code regarding glibc (is that even a thing that is possible?)? If Numpy and Scipy have been building wheels for a while I'd assume the process is pretty mature. |
I'm also working on musl wheels for another library, and tbh the process doesn't feel really mature within their pipeline setup, but that could also be (my unfamiliarity with) their pipeline setup. Since numpy, scipy, pandas, and Google Cloud (a.o.) provide musllinux packages I think its the latter. |
@betatim I replied in the associated issue #27004 (comment), since I feel this is more suited to the discussion "do we want musllinux wheels or not". |
Closing this as not planned for now, see #27004 (comment) for more details. We can always reopen this PR if the consensus on musllinux wheels changes. |
Reference Issues/PRs
Fixes #27004
What does this implement/fix? Explain your changes.
I've added a wheel-output for musllinux, for faster installation on (among others) Alpine-Linux.
Any other comments?
Since Alpine-Linux is used increasingly, pre-building wheels for Alpine-Linux is a must-have IMO.
I'm unfamiliar with the codebase, so I might've missed something. I tried my best to test it locally by running
CIBW_PROJECT_REQUIRES_PYTHON=">=3.12" CIBW_BUILD=cp312-musllinux_x86_64 cibuildwheel --platform=linux --output-dir wheelhouse --archs x86_64
on my M2 ARM MacBook.