Ubuntu, Postgres, and psycopg2.

3,122 views
Skip to first unread message

Nigel Legg

unread,
Oct 17, 2013, 4:51:09 AM10/17/13
to django...@googlegroups.com
I am not sure whether this is really a postgres issue or a python / Django issue - please let me know if I should be posting this elsewhere.
I have installed Ubuntu 13.04, Postgres 9.1 and Django. (strangely, the Ubuntu software centre says I have Python 3.3, but when I go into the Python shell it says 2.7.4). 
I followed the instructions on configuring Postgres from http://blog.iiilx.com/programming/how-to-install-postgres-on-ubuntu-for-django/, up to the point of adding a line to the pg_hba.conf file - Ubuntu would not let me write to this.
When I tried to install psycopg2 (pip install psycopg2),  I got the following error:

ERROR: you need to install postgresql-server-dev-X.Y for building a server side extension or libpq-dev for building a client-side application.

What does this mean?  How do I proceed?

Many thanks in advance for your help.

Thomas Orozco

unread,
Oct 17, 2013, 4:57:53 AM10/17/13
to django...@googlegroups.com
You need the Postgres client C headers to build psycopg2. Before running pip install psycopg2, run:

sudo apt-get install libpq-dev




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3b3fa90f-7602-40ff-ab79-55d70c3074f1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Nigel Legg

unread,
Oct 17, 2013, 5:31:22 AM10/17/13
to django...@googlegroups.com
Thanks Thomas, that worked, so some progress, but now when I do sudo pip psycopg2, I get an error: Python.h not found -
In file included from psycopg/psycopgmodule.c:27:0:
./psycopg/psycopg.h:30:20: fatal error: Python.h: no such file or directory.
Should I be downloading and building the source?

Cheers, Nigel
07914 740972



Thomas Orozco

unread,
Oct 17, 2013, 5:43:08 AM10/17/13
to django...@googlegroups.com
You're missing:

sudo apt-get install python-dev


Matthias Müller

unread,
Oct 17, 2013, 5:45:26 AM10/17/13
to django...@googlegroups.com, nigel...@gmail.com
You need the python header as well:

sudo apt-get install python-dev

-- 
Viele Grüße / Best Regards
Matthias Müller


2013/10/17 Nigel Legg <nigel...@gmail.com>
Reply all
Reply to author
Forward
0 new messages