473,324 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

psycopg2 error

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
2 6154
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
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

May 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: mvanier | last post by:
There was a thread a while back dealing with an error message the psycopg2 Postgres interface gives when trying to convert some mxDateTime values: "can't adapt". The answer given was that psycopg2...
2
by: Luis P. Mendes | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I've inserted a couple hundred rows in a table in Postgres via psycopg2. The first field of each row is a certain unix time (since epoch)...
0
by: Sandro Dentella | last post by:
Hi all, while building an applycation in pygtk I noticed that psycopg2 returns the floats rouded (eg: 4.123 -> 4.0). This turns out to be a problem of psycopg2 (psycopg behaves correctly) when...
1
by: Maxim Sloyko | last post by:
Hello, clp and all people reading it! Recently I was porting my (small) app from psycopg to psycopg2 (they got me with this "2"). I read, that psycopg2 supports all features of psycopg and plus...
2
by: Jon Clements | last post by:
Hi All. I'm using psycopg2 to retrieve results from a rather large query (it returns 22m records); unsurprisingly this doesn't fit in memory all at once. What I'd like to achieve is something...
0
by: David Michael Schruth, | last post by:
Hi, I am sort of in a jam here. I am using the PsycoPG2 library to read data out of a windows XP based PostGIS / PostGreSQL database but I am apparently unable to write (update or insert) even...
1
by: George Sakkis | last post by:
I have a simple DB table that stores md5 signature pairs: Table "public.duplicate" Column | Type | Modifiers ----------+-------+----------- sig | bytea | not null orig_sig | bytea | not...
0
by: RossGK | last post by:
I've been using pydev for a short while successfully, and Django with postgresql as well. psycopg2 is part of that behind the scenes I would imagine, to make django work. Now I'm trying to use...
5
by: Thomas Guettler | last post by:
Hi, I discovered this: import psycopg2 connection=psycopg2.connect("dbname='...' user='...'") cursor=connection.cursor() cursor.execute('''SELECT '%' ''') # Does not fail...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.