Re: Unable to import psycopg2 on OS X (dynamic lookup)

Jan UrbaƄski <[email protected]> Sun, 23 May 2010 19:47:05 +0200
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 21/05/10 21:11, Eduard Carreras i Nadal wrote:
> Hi,
> I've read the mailing list archives and I've seen other responses, one of them said that installing python from source works, but it don't for me.
> 
> The module compiles without any error.
> 
>>>> import psycopg2
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/Users/eduard/Projects/openerp-env/lib/python2.6/site-packages/psycopg2/__init__.py", line 69, in <module>
>     from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
> ImportError: dlopen(/Users/eduard/Projects/openerp-env/lib/python2.6/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
>   Referenced from: /Users/eduard/Projects/openerp-env/lib/python2.6/site-packages/psycopg2/_psycopg.so
>   Expected in: dynamic lookup
> 

Hi,

the first few google hits for this are:

http://benkreeger.com/post/312303245/conquering-symbol-not-found-pqbackendpid

http://favosdream.blogspot.com/2009/09/make-psycopg2-and-readline-work-in-snow.html

but in general this error means that _psycopg.so is linking with the
wrong libpq library, which would suggest that you compiled it against a
local build of PostgreSQL, but have not put the libraries of that local
PostgreSQL build in your library path.

Jan