pythonpython-3.xpython-imaging-librarylibjpeglibjpeg-turbo

Upgrading pillow from version 8.3.2-> 9.1.1


I am upgrading pillow from version 8.3.2 to 9.1.1. A little confused by the release notes. version 9.0.0 and above are built against libjpeg-turbo. Does it mean we must have libjpeg-turbo installed on our servers as well? or is it fine to stick with libjpeg-dev package we have.


Solution

  • The binary wheels for Pillow are statically compiled against the basic format libraries, as evident from compiled for libjpeg-turbo 2.1.3 being present in the slimmest Python container:

    ~ $ docker run -it python:3.10-slim-bullseye bash
    root@4fb371115880:/# pip install -q Pillow
    root@4fb371115880:/# python -c 'from PIL.features import pilinfo; pilinfo()'
    --------------------------------------------------------------------
    Pillow 9.1.1
    Python 3.10.5 (main, Jun  7 2022, 18:49:47) [GCC 10.2.1 20210110]
    --------------------------------------------------------------------
    Python modules loaded from /usr/local/lib/python3.10/site-packages/PIL
    Binary modules loaded from /usr/local/lib/python3.10/site-packages/PIL
    --------------------------------------------------------------------
    --- PIL CORE support ok, compiled for 9.1.1
    *** TKINTER support not installed
    --- FREETYPE2 support ok, loaded 2.12.1
    --- LITTLECMS2 support ok, loaded 2.13.1
    --- WEBP support ok, loaded 1.2.2
    --- WEBP Transparency support ok
    --- WEBPMUX support ok
    --- WEBP Animation support ok
    --- JPEG support ok, compiled for libjpeg-turbo 2.1.3
    --- OPENJPEG (JPEG2000) support ok, loaded 2.5.0
    --- ZLIB (PNG/ZIP) support ok, loaded 1.2.11
    --- LIBTIFF support ok, loaded 4.3.0
    *** RAQM (Bidirectional Text) support not installed
    *** LIBIMAGEQUANT (Quantization method) support not installed
    --- XCB (X protocol) support ok
    

    In other words, no, you don't need to install libjpeg-turbo (or libjpeg, even) separately if you don't compile Pillow yourself.