mod_wsgi compile error: missing Python development package?

If you’re seeing an error like this when trying to compile mod_wsgi, it’s likely that you don’t have the Python development package installed. Solution: apt-get install python-dev

Turns out, a lot of things can go wrong when you try to compile mod_wsgi, and I spent a good chunk of time before finding it out here. I hope that by posting this here, I would save others the headache. The last few lines of the error was quite misleading, imho. But like they all say, in hindsight, everything’s 20/20

root@jaysern:/usr/local/mod_wsgi-2.5# make > error
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
/usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-pic -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/include/python2.6 -DNDEBUG -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
mod_wsgi.c:113:20: error: Python.h: No such file or directory
mod_wsgi.c:114:21: error: compile.h: No such file or directory
mod_wsgi.c:115:18: error: node.h: No such file or directory

*** snip ***

mod_wsgi.c:11684: error: expected expression before ')' token
mod_wsgi.c:11691: error: expected ';' before 'ap_log_rerror'
mod_wsgi.c:11696: error: expected ';' before '}' token
mod_wsgi.c:11710: error: expected expression before 'module'
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
root@jaysern:/usr/local/mod_wsgi-2.5#

Tags: , , ,

  • ramo1

    thank you a lot. I couldn't find why I have that error and none of the websites where helping.

  • http://jayliew.com jayliew
  • http://jayliew.com jayliew

    Glad I could help :)

  • Pingback: My dev box reloaded! Lucid Lynx 10.04 LTS « The Sunjay Times

  • David

    Hey, 

    Thanks for the help. Your solution didn't work for me but it led me in the right direction. I had to use “yum install python-devel” instead.

  • http://jayliew.com jayliew

    thanks for sharing! I'm sure that will help others :)