============================================================
ubuntu-python-easy_install-pil-does-not-install-zlib-support
============================================================


ubuntu-python-easy_install-pil-does-not-install-zlib-support
============================================================

Ubuntu Python easy_install PIL does not install zlib or png support
===================================================================

I was getting the following error even though the zlib dev libraries
were already installed correctly.

.. code-block:: python

+--------------------------------------------------------------------+
| PIL 1.1.7 SETUP SUMMARY                                            |
+====================================================================+
| version 1.1.7 platform linux2 2.7.1+ (r271:86832, Apr 11 2011,     |
| 18:13:53) [GCC 4.5.2]                                              |
+--------------------------------------------------------------------+

\**\* TKINTER support not available \**\* JPEG support not available
\**\* ZLIB (PNG/ZIP) support not available \**\* FREETYPE2 support not
available \**\* LITTLECMS support not available ——————————————————————–
To add a missing option, make sure you have the required library, and
set the corresponding ROOT variable in the setup.py script.

Apparently PIL setup.py doesn’t know how to find libz.so.

PIL expects libz.so to be located in **/usr/lib** not
**/usr/lib/i386-linux-gnu/libz.so**

I fixed this issue by building a link to were PIL setup.py looks and
where the library really exists!

How to fix
----------

1. **Find the location of your systems libz.so**

.. code-block:: bash

::

   find . -name libz.so

2. **Create a soft link from libz.so to /usr/lib**

   Ubuntu 32bit:

   .. code-block:: bash

   sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib

   Ubuntu 64bit:

   .. code-block:: bash

   sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib

Notes
-----

You might need to delete the PIL egg from your pythons site-packages
directory and attempt to re-install the package

ubuntu
------

.. code-block:: bash

sudo apt-get build-dep python-imaging
