2

I run my test sites on my home computer which sadly uses Windows. Now, i'm trying to thumbnail an image but i'm getting the error:

The _imaging C module is not installed

But only when i try to access the view via the Apache server. Runserver thumbnails just fine. I've installed the special precomplied binaries that others have referenced, but haven't had any luck.

Any Idea why it works in runserver/shell but not Apache?

leech
  • 8,293
  • 7
  • 62
  • 78
  • If anyone else runs into this problem, where your webserver can't load the _imaging.pyd module... but your shell and runserver can. If you are trying to thumbnail like i was there is a simple solution (and maybe better for performance anyway) -- Pre-render the thumbnails on the shell. – leech Jun 19 '11 at 00:47
  • 1
    Yes. I found the solution: http://stackoverflow.com/questions/5352968/trouble-using-pil-in-django-app-on-windows – trd Aug 22 '11 at 07:06

3 Answers3

0

1.you should check _imaging.pyc or _imaging.dll or _imaging.so in you computer.

2.Exist!now, try to import Image

3.Right!try to import _imaging

if error, checking you computer is 32bit or 64bit.

if you computer is 32bit ,you should install some package like PIL-1.1.7.win32-py2.5 http://effbot.org/downloads/PIL-1.1.7.win32-py2.5.exe

if you computer is 64bit, you should install some package like PIL-1.1.7.win-amd64-py2.5 and you can found here:http://www.lfd.uci.edu/~gohlke/pythonlibs/

4.install the right package on site-packeges,it's will be running

GOOD LUCK!

tdolydong
  • 838
  • 6
  • 8
0

You need to have the path to PIL in and the other site-packages in your path in your .wsgi configuration file. So first you need to find the location of your site-packages (for example: /usr/local/lib/python2.6/site-packages/), then add it to your sys.path in your .wsgi file. Example WSGI:

import os, sys
sys.path.append('/home/www/sites/mysite', '/usr/local/lib/python2.6/site-packages/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi

application = django.core.handlers.wsgi.WSGIHandler()
fijter
  • 17,607
  • 2
  • 25
  • 28
  • Yep, paths are set, everything else in site-packages is getting loaded nicely (like mysql). just not that _imaging.pyd, i even put the DLLs folder in the path, no happy :( – leech Jun 18 '11 at 21:12
0

I had the same problem under mod_wsgi on apache on windows server 2008. PIL would load from my virtualenv just fine, but would not load under mod_wsgi, even with the right version of msvcr90.dll in the folder with the .pyd files.

The answer for me has to do with WINDOWS SXS HELL and a patch that planders created.

I had to edit my distutils\msvc9compiler.py and comment out one line (I'm using Python 2.7, he was using 2.6.x), delete the build folder and rebuild PIL, and everything worked.

http://groups.google.com/group/isapi_wsgi-dev/browse_thread/thread/03fa2b485ec2281d?pli=1

I don't know who he is, but I am very grateful.

boatcoder
  • 17,525
  • 18
  • 114
  • 178