views:

329

answers:

2

Hi there.

I have a bit of a problem and don't know where to look for answers, hopefully someone has come across it.

I have PIL(Python imaging library installed)

when I run python

import PIL
import Image
import _imaging

I don't get errors. however running my app raises _imaging C module not installed

+1  A: 

Managed to solve this issue.

Please refer to the following link

http://appelfreelance.com/2010/06/libjpeg-pil-snow-leopard-python2-6-_jpeg_resync_to_restart/

ApPeL
A: 

Hi ApPeL, I posted this response on the link that you sent (thank you for that), but figured I'd post on source as well. Sorry for the dupe post.

I was hoping that there was a way to do this without recompiling stuff. I happen to be using virtualenv. I did find that if I blew away my virtual env install and then reinstall with pip, the Imaging started to work again. These steps seemed to work (note, I’m using OSX)

Not sure if this mattered, but checking to see if jpeg is installed

winesap:~ $ port installed | grep -i jpeg
  jpeg @7_0
  jpeg @8a_0 (active)

Make sure I have PIP installed

sudo port -v install py26-pip

Remove the old virtual environment I had and recreate it

rm -rf ve
virtualenv –no-site-packages –distribute ve
. ./ve/bin/activate

Install pil and django into the virtualenv

echo “pil” > requirements.pip
echo “django” >> requirements.pip
pip-2.6 install -E ./ve/ -r requirements.pip

Test to see if the import works now. Note lack of obnoxious C module error

python
>>import import ImageFont 
>>

Hope this is useful.

Joe J
Yeah no problem, mine was solely based on just pure apache mod_wsgi django and python
ApPeL