Work around cibuildwheel failures for Linux that are a byproduct of Pillow version 11.3.0 released on 2025-07-01 #830
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Python package Pillow is required by Matplotlib, which is a transitive dependency for qsim due to its requirement by cirq-core. Matplotlib does not pin the required version of Pillow (which is fine, and actually makes it possible to work around the current problem possible – see below). Unfortunately, as a result of changes introduced in Pillow version 11.3.0, our cibuildwheel runs are now failing for Linux because:
Ours is not the only project suddenly facing this problem today (c.f. python-pillow/Pillow#9057).
In our case, the problem only manifests during the "Testing wheel …" phase on Linux. I tried many ways of passing pip constraints, but couldn't find a way to make the constraints take effect during the wheel-testing phase. Finally, the following approach worked: pip-install a version of Pillow < 11.3 using the
before-test
option of cibuildwheel, so that when cibuildwheel does its pip-install of the qsimcirq package that it built, the Pillow dependency is satisfied. This works because the requirement of Pillow in Matplotlib does not require 11.3; it just requires a version higher than 9, which our pre-installation of Pillow satisfies.This should be a temporary workaround only. We should update qsim to use cibuildwheel 3 and manylinux_2_28 – this problem may go away at that point.