fix(build): ship libwebpdemux2 so pi3 Pillow can save WebP - #3042
Merged
Conversation
The upload image-normalisation pipeline converts HEIC/HEIF/TIFF/etc. to lossless WebP via Pillow. On 32-bit Pi (armv7) there's no Pillow wheel, so it's compiled from source against libwebp-dev and dynamically links the whole webp family at runtime: libwebp7, libwebpmux3 *and* libwebpdemux2 (Pillow's _webp uses WebPAnimDecoder). The runtime image only pulled libwebp7 + libwebpmux3 — both transitive deps of ffmpeg's libavcodec — but NOT libwebpdemux2, which nothing else depends on. Without it, ``import PIL._webp`` fails to resolve libwebpdemux.so.2, the WebP plugin registers no save handler, and the conversion dies with ``KeyError: 'WEBP'`` (Sentry ANTHIAS-1Y, 11 events, all pi3). Add libwebp7 / libwebpdemux2 / libwebpmux3 to the runtime base_apt_dependencies explicitly so the pipeline never depends on ffmpeg's transitive graph — same rationale as the libheif1 entry beside them. Inert on 64-bit boards (their Pillow wheel bundles its own webp libs), so listed unconditionally for simplicity, matching libheif1. Verified: a from-source Pillow 12.2.0 _webp.so on debian:trixie links libwebp.so.7, libwebpmux.so.3, libwebpdemux.so.2 and libsharpyuv.so.0; installing ffmpeg+libheif1 leaves libwebpdemux2 absent. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
There was a problem hiding this comment.
Pull request overview
This PR fixes runtime WebP support for Pillow on 32-bit Raspberry Pi (armv7) by ensuring the Anthias runtime image includes the full set of required libwebp shared libraries (including libwebpdemux.so.2), preventing PIL._webp import/link failures that lead to KeyError: 'WEBP' during image normalization.
Changes:
- Add explicit runtime APT deps for Pillow WebP support:
libwebp7,libwebpdemux2,libwebpmux3. - Document why these are needed (armv7 builds Pillow from source; ffmpeg does not pull
libwebpdemux2transitively).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



What
The upload image-normalisation pipeline converts HEIC/HEIF/TIFF/etc. to lossless WebP via Pillow. On 32-bit Pi (armv7) there's no Pillow wheel, so it's compiled from source against
libwebp-devand dynamically links the whole webp family at runtime.The runtime image only carried
libwebp7+libwebpmux3(both transitive deps offfmpeg'slibavcodec) — but notlibwebpdemux2, which nothing else pulls. Without it,import PIL._webpcan't resolvelibwebpdemux.so.2, the WebP plugin registers no save handler, and the conversion dies withKeyError: 'WEBP'(Sentry ANTHIAS-1Y, 11 events, allpi3).Fix
Add
libwebp7/libwebpdemux2/libwebpmux3to the runtimebase_apt_dependenciesexplicitly so the pipeline never depends on ffmpeg's transitive graph — same rationale as thelibheif1entry beside them. Inert on 64-bit boards (their Pillow wheel bundles its own webp libs), so listed unconditionally for simplicity, matchinglibheif1.Verification
On
debian:trixie, a from-sourcePillow==12.2.0_webp.solinks:Installing only
ffmpeg+libheif1(runtime parity) leaveslibwebpdemux2absent while the other three are present — exactly the failure signature. GeneratedDockerfile.serverforpi3now installs all three at runtime alongsidelibheif1.🤖 Generated with Claude Code