Python Pillow 3 with Alpine Linux

Using Alpine Linux as a base for Docker images does have some implications and odd bugs. Trying to get Taiga (Backend) running with Alpine Linux I stumbled upon the following error log:

ValueError: --enable-zlib requested but zlib not found, aborting.

Even explicitly installing zlib (as required) does not help getting rid of the issue:

apk add --no-cache zlib zlib-dev

To get it working / recognizing the system’s zlib you need to

  • extend the CFLAGS environmental variable
CFLAGS="$CFLAGS -L/lib"
  • or create a softlink for the zlib library before executing the Pillow installation:
ln -s /lib/libz.so /usr/lib/

Further References: