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@xxxxxxxxx
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general