Thread: Installing plpython3u

Installing plpython3u

From
Dario Beraldi
Date:
Hello,

I'm having problems installing plpython3u, this is my situation:
I have installed postgresql-9.3.5 in my home directory, from source. I used (from my memory, it might not be exact)

./configure --prefix=$HOME;
make;
make install

Now I need to upload a database which requires plpython3u, and this is what happens:

pg_restore -U berald01 -d sblab -h localhost -1 current_pg_sblab.backup.tar

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1590; 2612 24721 PROCEDURAL LANGUAGE plpython3u dberaldi
pg_restore: [archiver (db)] could not execute query: ERROR:  could not access file "$libdir/plpython3": No such file or directory
    Command was: CREATE OR REPLACE PROCEDURAL LANGUAGE plpython3u;

If I try to create plpython3u I get:

createlang plpython3u sblab
createlang: language installation failed: ERROR:  could not open extension control file "/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control": No such file or directory

I'm a bit at a loss, how do I add plpython3u?

My OS is CentOS release 6.

Thanks!
Dario

Re: Installing plpython3u

From
Adrian Klaver
Date:
On 10/15/2015 03:21 AM, Dario Beraldi wrote:
> Hello,
>
> I'm having problems installing plpython3u, this is my situation:
> I have installed postgresql-9.3.5 in my home directory, from source. I
> used (from my memory, it might not be exact)
>
> ./configure --prefix=$HOME;
> make;
> make install
>
> Now I need to upload a database which requires plpython3u, and this is
> what happens:
>
> pg_restore -U berald01 -d sblab -h localhost -1 current_pg_sblab.backup.tar
>
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 1590; 2612 24721
> PROCEDURAL LANGUAGE plpython3u dberaldi
> pg_restore: [archiver (db)] could not execute query: ERROR:  could not
> access file "$libdir/plpython3": No such file or directory
>      Command was: CREATE OR REPLACE PROCEDURAL LANGUAGE plpython3u;
>
> If I try to create plpython3u I get:
>
> createlang plpython3u sblab
> createlang: language installation failed: ERROR:  could not open
> extension control file
> "/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control":
> No such file or directory
>
> I'm a bit at a loss, how do I add plpython3u?

See here:

http://www.postgresql.org/docs/9.3/interactive/plpython-python23.html

"Tip: The built variant depends on which Python version was found during
the installation or which version was explicitly set using the PYTHON
environment variable; see Section 15.4. To make both variants of
PL/Python available in one installation, the source tree has to be
configured and built twice."

>
> My OS is CentOS release 6.
>
> Thanks!
> Dario


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Installing plpython3u

From
Dario Beraldi
Date:
Hi Adrian,

Thanks for your answer. Just checking before I screw things up... About "the source tree has to be configured and built twice", does it mean that I have to execute again

./configure --prefix=$HOME;
make;
make install

And should I enable any particular option in ./configure? I see there is a "--with-python" option (not specific to python3 though). If it matters, my python 3 is in /usr/local/bin/python3.

On 15 October 2015 at 14:20, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 10/15/2015 03:21 AM, Dario Beraldi wrote:
Hello,

I'm having problems installing plpython3u, this is my situation:
I have installed postgresql-9.3.5 in my home directory, from source. I
used (from my memory, it might not be exact)

./configure --prefix=$HOME;
make;
make install

Now I need to upload a database which requires plpython3u, and this is
what happens:

pg_restore -U berald01 -d sblab -h localhost -1 current_pg_sblab.backup.tar

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1590; 2612 24721
PROCEDURAL LANGUAGE plpython3u dberaldi
pg_restore: [archiver (db)] could not execute query: ERROR:  could not
access file "$libdir/plpython3": No such file or directory
     Command was: CREATE OR REPLACE PROCEDURAL LANGUAGE plpython3u;

If I try to create plpython3u I get:

createlang plpython3u sblab
createlang: language installation failed: ERROR:  could not open
extension control file
"/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control":
No such file or directory

I'm a bit at a loss, how do I add plpython3u?

See here:

http://www.postgresql.org/docs/9.3/interactive/plpython-python23.html

"Tip: The built variant depends on which Python version was found during the installation or which version was explicitly set using the PYTHON environment variable; see Section 15.4. To make both variants of PL/Python available in one installation, the source tree has to be configured and built twice."


My OS is CentOS release 6.

Thanks!
Dario


--
Adrian Klaver
adrian.klaver@aklaver.com

Re: Installing plpython3u

From
Tom Lane
Date:
Dario Beraldi <dario.beraldi@gmail.com> writes:
> Thanks for your answer. Just checking before I screw things up... About
> "the source tree has to be configured and built twice", does it mean that I
> have to execute again

> ./configure --prefix=$HOME;
> make;
> make install

> And should I enable any particular option in ./configure? I see there is a
> "--with-python" option (not specific to python3 though).

Indeed --- you have not built any version of plpython here.  You need
--with-python, and you need to make sure the PYTHON environment variable
is set (else you'll get whatever version is invoked by "python", which is
most likely python2).  See the build instructions in the documentation.
Also watch the output from configure, which will show you which python
it selected.

            regards, tom lane


Re: Installing plpython3u

From
Dario Beraldi
Date:
On 15 October 2015 at 14:46, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Dario Beraldi <dario.beraldi@gmail.com> writes:
> Thanks for your answer. Just checking before I screw things up... About
> "the source tree has to be configured and built twice", does it mean that I
> have to execute again

> ./configure --prefix=$HOME;
> make;
> make install

> And should I enable any particular option in ./configure? I see there is a
> "--with-python" option (not specific to python3 though).

Indeed --- you have not built any version of plpython here.  You need
--with-python, and you need to make sure the PYTHON environment variable
is set (else you'll get whatever version is invoked by "python", which is
most likely python2).  See the build instructions in the documentation.
Also watch the output from configure, which will show you which python
it selected.

                        regards, tom lane

Sorry guys... I executed

./configure --prefix=$HOME --with-python PYTHON=/usr/local/bin/python3
make
make install

and it completed fine (see also below output from 'grep -i 'PYTHON' config.log'). Still after restarting postgres I get:

createlang plpython3u sblab
ERROR:  could not open extension control file "/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control": No such file or directory
STATEMENT:  CREATE EXTENSION "plpython3u";

## From config.log
grep -i 'PYTHON' config.log

  $ ./configure --prefix=/Users/berald01 --with-python PYTHON=/usr/local/bin/python3
PATH: /opt/rh/python27/root/usr/bin
configure:5399: checking whether to build Python modules
configure:7499: checking for python
configure:7529: result: /usr/local/bin/python3
configure:7544: checking for Python distutils module
configure:7557: checking Python configuration directory
configure:7562: result: /usr/local/lib/python3.4/config-3.4m
configure:7565: checking Python include directories
configure:7575: result: -I/usr/local/include/python3.4m
configure:7580: checking how to link an embedded Python application
configure:7607: result: -L/usr/local/lib/python3.4/config-3.4m -lpython3.4m -lpthread -ldl  -lutil -lm
configure:7612: checking whether Python is compiled with thread support
configure:29636: checking Python.h usability
configure:29653: gcc -c -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -I/usr/local/include/python3.4m  -D_GNU_SOURCE  conftest.c >&5
configure:29678: checking Python.h presence
configure:29693: gcc -E -I/usr/local/include/python3.4m  -D_GNU_SOURCE  conftest.c
configure:29747: checking for Python.h
ac_cv_header_Python_h=yes
ac_cv_path_PYTHON=/usr/local/bin/python3
PYTHON='/usr/local/bin/python3'
configure_args=' '\''--prefix=/Users/berald01'\'' '\''--with-python'\'' '\''PYTHON=/usr/local/bin/python3'\'''
python_additional_libs='-lpthread -ldl  -lutil -lm'
python_enable_shared='0'
python_includespec='-I/usr/local/include/python3.4m'
python_libdir='/usr/local/lib/python3.4/config-3.4m'
python_libspec='-L/usr/local/lib/python3.4/config-3.4m -lpython3.4m'
python_majorversion='3'
python_version='3.4'
with_python='yes'

Re: Installing plpython3u

From
Tom Lane
Date:
Dario Beraldi <dario.beraldi@gmail.com> writes:
> Sorry guys... I executed

> ./configure --prefix=$HOME --with-python PYTHON=/usr/local/bin/python3
> make
> make install

That looks sane from here ...

> and it completed fine (see also below output from 'grep -i 'PYTHON'
> config.log'). Still after restarting postgres I get:

> createlang plpython3u sblab
> ERROR:  could not open extension control file
> "/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control":
> No such file or directory
> STATEMENT:  CREATE EXTENSION "plpython3u";

Hmm, what files *do* you have in that directory?

It might be worth cd'ing into the src/pl/plpython subdirectory and
manually doing "make install" there to see what it prints.

            regards, tom lane


Re: Installing plpython3u

From
Adrian Klaver
Date:
On 10/15/2015 07:16 AM, Tom Lane wrote:
> Dario Beraldi <dario.beraldi@gmail.com> writes:
>> Sorry guys... I executed
>
>> ./configure --prefix=$HOME --with-python PYTHON=/usr/local/bin/python3
>> make
>> make install
>
> That looks sane from here ...
>
>> and it completed fine (see also below output from 'grep -i 'PYTHON'
>> config.log'). Still after restarting postgres I get:
>
>> createlang plpython3u sblab
>> ERROR:  could not open extension control file
>> "/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control":
>> No such file or directory
>> STATEMENT:  CREATE EXTENSION "plpython3u";
>
> Hmm, what files *do* you have in that directory?

There seems to be a discrepancy in paths:

ERROR:  could not open extension control file
"/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control"

configure_args=' '\''--prefix=/Users/berald01'\''

So is there something mapping /Users/berald01 to /data/sblab-home/ ?

>
> It might be worth cd'ing into the src/pl/plpython subdirectory and
> manually doing "make install" there to see what it prints.
>
>             regards, tom lane
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Installing plpython3u

From
Dario Beraldi
Date:

createlang plpython3u sblab
ERROR:  could not open extension control file
"/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control":
No such file or directory
STATEMENT:  CREATE EXTENSION "plpython3u";

Hmm, what files *do* you have in that directory

Here's what I see:

ls -l /data/sblab-home/berald01/share/postgresql/extension/
total 12
-rw-r--r-- 1 berald01 sblab 332 Oct 15 15:30 plpgsql--1.0.sql
-rw-r--r-- 1 berald01 sblab 179 Oct 15 15:30 plpgsql.control
-rw-r--r-- 1 berald01 sblab 381 Oct 15 15:30 plpgsql--unpackaged--1.0.sql

 
There seems to be a discrepancy in paths:

ERROR:  could not open extension control file "/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control"

configure_args=' '\''--prefix=/Users/berald01'\''

So is there something mapping /Users/berald01 to /data/sblab-home/ ?

It *should* be fine /Users/berald01 and /data/sblab-home/berald01 point to the same space. I.e. "ls  /Users/berald01" is the same as "ls /data/sblab-home/berald01"
 

It might be worth cd'ing into the src/pl/plpython subdirectory and
manually doing "make install" there to see what it prints.


Here we go:
cd /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython
make install
make: Nothing to be done for `install'.

Any clue?

(Thanks a ton for your assistance!)

--
Adrian Klaver
adrian.klaver@aklaver.com

Re: Installing plpython3u

From
Dario Beraldi
Date:


It might be worth cd'ing into the src/pl/plpython subdirectory and
manually doing "make install" there to see what it prints.


By the way, that's what I see in src/pl/plpython:

ls -l /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython
total 292
drwxrwx--- 2 berald01 sblab  4096 Jul 21  2014 expected
-rw-r----- 1 berald01 sblab  1002 Jul 21  2014 generate-spiexceptions.pl
-rw-r----- 1 berald01 sblab  6154 Jul 21  2014 Makefile
-rw-r----- 1 berald01 sblab   648 Jul 21  2014 nls.mk
-rw-r----- 1 berald01 sblab 10623 Jul 21  2014 plpy_cursorobject.c
-rw-r----- 1 berald01 sblab   394 Jul 21  2014 plpy_cursorobject.h
-rw-r----- 1 berald01 sblab 10841 Jul 21  2014 plpy_elog.c
-rw-r----- 1 berald01 sblab   699 Jul 21  2014 plpy_elog.h
-rw-r----- 1 berald01 sblab 22176 Jul 21  2014 plpy_exec.c
-rw-r----- 1 berald01 sblab   294 Jul 21  2014 plpy_exec.h
-rw-r----- 1 berald01 sblab 10407 Jul 21  2014 plpy_main.c
-rw-r----- 1 berald01 sblab   789 Jul 21  2014 plpy_main.h
-rw-r----- 1 berald01 sblab  2476 Jul 21  2014 plpy_planobject.c
-rw-r----- 1 berald01 sblab   456 Jul 21  2014 plpy_planobject.h
-rw-r----- 1 berald01 sblab  9942 Jul 21  2014 plpy_plpymodule.c
-rw-r----- 1 berald01 sblab   365 Jul 21  2014 plpy_plpymodule.h
-rw-r----- 1 berald01 sblab 13374 Jul 21  2014 plpy_procedure.c
-rw-r----- 1 berald01 sblab  1596 Jul 21  2014 plpy_procedure.h
-rw-r----- 1 berald01 sblab  6980 Jul 21  2014 plpy_resultobject.c
-rw-r----- 1 berald01 sblab   573 Jul 21  2014 plpy_resultobject.h
-rw-r----- 1 berald01 sblab 13793 Jul 21  2014 plpy_spi.c
-rw-r----- 1 berald01 sblab   780 Jul 21  2014 plpy_spi.h
-rw-r----- 1 berald01 sblab  5490 Jul 21  2014 plpy_subxactobject.c
-rw-r----- 1 berald01 sblab   673 Jul 21  2014 plpy_subxactobject.h
-rw-r----- 1 berald01 sblab   351 Jul 21  2014 plpython2u--1.0.sql
-rw-r----- 1 berald01 sblab   196 Jul 21  2014 plpython2u.control
-rw-r----- 1 berald01 sblab   402 Jul 21  2014 plpython2u--unpackaged--1.0.sql
-rw-r----- 1 berald01 sblab   351 Jul 21  2014 plpython3u--1.0.sql
-rw-r----- 1 berald01 sblab   196 Jul 21  2014 plpython3u.control
-rw-r----- 1 berald01 sblab   402 Jul 21  2014 plpython3u--unpackaged--1.0.sql
-rw-r----- 1 berald01 sblab  4071 Jul 21  2014 plpython.h
-rw-r----- 1 berald01 sblab   347 Jul 21  2014 plpythonu--1.0.sql
-rw-r----- 1 berald01 sblab   194 Jul 21  2014 plpythonu.control
-rw-r----- 1 berald01 sblab   393 Jul 21  2014 plpythonu--unpackaged--1.0.sql
-rw-r----- 1 berald01 sblab 27349 Jul 21  2014 plpy_typeio.c
-rw-r----- 1 berald01 sblab  2659 Jul 21  2014 plpy_typeio.h
-rw-r----- 1 berald01 sblab  3548 Jul 21  2014 plpy_util.c
-rw-r----- 1 berald01 sblab   511 Jul 21  2014 plpy_util.h
drwxrwx--- 2 berald01 sblab   144 Jul 21  2014 po
-rw-r----- 1 berald01 sblab 22857 Jul 21  2014 spiexceptions.h
drwxrwx--- 2 berald01 sblab  4096 Jul 21  2014 sql

Re: Installing plpython3u

From
Adrian Klaver
Date:
On 10/15/2015 07:42 AM, Dario Beraldi wrote:
>
>             createlang plpython3u sblab
>             ERROR:  could not open extension control file
>             "/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control":
>             No such file or directory
>             STATEMENT:  CREATE EXTENSION "plpython3u";
>
>
>         Hmm, what files *do* you have in that directory
>
>
> Here's what I see:
>
> ls -l /data/sblab-home/berald01/share/postgresql/extension/
> total 12
> -rw-r--r-- 1 berald01 sblab 332 Oct 15 15:30 plpgsql--1.0.sql
> -rw-r--r-- 1 berald01 sblab 179 Oct 15 15:30 plpgsql.control
> -rw-r--r-- 1 berald01 sblab 381 Oct 15 15:30 plpgsql--unpackaged--1.0.sql
>
>     There seems to be a discrepancy in paths:
>
>     ERROR:  could not open extension control file
>     "/data/sblab-home/berald01/share/postgresql/extension/plpython3u.control"
>
>     configure_args=' '\''--prefix=/Users/berald01'\''
>
>     So is there something mapping /Users/berald01 to /data/sblab-home/ ?
>
>
> It *should* be fine /Users/berald01 and /data/sblab-home/berald01 point
> to the same space. I.e. "ls  /Users/berald01" is the same as "ls
> /data/sblab-home/berald01"

Just for grins try:

ls -al /Users/berald01/share/postgresql/extension/

>
>
>         It might be worth cd'ing into the src/pl/plpython subdirectory and
>         manually doing "make install" there to see what it prints.
>
>
>
> Here we go:
> cd
> /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython
> make install
> make: Nothing to be done for `install'.
>
> Any clue?
>
> (Thanks a ton for your assistance!)
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Installing plpython3u

From
Adrian Klaver
Date:
On 10/15/2015 07:49 AM, Dario Beraldi wrote:
>
>
>         It might be worth cd'ing into the src/pl/plpython subdirectory and
>         manually doing "make install" there to see what it prints.
>
>
> By the way, that's what I see in src/pl/plpython:

So it does not look like it actually ran the make, I see no *.o files.

What happens if you run make in?:

/data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython

>
> ls -l
> /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython
> total 292
> drwxrwx--- 2 berald01 sblab  4096 Jul 21  2014 expected
> -rw-r----- 1 berald01 sblab  1002 Jul 21  2014 generate-spiexceptions.pl
> <http://generate-spiexceptions.pl>
> -rw-r----- 1 berald01 sblab  6154 Jul 21  2014 Makefile
> -rw-r----- 1 berald01 sblab   648 Jul 21  2014 nls.mk <http://nls.mk>
> -rw-r----- 1 berald01 sblab 10623 Jul 21  2014 plpy_cursorobject.c
> -rw-r----- 1 berald01 sblab   394 Jul 21  2014 plpy_cursorobject.h
> -rw-r----- 1 berald01 sblab 10841 Jul 21  2014 plpy_elog.c
> -rw-r----- 1 berald01 sblab   699 Jul 21  2014 plpy_elog.h
> -rw-r----- 1 berald01 sblab 22176 Jul 21  2014 plpy_exec.c
> -rw-r----- 1 berald01 sblab   294 Jul 21  2014 plpy_exec.h
> -rw-r----- 1 berald01 sblab 10407 Jul 21  2014 plpy_main.c
> -rw-r----- 1 berald01 sblab   789 Jul 21  2014 plpy_main.h
> -rw-r----- 1 berald01 sblab  2476 Jul 21  2014 plpy_planobject.c
> -rw-r----- 1 berald01 sblab   456 Jul 21  2014 plpy_planobject.h
> -rw-r----- 1 berald01 sblab  9942 Jul 21  2014 plpy_plpymodule.c
> -rw-r----- 1 berald01 sblab   365 Jul 21  2014 plpy_plpymodule.h
> -rw-r----- 1 berald01 sblab 13374 Jul 21  2014 plpy_procedure.c
> -rw-r----- 1 berald01 sblab  1596 Jul 21  2014 plpy_procedure.h
> -rw-r----- 1 berald01 sblab  6980 Jul 21  2014 plpy_resultobject.c
> -rw-r----- 1 berald01 sblab   573 Jul 21  2014 plpy_resultobject.h
> -rw-r----- 1 berald01 sblab 13793 Jul 21  2014 plpy_spi.c
> -rw-r----- 1 berald01 sblab   780 Jul 21  2014 plpy_spi.h
> -rw-r----- 1 berald01 sblab  5490 Jul 21  2014 plpy_subxactobject.c
> -rw-r----- 1 berald01 sblab   673 Jul 21  2014 plpy_subxactobject.h
> -rw-r----- 1 berald01 sblab   351 Jul 21  2014 plpython2u--1.0.sql
> -rw-r----- 1 berald01 sblab   196 Jul 21  2014 plpython2u.control
> -rw-r----- 1 berald01 sblab   402 Jul 21  2014
> plpython2u--unpackaged--1.0.sql
> -rw-r----- 1 berald01 sblab   351 Jul 21  2014 plpython3u--1.0.sql
> -rw-r----- 1 berald01 sblab   196 Jul 21  2014 plpython3u.control
> -rw-r----- 1 berald01 sblab   402 Jul 21  2014
> plpython3u--unpackaged--1.0.sql
> -rw-r----- 1 berald01 sblab  4071 Jul 21  2014 plpython.h
> -rw-r----- 1 berald01 sblab   347 Jul 21  2014 plpythonu--1.0.sql
> -rw-r----- 1 berald01 sblab   194 Jul 21  2014 plpythonu.control
> -rw-r----- 1 berald01 sblab   393 Jul 21  2014
> plpythonu--unpackaged--1.0.sql
> -rw-r----- 1 berald01 sblab 27349 Jul 21  2014 plpy_typeio.c
> -rw-r----- 1 berald01 sblab  2659 Jul 21  2014 plpy_typeio.h
> -rw-r----- 1 berald01 sblab  3548 Jul 21  2014 plpy_util.c
> -rw-r----- 1 berald01 sblab   511 Jul 21  2014 plpy_util.h
> drwxrwx--- 2 berald01 sblab   144 Jul 21  2014 po
> -rw-r----- 1 berald01 sblab 22857 Jul 21  2014 spiexceptions.h
> drwxrwx--- 2 berald01 sblab  4096 Jul 21  2014 sql
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Installing plpython3u

From
Tom Lane
Date:
Dario Beraldi <dario.beraldi@gmail.com> writes:
>> It might be worth cd'ing into the src/pl/plpython subdirectory and
>> manually doing "make install" there to see what it prints.

> Here we go:
> cd
> /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython
> make install
> make: Nothing to be done for `install'.

That, and the fact that your "ls" shows no derived files, means that the
Makefile is choosing not to do anything, which a look at the Makefile
says must be because shared_libpython isn't getting set.  (As of 9.5
we've changed that to not fail silently, but in 9.3 this is what it does.)

There are two possibilities here: either your python3 installation does
not include a shared-library version of libpython, or it does but the
configure+Make process is failing to detect that.  Probably should
establish which of those it is before going further.

            regards, tom lane


Re: Installing plpython3u

From
Dario Beraldi
Date:


On 15 October 2015 at 16:23, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Dario Beraldi <dario.beraldi@gmail.com> writes:
>> It might be worth cd'ing into the src/pl/plpython subdirectory and
>> manually doing "make install" there to see what it prints.

> Here we go:
> cd
> /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython
> make install
> make: Nothing to be done for `install'.

That, and the fact that your "ls" shows no derived files, means that the
Makefile is choosing not to do anything, which a look at the Makefile
says must be because shared_libpython isn't getting set.  (As of 9.5
we've changed that to not fail silently, but in 9.3 this is what it does.)

There are two possibilities here: either your python3 installation does
not include a shared-library version of libpython, or it does but the
configure+Make process is failing to detect that.  Probably should
establish which of those it is before going further.

                        regards, tom lane

Ahh, I guess this answers the question then:

cd /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython/
make

*** Cannot build PL/Python because libpython is not a shared library.
*** You might have to rebuild your Python installation.  Refer to
*** the documentation for details.

Right, it looks like I have to rebuild python then.
Thanks guys!
Dario


Re: Installing plpython3u

From
Dario Beraldi
Date:

On 15 October 2015 at 16:29, Dario Beraldi <dario.beraldi@gmail.com> wrote:





On 15 October 2015 at 16:23, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Dario Beraldi <dario.beraldi@gmail.com> writes:
>> It might be worth cd'ing into the src/pl/plpython subdirectory and
>> manually doing "make install" there to see what it prints.

> Here we go:
> cd
> /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython
> make install
> make: Nothing to be done for `install'.

That, and the fact that your "ls" shows no derived files, means that the
Makefile is choosing not to do anything, which a look at the Makefile
says must be because shared_libpython isn't getting set.  (As of 9.5
we've changed that to not fail silently, but in 9.3 this is what it does.)

There are two possibilities here: either your python3 installation does
not include a shared-library version of libpython, or it does but the
configure+Make process is failing to detect that.  Probably should
establish which of those it is before going further.

                        regards, tom lane

Ahh, I guess this answers the question then:

cd /data/sblab-home/berald01/applications/postgresql/postgresql-9.3.5/src/pl/plpython/
make

*** Cannot build PL/Python because libpython is not a shared library.
*** You might have to rebuild your Python installation.  Refer to
*** the documentation for details.

Ok, this seems to have done the trick:

# Get python and install as shared library:
wget http://python.org/ftp/python/3.5.0/Python-3.5.0.tar.xz
tar xf Python-3.5.0.tar.xz
cd Python-3.5.0

./configure --enable-shared \
            --prefix=$HOME \
            LDFLAGS="-Wl,--rpath=$HOME/lib"
make
make altinstall

# Re-configure postgres
cd /Users/berald01/applications/postgresql/postgresql-9.3.5/
./configure --prefix=$HOME --with-python PYTHON=~/bin/python3.5
make
make install

# Create python3 lang:
createlang plpython3u sblab