Python: The _imagingft C module is not installed

On Ubuntu, you need to have libfreetype-dev installed before compiling PIL.

i.e.

$ sudo apt-get install libfreetype6-dev
$ sudo -s
\# pip uninstall pil
\# pip install --no-cache-dir pil

PS! Running pip install as sudo will usually install packages to /usr/local/lib on most Ubuntu versions. You may consider to install Pil in a virtual environment (virtualenv or venv) in a path owned by the user instead.

You may also consider installing pillow instead of pil, which I believe is API compatible: https://python-pillow.org. Note that Pillow also requires libfreetype-dev and you might need to follow the same uninstall/install steps if libfreetype-dev was not present during the initial installation.

Leave a Comment