MinimalCompact / thumbor

The quickest way to run thumbor.
MIT License
274 stars 85 forks source link

module 'PIL.Image' has no attribute 'Resampling' #158

Open toto4ds opened 2 weeks ago

toto4ds commented 2 weeks ago

Hi,

I tried 7.7.1-simd-avx2 and 7.7.1-simd-sse4 and get this error:

thumbor  |   File "/usr/local/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute
thumbor  |     result = await result
thumbor  |              ^^^^^^^^^^^^
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/handlers/imaging.py", line 119, in get
thumbor  |     return await self.check_image(kw)
thumbor  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/handlers/imaging.py", line 116, in check_image
thumbor  |     return await self.execute_image_operations()
thumbor  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/handlers/__init__.py", line 205, in execute_image_operations
thumbor  |     await self.get_image()
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/handlers/__init__.py", line 305, in get_image
thumbor  |     await self.context.transformer.transform()
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/transformer.py", line 38, in transform
thumbor  |     await self.do_image_operations()
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/transformer.py", line 218, in do_image_operations
thumbor  |     await self.context.thread_pool.queue(
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/threadpool.py", line 53, in queue
thumbor  |     return await self._execute_in_foreground(operation, *args)
thumbor  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/threadpool.py", line 45, in _execute_in_foreground
thumbor  |     return operation(*args)
thumbor  |            ^^^^^^^^^^^^^^^^
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/transformer.py", line 237, in img_operation_worker
thumbor  |     self.fit_in_resize()
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/transformer.py", line 422, in fit_in_resize
thumbor  |     self.engine.resize(resize_width, resize_height)
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/engines/pil.py", line 214, in resize
thumbor  |     resample = self.get_resize_filter()
thumbor  |                ^^^^^^^^^^^^^^^^^^^^^^^^
thumbor  |   File "/usr/local/lib/python3.11/site-packages/thumbor/engines/pil.py", line 174, in get_resize_filter
thumbor  |     "LANCZOS": Image.Resampling.LANCZOS,
thumbor  |                ^^^^^^^^^^^^^^^^
thumbor  |   File "/usr/local/lib/python3.11/site-packages/PIL/Image.py", line 65, in __getattr__
thumbor  |     raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
thumbor  | AttributeError: module 'PIL.Image' has no attribute 'Resampling'

Version 7.7.1 works fine My CPU supports these flags

gingerlime commented 2 weeks ago

Can you create a reproducible example? e.g. with docker-compose? might be worth checking with upstream Thumbor or Pillow-SIMD for instructions on how to install the latest version.