Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Compiling with libimagequant dependency

Open r-ef opened this issue 3 years ago • 7 comments

After trying to compile pillow with libimagequant dependency enabled, i still get the same error. IMG_9923 IMG_9922

r-ef avatar Dec 02 '23 12:12 r-ef

Please can you paste the full traceback as text?

hugovk avatar Dec 02 '23 12:12 hugovk

The user also posted these images in Gitter, with the text

im trying to compile pillow with libimagequant but everytime i try to quantize with Quantize.LIBIMAGEQUANT method i get an error.

What operating system are you using? What library are you using that is emitting the "Uhandled error when trying to build the pallete"? Are you able to post a complete example of the code that you're running?

radarhere avatar Dec 02 '23 21:12 radarhere

Please can you paste the full traceback as text?

Traceback (most recent call last):
  File "/root/MiaBot/.venv/lib/python3.11/site-packages/jishaku/features/python.py", line 190, in jsk_python
    async for send, result in AsyncSender(executor):  # type: ignore
  File "/root/MiaBot/.venv/lib/python3.11/site-packages/jishaku/functools.py", line 124, in _internal
    value = await base.asend(self.send_value)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/MiaBot/.venv/lib/python3.11/site-packages/jishaku/repl/compilation.py", line 214, in traverse
    yield await func_a(*self.args)
          ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<repl>", line 5, in _repl_coroutine
    img.quantize(10, method=Image.Quantize.LIBIMAGEQUANT, dither=0)
  File "/root/MiaBot/.venv/lib/python3.11/site-packages/PIL/Image.py", line 1167, in quantize
    im = self._new(self.im.quantize(colors, method, kmeans))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: dependency required by this method was not enabled at compile time

r-ef avatar Dec 03 '23 08:12 r-ef

The user also posted these images in Gitter, with the text

im trying to compile pillow with libimagequant but everytime i try to quantize with Quantize.LIBIMAGEQUANT method i get an error.

What operating system are you using? What library are you using that is emitting the "Uhandled error when trying to build the pallete"? Are you able to post a complete example of the code that you're running?

Im using ubuntu Ubuntu 20.04.6 LTS x86_64

from PIL import Image
buf=io!.BytesIO(await author.avatar.read())
with Image.open(buf) as img:
  img.quantize(10, method=Image.Quantize.LIBIMAGEQUANT, dither=0)

r-ef avatar Dec 03 '23 08:12 r-ef

Have you tried uninstalling Pillow, checking that it is not installed by seeing that it fails to import, and then tried installing again?

radarhere avatar Dec 03 '23 09:12 radarhere

When I try python3 -m pip install --upgrade Pillow -C imagequant=enable --no-cache-dir on my macOS machine, it still uses the precompiled wheel.

Try adding --no-binary :all: as another argument to the command.

radarhere avatar Dec 03 '23 11:12 radarhere

python3 -m pip install --upgrade Pillow -C imagequant=enable --no-cache-dir

yes that worked, thank you :)

r-ef avatar Dec 04 '23 08:12 r-ef