By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,767 Members | 2,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,767 IT Pros & Developers. It's quick & easy.

psycopg2 error

P: n/a
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
May 8 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
May 9 '07 #2

P: n/a
Hello Martin,

Em Wed, 09 May 2007 06:17:09 +0200, Martin v. Lwis 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

May 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.