psycopg2 error

Discussion in 'Python' started by Luis P. Mendes, May 8, 2007.

  1. Hi,

    I've installed psycopg2 under Slacware 11.0 along with PostgreSQL 8.2.4.

    When I run the python shell I get the following error: lupe@lince ~$
    python
    Python 2.4.3 (#1, Jul 26 2006, 20:13:39) [GCC 3.4.6] on linux2 Type
    "help", "copyright", "credits" or "license" for more information.
    >>> import psycopg2

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    File "/usr/lib/python2.4/site-packages/psycopg2/__init__.py", line 60,
    in ?
    from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
    ImportError: libpq.so.5: cannot open shared object file: No such file or
    directory

    The strange thing is that under root and postgres users, there is no
    error. postgres@lince ~$ python
    Python 2.4.3 (#1, Jul 26 2006, 20:13:39) [GCC 3.4.6] on linux2 Type
    "help", "copyright", "credits" or "license" for more information.
    >>> import psycopg2
    >>>
    >>>

    libpq files are readable by the world: root@lince pgsql # ll lib/ -d
    drwxr-xr-x 3 postgres postgres 1528 2007-05-07 23:25 lib/

    root@lince lib # ll libpq*
    -rw-r--r-- 1 postgres postgres 155858 2007-05-07 23:25 libpq.a lrwxrwxrwx
    1 postgres postgres 12 2007-05-07 23:25 libpq.so -> libpq.so.5.0
    lrwxrwxrwx 1 postgres postgres 12 2007-05-07 23:25 libpq.so.5 ->
    libpq.so.5.0 -rwxr-xr-x 1 postgres postgres 126496 2007-05-07 23:25
    libpq.so.5.0

    The postgreSQL lib is in ld.so.conf and ldconfig has been run: # cat
    /etc/ld.so.conf
    /usr/local/lib
    /usr/X11R6/lib
    /usr/i486-slackware-linux/lib
    /opt/kde/lib
    /usr/lib/qt/lib
    /usr/local/pgsql/lib

    What is wrong?


    Luis
    Luis P. Mendes, May 8, 2007
    #1
    1. Advertising

  2. > ImportError: libpq.so.5: cannot open shared object file: No such file or
    > directory
    >
    > libpq files are readable by the world: root@lince pgsql # ll lib/ -d
    > drwxr-xr-x 3 postgres postgres 1528 2007-05-07 23:25 lib/


    Don't try this as the root user, but as the one for whom it is failing:
    What does "file /usr/local/psql/lib/libpq.so.5" say?

    > The postgreSQL lib is in ld.so.conf and ldconfig has been run:
    >
    > What is wrong?


    So what does "/sbin/ldconfig -p" say, when run as the user for whom
    it is failing?

    Regards,
    Martin
    =?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?=, May 9, 2007
    #2
    1. Advertising

  3. Hello Martin,

    Em Wed, 09 May 2007 06:17:09 +0200, Martin v. Löwis escreveu:
    >> ImportError: libpq.so.5: cannot open shared object file: No such file or
    >> directory
    >>
    >> libpq files are readable by the world: root@lince pgsql # ll lib/ -d
    >> drwxr-xr-x 3 postgres postgres 1528 2007-05-07 23:25 lib/

    >
    > Don't try this as the root user, but as the one for whom it is failing:
    > What does "file /usr/local/psql/lib/libpq.so.5" say?

    The problem was that I couldn't issue this command. Permissions were set
    incorrectly:
    $ ll /usr/local/pg* -d
    drwxr-x--- 10 postgres postgres 712 2007-05-08 20:43 /usr/local/pgsql

    Once corrected to:
    $ ll /usr/local/pg* -d
    drwxr-xr-x 10 postgres postgres 712 2007-05-08 20:43 /usr/local/pgsql

    I can import psycopg2 fine.

    Thank you for your help!

    Best regards,

    Luis
    Luis P. Mendes, May 9, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luis P. Mendes
    Replies:
    3
    Views:
    371
    Lie Ryan
    Jun 21, 2009
  2. 一首诗
    Replies:
    0
    Views:
    491
    一首诗
    Oct 13, 2009
  3. knobbyknees
    Replies:
    1
    Views:
    1,456
    Philip Semanchuk
    Mar 28, 2010
  4. ASh
    Replies:
    10
    Views:
    2,415
    Anton Shishkov
    Mar 31, 2010
  5. mrdrew
    Replies:
    5
    Views:
    2,715
    Dennis Lee Bieber
    Apr 5, 2010
Loading...

Share This Page