I'm trying to push a django app to the production server, but for some reason it fails and says:
ImportError: The _imaging C module is not installed
The weird part is that when I use the development server on the same machine, it works just fine. PIL is installed, and I can import the _imaging module by hand in the shell. The production server uses Apache. Any ideas?
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 111, in get_response response = callback(request, *callback_args, **callback_kwargs)
File "C:/portal2\compliance\views.py", line 91, in show_statement doc.build(Story, onFirstPage=firstPage, onLaterPages=otherPage)
File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 1117, in build BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 877, in build self.clean_hanging()
File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 510, in clean_hanging self.handle_flowable(self._hanging)
File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 757, in handle_flowable f.apply(self)
File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 140, in apply getattr(doc,arn)(*args)
File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 1093, in handle_pageBegin self._handle_pageBegin()
File "C:\Python27\lib\site-packages\reportlab\platypus\doctemplate.py", line 535, in handle_pageBegin self.pageTemplate.onPage(self.canv,self)
File "C:/portal2\compliance\views.py", line 55, in firstPage canvas.drawImage(img,0,0,8.5*inch,11*inch)
File "C:\Python27\lib\site-packages\reportlab\pdfgen\canvas.py", line 857, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask)
File "C:\Python27\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 2094, in init self.loadImageFromA85(src)
File "C:\Python27\lib\site-packages\reportlab\pdfbase\pdfdoc.py", line 2100, in loadImageFromA85 imagedata = map(string.strip,pdfutils.makeA85Image(source,IMG=IMG))
File "C:\Python27\lib\site-packages\reportlab\pdfbase\pdfutils.py", line 34, in makeA85Image raw = img.getRGBData()
File "C:\Python27\lib\site-packages\reportlab\lib\utils.py", line 658, in getRGBData annotateException('\nidentity=%s'%self.identity())
File "C:\Python27\lib\site-packages\reportlab\lib\utils.py", line 655, in getRGBData self._data = im.tostring()
File "C:\Python27\lib\site-packages\PIL\Image.py", line 532, in tostring self.load()
File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 164, in load self.load_prepare()
File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 231, in load_prepare self.im = Image.core.new(self.mode, self.size)
File "C:\Python27\lib\site-packages\PIL\Image.py", line 37, in getattr raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed identity=[ImageReader@0x4517a30 filename='C:\portal2\pdf\Certification_fullframe.tif'] handle_pageBegin args=()
Found the answer!
Trouble using PIL in Django app on Windows
I had to install a version of PIL that was precompiled to work with mod-wsgi.