This project is archived and is in readonly mode.

#44 ✓invalid
Psycopg website

Python import error libpq.so.5:

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

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.

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo February 21st, 2011 @ 11:41 AM

    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?

  • Daniele Varrazzo

    Daniele Varrazzo February 21st, 2011 @ 12:03 PM

    • 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)
    

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

People watching this ticket

Tags

Pages