views:

950

answers:

4

I'm trying to run a webapp/site on my machine, it's running on OSX 10.6.2 and I'm having some problems:

Caught an exeption while rending: The _imagingft C module is not installed

Doing import _imagingft in python gives me this:

>>> import _imagingft
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: dlopen(/Library/Python/2.6/site-packages/PIL/_imagingft.so,
2): Symbol not found: _FT_Done_Face
 Referenced from: /Library/Python/2.6/site-packages/PIL/_imagingft.so
 Expected in: flat namespace
 in /Library/Python/2.6/site-packages/PIL/_imagingft.so

It's seems that the Freetype library is the one having problems. No errors so far when installing PIL or when I compiled(?) the jpeg and freetype libraries so far.

I'm on django 1.1.1, python 2.6.2.

+1  A: 

With errors like those it's usually because one of PIL dependencies were not compiled to be universal binary.

Try this:

  1. Download the framework for Freetype at this website
  2. Download the package for libjpeg8 at this website
  3. Remove the files that you originally installed for libjpeg and freetype
  4. Install the new packages
  5. Delete your build folder for PIL
  6. Re-build and install PIL

But if you want to try compiling universal binary first, be my guest. My specific issue was actually with libjpeg, and no matter how I compiled it, PIL was barfing on import _imaging. So I opted for packaged versions. I don't think libjpeg or freetype specifically benefit from compiling them yourself.

libjpeg8 package installs to /usr/local/lib

freetype package installs to your /Library/Frameworks folder.

jonwd7
+1  A: 

I've had this problem as well. Couldn't resolve it with PIL 1.1.6 nor with PIL 1.1.7. I installed py26-pil from ports and presto, it works.

sudo port install py26-pil

If you don't have ports, go to http://www.macports.org/

miha
A: 

The environment is not set up correctly to build the OS X PIL\libjpeg binaries using easy_install. This guide should help http://fightingrabbits.com/archives/266 - It's for installing Python/Django but goes through the necessary PIL setup first and works for me on 10.6.x

Frozenskys
+1  A: 

I found the solution for this.

First you need to download Freetype2 http://freetype.sourceforge.net/index2.html and compile it with these instructions http://www.libgd.org/DOC_INSTALL_OSX#Building_freetype2 then you go and compile libjpeg and PIL http://fightingrabbits.com/archives/266

And that's it.

Abe