Re: libpython - cannot open shared object file - Mailing list pgsql-novice
From | Tom Wilcox |
---|---|
Subject | Re: libpython - cannot open shared object file |
Date | |
Msg-id | 4C20EA5E.8060901@gmail.com Whole thread Raw |
Responses |
Re: [GENERAL] libpython - cannot open shared object file
|
List | pgsql-novice |
Hi,
Can anyone help me get up and running on Ubuntu 64-bit Server (lucid) OS with PostgreSQL 64-bit and Python 2.6?
(Please note that this is all running in a VirtualBox VM however I am not convinced that is relevant here)
I have a load of functions written in plpythonu and I can't run anything until they are able to run. Please help.. I have been through set up using the Ubuntu Software Manager (postgresql, postgresql-8.4, plpython for postgresql-8.4,..), I have tried using sudo apt-get install postgresql-8.4, I have downloaded and installed using the 64-bit linux binary from postgresql.com.
In all cases, I have started the server from "su postgres" in bash.. it happily runs and pgadmin3 can connect. I successfully create my plpythonu and pgsql functions then I attempt to use them in a simple SELECT statement (see below) and the resulting error occurs:
--------------
DROP LANGUAGE IF EXISTS plpythonu CASCADE;
CREATE LANGUAGE plpythonu;
CREATE OR REPLACE FUNCTION min_float(a float, b float) RETURNS float AS $$
return min(a,b);
$$ LANGUAGE plpythonu;
SELECT min_float(1,2);
--------------
ERROR: could not load library "/opt/PostgreSQL/8.4/lib/postgresql/plpython.so": libpython2.3.so.1.0: cannot open shared object file: No such file or directory
----------------
I don't know enough to know where to start with this..
I have python2.6 installed. The following find command results:
root@ubuntu64-bertha:/opt/PostgreSQL/8.4/lib# find /* -name libpython*
find: ‘/media/windows-share/System Volume Information’: Operation not permitted
/opt/PostgreSQL/8.4/lib/postgresql/libpython2.6.so.1
/usr/lib/gnome-vfs-2.0/modules/libpythonmethod.so
/usr/lib/gnome-vfs-2.0/modules/libpythonmethod-2.6.so
/usr/lib/python2.6/config/libpython2.6.so
/usr/lib/libpython2.6.so.1
/usr/lib/libpython2.6.so.1.0
/usr/lib/gedit-2/plugin-loaders/libpythonloader.so
/usr/share/doc/libpython2.6
/usr/share/lintian/overrides/libpython2.6
/var/lib/dpkg/info/libpython2.6.symbols
/var/lib/dpkg/info/libpython2.6.shlibs
/var/lib/dpkg/info/libpython2.6.md5sums
/var/lib/dpkg/info/libpython2.6.postrm
/var/lib/dpkg/info/libpython2.6.postinst
/var/lib/dpkg/info/libpython2.6.list
I tried creating a symbolic link that points to the libpython2.6 like so:
root@ubuntu64-bertha:/opt/PostgreSQL/8.4/lib# ln -s ./postgresql/libpython2.6.so.1 libpython2.3.so.1.0
but then it gave me this error instead:
ERROR: could not load library "/opt/PostgreSQL/8.4/lib/postgresql/plpython.so": /opt/PostgreSQL/8.4/lib/postgresql/plpython.so: undefined symbol: Py_InitModule4
SQL state: 58P01
So I presume it was expecting a different python version..(I have now removed that symbolic link so I am back to my original error).
I am losing this battle badly and I am desperately running out of time. Please can anyone help me or suggest anything I can try to sort this out and get plpython running my functions in postgresql on this linux OS.
Please help me!
Tom
On 16/06/2010 15:02, Tom Wilcox wrote:
Can anyone help me get up and running on Ubuntu 64-bit Server (lucid) OS with PostgreSQL 64-bit and Python 2.6?
(Please note that this is all running in a VirtualBox VM however I am not convinced that is relevant here)
I have a load of functions written in plpythonu and I can't run anything until they are able to run. Please help.. I have been through set up using the Ubuntu Software Manager (postgresql, postgresql-8.4, plpython for postgresql-8.4,..), I have tried using sudo apt-get install postgresql-8.4, I have downloaded and installed using the 64-bit linux binary from postgresql.com.
In all cases, I have started the server from "su postgres" in bash.. it happily runs and pgadmin3 can connect. I successfully create my plpythonu and pgsql functions then I attempt to use them in a simple SELECT statement (see below) and the resulting error occurs:
--------------
DROP LANGUAGE IF EXISTS plpythonu CASCADE;
CREATE LANGUAGE plpythonu;
CREATE OR REPLACE FUNCTION min_float(a float, b float) RETURNS float AS $$
return min(a,b);
$$ LANGUAGE plpythonu;
SELECT min_float(1,2);
--------------
ERROR: could not load library "/opt/PostgreSQL/8.4/lib/postgresql/plpython.so": libpython2.3.so.1.0: cannot open shared object file: No such file or directory
----------------
I don't know enough to know where to start with this..
I have python2.6 installed. The following find command results:
root@ubuntu64-bertha:/opt/PostgreSQL/8.4/lib# find /* -name libpython*
find: ‘/media/windows-share/System Volume Information’: Operation not permitted
/opt/PostgreSQL/8.4/lib/postgresql/libpython2.6.so.1
/usr/lib/gnome-vfs-2.0/modules/libpythonmethod.so
/usr/lib/gnome-vfs-2.0/modules/libpythonmethod-2.6.so
/usr/lib/python2.6/config/libpython2.6.so
/usr/lib/libpython2.6.so.1
/usr/lib/libpython2.6.so.1.0
/usr/lib/gedit-2/plugin-loaders/libpythonloader.so
/usr/share/doc/libpython2.6
/usr/share/lintian/overrides/libpython2.6
/var/lib/dpkg/info/libpython2.6.symbols
/var/lib/dpkg/info/libpython2.6.shlibs
/var/lib/dpkg/info/libpython2.6.md5sums
/var/lib/dpkg/info/libpython2.6.postrm
/var/lib/dpkg/info/libpython2.6.postinst
/var/lib/dpkg/info/libpython2.6.list
I tried creating a symbolic link that points to the libpython2.6 like so:
root@ubuntu64-bertha:/opt/PostgreSQL/8.4/lib# ln -s ./postgresql/libpython2.6.so.1 libpython2.3.so.1.0
but then it gave me this error instead:
ERROR: could not load library "/opt/PostgreSQL/8.4/lib/postgresql/plpython.so": /opt/PostgreSQL/8.4/lib/postgresql/plpython.so: undefined symbol: Py_InitModule4
SQL state: 58P01
So I presume it was expecting a different python version..(I have now removed that symbolic link so I am back to my original error).
I am losing this battle badly and I am desperately running out of time. Please can anyone help me or suggest anything I can try to sort this out and get plpython running my functions in postgresql on this linux OS.
Please help me!
Tom
On 16/06/2010 15:02, Tom Wilcox wrote:
Interesting:
This works:
postgres@ubuntu64-bertha:~$ createlang -d cse plpythonu
Password:
postgres@ubuntu64-bertha:~$
But this doesn't:
postgres@ubuntu64-bertha:~$ psql -c "CREATE LANGUAGE plpythonu"
Password:
ERROR: could not load library "/opt/PostgreSQL/8.4/lib/postgresql/plpython.so": libpython2.3.so.1.0: cannot open shared object file: No such file or directory
Any suggestions? Feels like I'm not with the correct env vars in psql but TBH Im getting somewhat dazed and confused from staring at this too long..
TOn 16 June 2010 14:58, Tom Wilcox <hungrytom@gmail.com> wrote:Hi,
I have got PostgreSQL 8.4 up and running on my Ubuntu Server 64-bit OS, but I am having difficulty with the PL/Python functions from my database. In particular, I am running this:
-------------------------------------------------------
drop language plpythonu cascade;
create language plpythonu;
-- Utility
CREATE OR REPLACE FUNCTION min_float(a float, b float) RETURNS float AS $$
return min(a,b);
$$ LANGUAGE plpythonu;
SELECT min_float(1,2);
-------------------------------------------------------
And receiving this error message:
-------------------------------------------------------
NOTICE: drop cascades to function min_float(double precision,double precision)
ERROR: could not load library "/opt/PostgreSQL/8.4/lib/postgresql/plpython.so": libpython2.3.so.1.0: cannot open shared object file: No such file or directory
********** Error **********
ERROR: could not load library "/opt/PostgreSQL/8.4/lib/postgresql/plpython.so": libpython2.3.so.1.0: cannot open shared object file: No such file or directory
SQL state: 58P01
-------------------------------------------------------
The strange thing is that I have successfully created plpythonu language and the PLPythonu function(s). I was originally having difficulty getting PL/Python to install and it was throwing a similar error. However, this everntually went away once I added the PostgreSQL root install dir to the PATH variable (in my .bashrc and .bash_profile). I have both Python26 and Python31 installed (both came with ubuntu I believe).
I am not sure that I have put my PATH and LD_LIBRARY_PATH settings into the correct .bash_profile and .bashrc files so that PgAdmin3 and psql (being opened by other users) will have the correct settings.
Any ideas/help much appreciated?
Thanks,
Tom
pgsql-novice by date: