Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Python import error libpq.so.5:

#44

Submitted by: Giuseppe Tofoni

Good Morning

I have the following problem with psycopg2-2.3.2:

python 2.6.4 (r264:75706, Dec 5 2009, 21:18:28)
[GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import psycopg2 Traceback (most recent call last):
File "", line 1, in File "/usr/lib/python2.6/site-packages/psycopg2/init.py", line 69, in

from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID

ImportError: libpq.so.5: cannot open shared object file: No such file or directory

My dir postgresql (vers. 9.0.3)
/usr/local/pgsql

My setup.cfg
pg_config=/usr/local/pgsql/bin/pg_config

there were no errors in installation.

I linked /usr/local/pgsql/libpq.so.5 in /usr/lib and everything is fine.

Is that correct?

Thanks for you help and advice.

Reported by Psycopg website · February 21st, 2011 @ 11:24 AM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo

    The buildbot tests the lib the same way (postgres compiled in /usr/local/somewhere) so I expect it to work.

    Please try with a "make clean", "make" in the psycopg dir. Take a look if the compiler log shows the expected path (e.g. -I/usr/local/pgsql/include/ instead of /usr/include). Also take a look if ldd psycopg2/_psycopg.so links to the correct lib.

    What is the output of "pg_config --libdir --includedir" using your pg_config?

    February 21st, 2011 @ 11:41 AM

  2. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from new to invalid

    You should probably add your non-standard library to the LD_LIBRARY_PATH to allow the linker to find it:

    $ ldd /home/piro/src/psycopg2/build/lib.2.6/psycopg2/_psycopg.so | grep libpq
            libpq.so.5 => not found
    $ LD_LIBRARY_PATH=/usr/local/pgsql/lib ldd /home/piro/src/psycopg2/build/lib.2.6/psycopg2/_psycopg.so | grep libpq
            libpq.so.5 => /usr/local/pgsql/lib/libpq.so.5 (0x00007f1fac1b1000)
    

    February 21st, 2011 @ 12:03 PM