Thread: Re: libpython - cannot open shared object file
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..
T
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..
T
On 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
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
On 06/22/2010 09:52 AM, Tom Wilcox wrote: > 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 > <http://libpythonmethod-2.6.so> > /usr/lib/python2.6/config/libpython2.6.so <http://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 > To start narrowing this down. What installation of Postgres are you running now(you mention several)? It seems pl/python is compiled against Python 2.3. Have you been running Python 2.3? -- Adrian Klaver adrian.klaver@gmail.com
Adrian Klaver <adrian.klaver@gmail.com> writes: > On 06/22/2010 09:52 AM, Tom Wilcox wrote: >> 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 have python2.6 installed. > It seems pl/python is compiled against Python 2.3. Have you been running > Python 2.3? Yeah. You need to either install python 2.3, or rebuild postgresql against python 2.6. Shortcuts like making symlinks are not likely to work. regards, tom lane
Hi, I have not used python2.3 on this machine at all (to my knowledge). It is a fresh install of the latest Ubuntu 64 which comes with Python 2.6 and 3.1. The build I want to run is the 64-bit PostgreSQL download for Linux x86-64 from Entreprise DB (http://www.enterprisedb.com/products/pgdownload.do) as I don't know how else to ensure that the build I am installing is a 64-bit version of PostgreSQL (I want to use >4GB of RAM in one session). Is the best way to ensure compatibility for me to build from source? Cheers, Tom On 23/06/2010 03:14, Tom Lane wrote: > Adrian Klaver<adrian.klaver@gmail.com> writes: > >> On 06/22/2010 09:52 AM, Tom Wilcox wrote: >> >>> 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 have python2.6 installed. >>> > >> It seems pl/python is compiled against Python 2.3. Have you been running >> Python 2.3? >> > Yeah. You need to either install python 2.3, or rebuild postgresql > against python 2.6. Shortcuts like making symlinks are not likely to > work. > > regards, tom lane >
On Wed, Jun 23, 2010 at 9:52 AM, Tom Wilcox <hungrytom@gmail.com> wrote: > Hi, > > I have not used python2.3 on this machine at all (to my knowledge). It is a > fresh install of the latest Ubuntu 64 which comes with Python 2.6 and 3.1. > > The build I want to run is the 64-bit PostgreSQL download for Linux x86-64 > from Entreprise DB (http://www.enterprisedb.com/products/pgdownload.do) as I > don't know how else to ensure that the build I am installing is a 64-bit > version of PostgreSQL (I want to use >4GB of RAM in one session). > > Is the best way to ensure compatibility for me to build from source? If you want it to use the version of Python installed with your OS, then you should just use the OS packages. The installer needs to run on a wide variety of distros, so is built on a much older platform which happens to have Python 2.3. FYI, the 9.0 installers are being built against ActiveState's Perl, Python and TCL distros, so it will be easier to use those PLs in the future. -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com The Enterprise Postgres Company
Hi, If I use the apt-get facility on Ubuntu is that supposed to get the appropriate postgres version for my OS setup (i.e. 64-bit and Python 2.6) ? Because I think I have done that already and it didn't solve my problem, but I will try again now (first uninstalling the current pg version). T On 23/06/2010 10:01, Dave Page wrote: > On Wed, Jun 23, 2010 at 9:52 AM, Tom Wilcox<hungrytom@gmail.com> wrote: > >> Hi, >> >> I have not used python2.3 on this machine at all (to my knowledge). It is a >> fresh install of the latest Ubuntu 64 which comes with Python 2.6 and 3.1. >> >> The build I want to run is the 64-bit PostgreSQL download for Linux x86-64 >> from Entreprise DB (http://www.enterprisedb.com/products/pgdownload.do) as I >> don't know how else to ensure that the build I am installing is a 64-bit >> version of PostgreSQL (I want to use>4GB of RAM in one session). >> >> Is the best way to ensure compatibility for me to build from source? >> > If you want it to use the version of Python installed with your OS, > then you should just use the OS packages. The installer needs to run > on a wide variety of distros, so is built on a much older platform > which happens to have Python 2.3. > > FYI, the 9.0 installers are being built against ActiveState's Perl, > Python and TCL distros, so it will be easier to use those PLs in the > future. > >
On Wed, Jun 23, 2010 at 10:19 AM, Tom Wilcox <hungrytom@gmail.com> wrote: > Hi, > > If I use the apt-get facility on Ubuntu is that supposed to get the > appropriate postgres version for my OS setup (i.e. 64-bit and Python 2.6) ? I would assume so. I'm more of a Redhat guy though. -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com The Enterprise Postgres Company
On Wed, Jun 23, 2010 at 11:20, Dave Page <dpage@pgadmin.org> wrote: > On Wed, Jun 23, 2010 at 10:19 AM, Tom Wilcox <hungrytom@gmail.com> wrote: >> Hi, >> >> If I use the apt-get facility on Ubuntu is that supposed to get the >> appropriate postgres version for my OS setup (i.e. 64-bit and Python 2.6) ? > > I would assume so. I'm more of a Redhat guy though. It will - depending on your ubuntu version, of course. (Meaning if you're on an old version of ubuntu you'll get an old version of pg - but youll get one compiled against the system you're on). If you do get an old version, there are usually backports available of the newer versions. -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
OK! I have successfully got plpythonu installed. The solution was to remove any and all postgresql installation and files except /data. I then ran this from command line: sudo apt-get install postgresql-plpython-8.4 which installed plpython AND postgresql at the same time. Happy days. Next problem: "$libdir/fuzzystrmatch": No such file or directory. I guess I need to install the /share stuff separately.. Any ideas where can get this stuff from? (I am using the TSearch2 and fuzzy string functions). On 23/06/2010 10:32, Magnus Hagander wrote: > On Wed, Jun 23, 2010 at 11:20, Dave Page<dpage@pgadmin.org> wrote: > >> On Wed, Jun 23, 2010 at 10:19 AM, Tom Wilcox<hungrytom@gmail.com> wrote: >> >>> Hi, >>> >>> If I use the apt-get facility on Ubuntu is that supposed to get the >>> appropriate postgres version for my OS setup (i.e. 64-bit and Python 2.6) ? >>> >> I would assume so. I'm more of a Redhat guy though. >> > It will - depending on your ubuntu version, of course. (Meaning if > you're on an old version of ubuntu you'll get an old version of pg - > but youll get one compiled against the system you're on). If you do > get an old version, there are usually backports available of the newer > versions. > >
Tom Wilcox <hungrytom@gmail.com> writes: > Next problem: "$libdir/fuzzystrmatch": No such file or directory. I guess I > need to install the /share stuff separately.. Looks like apt-get install postgresql-contrib-8.4 should do the trick. http://packages.debian.org/lenny-backports/postgresql-contrib-8.4 Regards, -- dim