-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Use cibuildwheel #7552
Use cibuildwheel #7552
Conversation
859aded
to
ad7fee5
Compare
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
9102c1d
to
3bf2414
Compare
3bf2414
to
0204e70
Compare
This is looking good, thanks! Comparing the zip generated before with this PR: The sdist covered above. We're also building PyPy 3.8 wheels in addition to PyPy 3.9-3.10, I think it's because cibuildwheel by default looks at our CIBW_SKIP: pp38-* The macOS Intel wheels are built for 10.9 here instead of 10.10 before. I don't think this matters? |
Hmm, installing a wheel for this Apple Silicon Mac: Gives an error on import: Python 3.11.5 (v3.11.5:cce6ba91b3, Aug 24 2023, 10:50:31) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1 │
│ │
│ /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/PIL/Image.py:82 │
│ in <module> │
│ │
│ 79 │ # import Image and use the Image.core variable instead. │
│ 80 │ # Also note that Image.core is not a publicly documented interface, │
│ 81 │ # and should be considered private and subject to change. │
│ ❱ 82 │ from . import _imaging as core │
│ 83 │ │
│ 84 │ if __version__ != getattr(core, "PILLOW_VERSION", None): │
│ 85 │ │ msg = ( │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/PIL/_imaging.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace
'_jpeg_resync_to_restart' Renaming this wheel and the equivalent |
A quick inspection of Intel Mac, manylinux, and musllinux wheels, they look like they have everything. |
CIBW_BUILD: ${{ matrix.build }} | ||
CIBW_CONFIG_SETTINGS: raqm=enable raqm=vendor fribidi=vendor | ||
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux }} | ||
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While arm64 wheels can be built on x86_64, they cannot be tested. The ability to test the arm64 wheels will be added in a future release of cibuildwheel, once Apple Silicon CI runners are widely available. To silence this warning, set
CIBW_TEST_SKIP: *-macosx_arm64
.
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }} | |
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }} | |
CIBW_TEST_SKIP: *-macosx_arm64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I've added a commit for this. Testing, I found that it required quotes, as per https://cibuildwheel.readthedocs.io/en/stable/options/#test-skip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've created a PR to fix this upstream: pypa/cibuildwheel#1665
e487a0f
to
e013ad9
Compare
Taking a look, I found that #6179 had a problem when I accidentally reverted it to 10.9 once before, so I've pushed a commit to restore 10.10. |
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Thanks for the update. Now we get the same filenames before and after: also the sdist, and 10_10 files instead of 10_9. 👍 However, I'm still getting this for ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/PIL/_imaging.cpython-311-darwin.so, 0x0002): symbol not found in flat namespace
'_jpeg_resync_to_restart' We still seem to be missing |
On an Intel Mac, |
Ok, the macOS arm64 wheels should be better now. |
Thanks! I tested the cp38 to cp312 macOS arm64 wheels and they all passed a simple install/ The wheels contain the same files as before: I'll test the Intel ones later. I note they now contain libjpeg and libzstd dylib files that they didn't have before: It would be good if anyone can help test out some manylinux and musllinux wheels: go to https://github.com/python-pillow/Pillow/actions/runs/6901285566?pr=7552 and download the "dist" artifact, and |
I can see that the libzstd dylib has different permissions (
All of the musllinux wheels pass tests in the corresponding |
✅ Working on Intel macOS with Python 3.8-3.12 with: #!/usr/bin/env bash
for VARIABLE in 8 9 10 11 12
do
python3.$VARIABLE -m pip install -U pip
python3.$VARIABLE -m pip uninstall -y pillow
python3.$VARIABLE -m pip install pillow-10.2.0.dev0-cp3$VARIABLE-cp3$VARIABLE-macosx_10_10_x86_64.whl
python3.$VARIABLE 1.py
done from PIL import Image
im = Image.new("RGB", (10, 20), "red")
im.show() |
fdf18f5
to
07c216c
Compare
Ok, I've pushed a commit to remove it again, like it was before this PR. |
✅ Looking good testing with #7552 (comment) on both Intel and Apple Silicon for all versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
pillow has started using [cibuildwheel](https://github.com/pypa/cibuildwheel) - python-pillow/Pillow#7552 This moved the script for building wheel dependencies from `wheels/config.sh`, a more natural location for [multibuild](https://github.com/multi-build/multibuild), to just under GitHub Actions instead, at [.github/workflows/wheel-dependencies.sh](https://github.com/python-pillow/Pillow/blob/main/.github/workflows/wheels-dependencies.sh) It also now includes `wheels/multibuild/library_builders.sh` [by itself](https://github.com/python-pillow/Pillow/blob/e2ddd27500cdd4c8156bc0d5fe0bfa050408c707/.github/workflows/wheels-dependencies.sh#L10), and rearranged the code to run immediately, instead of needing `pre_build` to be called separately. cc @hugovk Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
Helps #7390.
It has been suggested that we move from multibuild to cibuildwheel.
Looking at cibuildwheel though, it doesn't have multibuild's library builders to build our dependencies.
So this PR employs a hybrid approach, using multibuild to build the dependencies first, and then cibuildwheel to build the wheels.
It seems to me that the primary advantage of cibuildwheel is speed, in that the dependencies are built less, and re-used by different Python environments.