% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifPDFTeX
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math} % this also loads fontspec
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
\usepackage{lmodern}
\ifPDFTeX\else
  % xetex/luatex font selection
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifLuaTeX
  \usepackage{selnolig}  % disable illegal ligatures
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\urlstyle{same}
\hypersetup{
  pdftitle={ubuntu-python-easy\_install-pil-does-not-install-zlib-support},
  hidelinks,
  pdfcreator={LaTeX via pandoc}}

\title{ubuntu-python-easy\_install-pil-does-not-install-zlib-support}
\author{}
\date{}

\begin{document}
\maketitle

\hypertarget{ubuntu-python-easy_install-pil-does-not-install-zlib-support}{%
\section{ubuntu-python-easy\_install-pil-does-not-install-zlib-support}\label{ubuntu-python-easy_install-pil-does-not-install-zlib-support}}

\hypertarget{ubuntu-python-easy_install-pil-does-not-install-zlib-or-png-support}{%
\section{Ubuntu Python easy\_install PIL does not install zlib or png
support}\label{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

\begin{longtable}[]{@{}
  >{\raggedright\arraybackslash}p{(\columnwidth - 0\tabcolsep) * \real{0.9583}}@{}}
\toprule\noalign{}
\begin{minipage}[b]{\linewidth}\raggedright
PIL 1.1.7 SETUP SUMMARY
\end{minipage} \\
\midrule\noalign{}
\endhead
\bottomrule\noalign{}
\endlastfoot
version 1.1.7 platform linux2 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
{[}GCC 4.5.2{]} \\
\end{longtable}

*** 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 \textbf{/usr/lib} not
\textbf{/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!

\hypertarget{how-to-fix}{%
\subsection{How to fix}\label{how-to-fix}}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\tightlist
\item
  \textbf{Find the location of your systems libz.so}
\end{enumerate}

.. code-block:: bash

\begin{verbatim}
find . -name libz.so
\end{verbatim}

\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{1}
\item
  \textbf{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
\end{enumerate}

\hypertarget{notes}{%
\subsection{Notes}\label{notes}}

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

\hypertarget{ubuntu}{%
\subsection{ubuntu}\label{ubuntu}}

.. code-block:: bash

sudo apt-get build-dep python-imaging

\end{document}
