Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Debian 12, Pillow 10: thumbnailer.py throws "AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' " #15914

Closed
peters77 opened this issue Jul 10, 2023 · 1 comment

Comments

@peters77
Copy link

Description

Get no thumbnails from whatsapp bridged groups in synapse.

Steps to reproduce

  • installed debian 12
  • installed latest synapse
  • installed mautrix bridge
  • whatsapp groups media doesnät show up in element

Homeserver

matrix.hcpeters.de

Synapse Version

"1.87.0"

Installation Method

Other (please mention below)

Database

Postgres

Workers

Single process

Platform

Debian 12, Linux, download synapse package .zip form GIT site

Configuration

No response

Relevant log output

File "/opt/synapse/env/lib/python3.11/site-packages/synapse/http/server.py", line 319, in _async_render_wrapper
    callback_return = await self._async_render(request)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/http/server.py", line 349, in _async_render
    callback_return = await raw_callback_return
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/rest/media/thumbnail_resource.py", line 99, in _async_render_GET
    await self._respond_remote_thumbnail(
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/rest/media/thumbnail_resource.py", line 278, in _respond_remote_thumbnail
    media_info = await self.media_repo.get_remote_media_info(server_name, media_id)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/media/media_repository.py", line 330, in get_remote_media_info
    responder, media_info = await self._get_remote_media_impl(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/media/media_repository.py", line 404, in _get_remote_media_impl
    await self._generate_thumbnails(
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/media/media_repository.py", line 797, in _generate_thumbnails
    t_byte_source = await defer_to_thread(
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/twisted/python/threadpool.py", line 244, in inContext
    result = inContext.theWork()  # type: ignore[attr-defined]
             ^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/twisted/python/threadpool.py", line 260, in <lambda>
    inContext.theWork = lambda: context.call(  # type: ignore[attr-defined]
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/twisted/python/context.py", line 117, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/twisted/python/context.py", line 82, in callWithContext
    return func(*args, **kw)
           ^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/logging/context.py", line 969, in g
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/media/thumbnailer.py", line 172, in crop
    with self._resize(scaled_width, scaled_height) as scaled_image:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/synapse/env/lib/python3.11/site-packages/synapse/media/thumbnailer.py", line 134, in _resize
    return self.image.resize((width, height), Image.ANTIALIAS)
                                              ^^^^^^^^^^^^^^^
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Anything else that would be useful to know?

No response

@DMRobertson
Copy link
Contributor

Thanks for reporting; this looks like a duplicate of #15873.

You'll need to downgrade the version of pillow that's present in the environment you're running synapse in, as e.g. here. The specifics of how to do this will depend on your installation; if you have trouble, it's probably best to ask in the Synapse Admins room (sign up for an account on the Matrix.org homeserver if needed).

@DMRobertson DMRobertson closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants