Problem installing psycopg2 in virtualenv (Ubuntu 10.04, Python 2.5)

Pascal Polleunus ppo at
Mon Oct 4 23:33:39 CEST 2010


I've problems to install psycopg2 in a virtualenv on Ubuntu 10.04.

My problem is also explained on stackoverflow:

I tried different things explained there:

The last thing I tried is this...
I created a virtualenv with -p python2.5 --no-site-packages
I installed libpq-dev: apt-get install libpq-dev

In the virtualenv, I did this: easy_install -i egenix-mx-base

Then when I tried pip install psycopg2==2.0.7, I got this error:

Installing collected packages: psycopg2
Running install for psycopg2
building 'psycopg2._psycopg' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall 
-DPSYCOPG_VERSION="2.2.2 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404 
-DHAVE_PQPROTOCOL3=1 -I/usr/include/python2.5 -I. 
-I/usr/include/postgresql -I/usr/include/postgresql/8.4/server -c 
psycopg/psycopgmodule.c -o 
psycopg/psycopgmodule.c:27:20: error: Python.h: No such file or directory
In file included from psycopg/psycopgmodule.c:31:
./psycopg/python.h:31:26: error: structmember.h: No such file or directory
./psycopg/python.h:34:4: error: #error "psycopg requires Python >= 2.4"
In file included from psycopg/psycopgmodule.c:32:

Does anyone have any idea how to solve that?

Thanks in advance,

More information about the Python-list mailing list