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

zlib requirement on Alpine Linux #1763

mattchen opened this Issue Mar 8, 2016 · 9 comments


None yet
7 participants

mattchen commented Mar 8, 2016

hey, I was trying to install Pillow on Alpine Linux 3.3 official docker container by "pip install pillow", but I get this error:

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

I have installed all the zlib library as I know, zlib-dev, libzip-dev by "apk add", and I checked /usr/include/libzip.h, which is 1.2.8, I'm not sure if there's something wrong with the library file or filename.

UPDATE: After I copied /lib/ and /lib/libz.a to /usr/lib/ (which is installed by default), the installation has finished successfully. Guess /lib/ should be in the library check list?


This comment has been minimized.


wiredfool commented Mar 8, 2016

The library it's looking for is zlib and zlib.h. libzip is something else (zip archives).

It looks like we're not actually looking in /lib on linux machines since most of the distros have shifted to multiarch library paths. It's certainly possible to add it by setting the environment variables C_INCLUDE_PATH/CPATH/INCLUDE and LD_RUN_PATH/LIBRARY_PATH/LIB.

(It's also possible that one of those paths has been added from the python config, which may be why /usr/lib works on Alpine)

And as an aside, that error should have been `'%s is required unless explicitly disabled using --disable-%s, aborting', but the feature name is spelled incorrectly.


This comment has been minimized.

ghost commented Apr 1, 2016

@wiredfool Thanks. I was having the same problem building a docker image, but was able to get it to build by putting these lines above any pip install statements in my Dockerfile:

RUN apk add build-base python-dev py-pip jpeg-dev zlib-dev
ENV LIBRARY_PATH=/lib:/usr/lib

This comment has been minimized.


wiredfool commented Apr 4, 2016

Where does Alpine store the headers? It's got to be somewhere pretty standard or it wouldn't build.

@radarhere radarhere added the Linux label Apr 5, 2016


This comment has been minimized.

ghost commented Apr 7, 2016

The official zlib-dev package in Alpine has the headers stored in /lib/. See the package contents here:


This comment has been minimized.


wiredfool commented Apr 8, 2016

Thanks, that page was down when I was checking originally, Looks like /usr/include (already checked by defaultt), with the libraries in /lib.


This comment has been minimized.

blaggacao commented May 29, 2016

You oftentimes want to keep docker layers flat, or don't want to clutter env with some temporary variables. So you would need to pack those environment declaration somewhere inline. For future googlers, here is how it goes:

LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "pip install -r /requirements.txt"

Note: you need to call pip via a new shell to have the variable take effect.


This comment has been minimized.

prologic commented May 30, 2016

Out of curiosity is anyone building and publishing wheels for Pillow for the Alpine Docker platform?


This comment has been minimized.

lyssdod commented Sep 11, 2018

@prologic I'm planning to do this for pandas and few other packages, please join discussion at pypa/manylinux#37

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