Skip to content
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

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #396

Open
jukefr opened this issue Jul 12, 2023 · 1 comment
Open

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #396

jukefr opened this issue Jul 12, 2023 · 1 comment

Comments

@jukefr
Copy link

jukefr commented Jul 12, 2023

Describe the bug

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

Suspecting the wrong version of Pillow is getting installed for some reason.
Here you can see new version 1c36215#diff-1268f00633c5bf56c0f92e476d2d15adfd7dcebba9c727f8e8cffcdbeeb041a7L29 which deprecates ANTILIAS function however for some reason the running synapse version seems to depend on a call to it?
Not sure if this is a bug in upstream synapse or if something wrong with the selected dependency version in the ynh wrapper for some reason.

Context

  • Hardware: NA
  • YunoHost version: latest
  • I have access to my server: NA
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: no

Steps to reproduce

  • Have latest matrix-synapse installed
  • Try to update profile picture of account

Expected behavior

The version of pillow should either be supported by the codebase (so under 10) or the codebase should be recent enough to support pillow 10? Not exactly sure what went wrong again if upstream or wrapper dependency version got set wrong for some resaon.

Logs

  - Jul 12 21:55:01 python[1822]: 2023-07-12 21:55:01,187 - synapse.http.server - 133 - ERROR - POST-23998- Failed handle request via 'UploadResource': <XForwardedForRequest at 0x7f65e41970 method='POST' uri='/_matrix/media/r0/upload?filename=IMG_7786.png' clientproto='HTTP/1.0' site='8008'>
  - Jul 12 21:55:01 python[1822]: Traceback (most recent call last):
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/http/server.py", line 319, in _async_render_wrapper
  - Jul 12 21:55:01 python[1822]:     callback_return = await self._async_render(request)
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/http/server.py", line 349, in _async_render
  - Jul 12 21:55:01 python[1822]:     callback_return = await raw_callback_return
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/rest/media/upload_resource.py", line 95, in _async_render_POST
  - Jul 12 21:55:01 python[1822]:     content_uri = await self.media_repo.create_content(
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/media/media_repository.py", line 215, in create_content
  - Jul 12 21:55:01 python[1822]:     await self._generate_thumbnails(None, media_id, media_id, media_type)
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/media/media_repository.py", line 797, in _generate_thumbnails
  - Jul 12 21:55:01 python[1822]:     t_byte_source = await defer_to_thread(
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/twisted/python/threadpool.py", line 244, in inContext
  - Jul 12 21:55:01 python[1822]:     result = inContext.theWork()  # type: ignore[attr-defined]
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/twisted/python/threadpool.py", line 260, in <lambda>
  - Jul 12 21:55:01 python[1822]:     inContext.theWork = lambda: context.call(  # type: ignore[attr-defined]
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/twisted/python/context.py", line 117, in callWithContext
  - Jul 12 21:55:01 python[1822]:     return self.currentContext().callWithContext(ctx, func, *args, **kw)
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/twisted/python/context.py", line 82, in callWithContext
  - Jul 12 21:55:01 python[1822]:     return func(*args, **kw)
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/logging/context.py", line 969, in g
  - Jul 12 21:55:01 python[1822]:     return f(*args, **kwargs)
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/media/thumbnailer.py", line 172, in crop
  - Jul 12 21:55:01 python[1822]:     with self._resize(scaled_width, scaled_height) as scaled_image:
  - Jul 12 21:55:01 python[1822]:   File "/opt/yunohost/matrix-synapse/lib/python3.9/site-packages/synapse/media/thumbnailer.py", line 134, in _resize
  - Jul 12 21:55:01 python[1822]:     return self.image.resize((width, height), Image.ANTIALIAS)
  - Jul 12 21:55:01 python[1822]: AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
@Josue-T
Copy link

Josue-T commented Jul 13, 2023

Hello,
It's an upstream issue which will be fixed on the next release.
For now you can fix the issue by this command:

/opt/yunohost/matrix-synapse/bin/pip install 'Pillow<=9.5.0-2'
systemctl restart matrix-synapse.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants