Thread: configure PostgreSQL with the python: distutils module not found

configure PostgreSQL with the python: distutils module not found

From
Andre Mikulec
Date:


Hi,

I am trying to configure PostgreSQL with the plpython language available.

Here is my ./configure line

TargetUser@TARGETMACH /c/postgres-master_0ab9c56_debug
$ ./configure PYTHON=/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3 --with-python --with-includes=/c/EnterpriseDB/Lang
uagePack/9.5/x64/Python-3.3/Include:/c/Users/TargetUser/Documents/zlib-1.2.8-win32-x86_64/include --with-libraries=/
c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3:/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3/DLLs:/c/EnterpriseDB/Lan
guagePack/9.5/x64/Python-3.3/libs:/c/Users/TargetUser/Documents/zlib-1.2.8-win32-x86_64/bin:/c/Users/TargetUser/D
ocuments/zlib-1.2.8-win32-x86_64/lib --host=x86_64-w64-mingw32 --prefix=/usr/local/pgsql_0ab9c56_debug --disable-rpath
--enable-depend --enable-cassert --enable-debug --with-extra-version=_CFLAGS_O_0ab9c56 CFLAGS="-O -fno-omit-frame-point
er"  2>&1 | tee configure_OPTIONS.txt

I am getting the error message.

checking for python... /c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3
checking for Python distutils module... no
configure: error: distutils module not found

However, I do have 'distutils'

Python 3.3.4 (default, Jan  5 2016, 16:11:51) [MSC v.1800 64 bit (AMD64)] on w
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils
>>>

Please help.

Thank you.

Andre Mikulec
Andre_Mikulec@Hotmail.com









Re: configure PostgreSQL with the python: distutils module not found

From
Adrian Klaver
Date:
On 10/20/2016 06:44 AM, Andre Mikulec wrote:
>
> Hi,
>

For this and your subsequent posts.

Did you install Postgres from the EDB installer?

If so then:

http://forums.enterprisedb.com/posts/list/4312.page#15381

http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt


If not then you can not use the Language Packs to build a PL.

Also(if not) where did you get your Postgres from and OS version are you
using?

> I am trying to configure PostgreSQL with the plpython language available.
>
> Here is my ./configure line
>
> TargetUser@TARGETMACH /c/postgres-master_0ab9c56_debug
> $ ./configure PYTHON=/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3
> --with-python --with-includes=/c/EnterpriseDB/Lang
> uagePack/9.5/x64/Python-3.3/Include:/c/Users/TargetUser/Documents/zlib-1.2.8-win32-x86_64/include
> --with-libraries=/
>
c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3:/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3/DLLs:/c/EnterpriseDB/Lan
> guagePack/9.5/x64/Python-3.3/libs:/c/Users/TargetUser/Documents/zlib-1.2.8-win32-x86_64/bin:/c/Users/TargetUser/D
> ocuments/zlib-1.2.8-win32-x86_64/lib --host=x86_64-w64-mingw32
> --prefix=/usr/local/pgsql_0ab9c56_debug --disable-rpath
> --enable-depend --enable-cassert --enable-debug
> --with-extra-version=_CFLAGS_O_0ab9c56 CFLAGS="-O -fno-omit-frame-point
> er"  2>&1 | tee configure_OPTIONS.txt
>
> I am getting the error message.
>
> checking for python... /c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3
> checking for Python distutils module... no
> configure: error: distutils module not found
>
> However, I do have 'distutils'
>
> Python 3.3.4 (default, Jan  5 2016, 16:11:51) [MSC v.1800 64 bit
> (AMD64)] on w
> 32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import distutils
>>>>
>
> Please help.
>
> Thank you.
>
> Andre Mikulec
> Andre_Mikulec@Hotmail.com
>
>
>
>
>
>
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: configure PostgreSQL with the python: distutils module not found

From
Tom Lane
Date:
Andre Mikulec <andre_mikulec@hotmail.com> writes:
> I am trying to configure PostgreSQL with the plpython language available.

> Here is my ./configure line

> $ ./configure PYTHON=/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3 --with-python
--with-includes=/c/EnterpriseDB/Lang

Are you sure that that PYTHON specification actually points at a usable
executable?

> I am getting the error message.

> checking for python... /c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3
> checking for Python distutils module... no
> configure: error: distutils module not found

The test that's failing is just

if "${PYTHON}" -c 'import distutils' 2>&AS_MESSAGE_LOG_FD
then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR([distutils module not found])
fi

so it seems pretty likely that the value of PYTHON you're forcing doesn't
identify a usable Python.  Looking into config.log to see what the stderr
output of this test was might be informative.

            regards, tom lane


Re: configure PostgreSQL with the python: distutils module not found

From
Adrian Klaver
Date:
On 10/20/2016 07:03 AM, Tom Lane wrote:
> Andre Mikulec <andre_mikulec@hotmail.com> writes:
>> I am trying to configure PostgreSQL with the plpython language available.
>
>> Here is my ./configure line
>
>> $ ./configure PYTHON=/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3 --with-python
--with-includes=/c/EnterpriseDB/Lang
>
> Are you sure that that PYTHON specification actually points at a usable
> executable?
>
>> I am getting the error message.
>
>> checking for python... /c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3
>> checking for Python distutils module... no
>> configure: error: distutils module not found
>
> The test that's failing is just
>
> if "${PYTHON}" -c 'import distutils' 2>&AS_MESSAGE_LOG_FD
> then
>     AC_MSG_RESULT(yes)
> else
>     AC_MSG_RESULT(no)
>     AC_MSG_ERROR([distutils module not found])
> fi
>
> so it seems pretty likely that the value of PYTHON you're forcing doesn't
> identify a usable Python.  Looking into config.log to see what the stderr
> output of this test was might be informative.

The Language Packs are pre-built packages that I am pretty sure do not
include -dev code:

http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt

"Language Pack Installers
========================

Language pack installers contain supported languages that may be used
with our PostgreSQL
database installers. The language pack installer allows you to create pl
languages for Perl,
TCL/TK, and Python without installing supporting software from third
party vendors.

For more details on how to install, please see the installation notes
that are packaged with the installer.

What is Including in the Installer:
===================================

(1) TCL with TK; 8.5
(2) Perl; 5.20
(3) Python; 3.3

NOTE:

The Perl package contains the cpan package manager, and Python contains
pip and easy_install package
managers. There is no package manager for TCL/TK.

... "

>
>             regards, tom lane
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: configure PostgreSQL with the python: distutils module not found

From
Andre Mikulec
Date:


Adrian,

I am sorry. I am not trying to use the Language Packs, to build my own custom version of a Language. I mispoke myself.

Thanks,

Andre Mikulec
Andre_Mikulec@Hotmail.com



From: Adrian Klaver <adrian.klaver@aklaver.com>
Sent: Thursday, October 20, 2016 9:58 AM
To: Andre Mikulec; pgsql-general@postgresql.org
Subject: Re: [GENERAL] configure PostgreSQL with the python: distutils module not found
 
On 10/20/2016 06:44 AM, Andre Mikulec wrote:
>
> Hi,
>

For this and your subsequent posts.

Did you install Postgres from the EDB installer?

If so then:

http://forums.enterprisedb.com/posts/list/4312.page#15381

http://get.enterprisedb.com/docs/README-edb-languagepack-9.6.txt
get.enterprisedb.com
Language Pack Installers ===== Language pack installers contain supported languages that may be used with our PostgreSQL database installers.




If not then you can not use the Language Packs to build a PL.

Also(if not) where did you get your Postgres from and OS version are you
using?

> I am trying to configure PostgreSQL with the plpython language available.
>
> Here is my ./configure line
>
> TargetUser@TARGETMACH /c/postgres-master_0ab9c56_debug
> $ ./configure PYTHON=/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3
> --with-python --with-includes=/c/EnterpriseDB/Lang
> uagePack/9.5/x64/Python-3.3/Include:/c/Users/TargetUser/Documents/zlib-1.2.8-win32-x86_64/include
> --with-libraries=/
> c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3:/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3/DLLs:/c/EnterpriseDB/Lan
> guagePack/9.5/x64/Python-3.3/libs:/c/Users/TargetUser/Documents/zlib-1.2.8-win32-x86_64/bin:/c/Users/TargetUser/D
> ocuments/zlib-1.2.8-win32-x86_64/lib --host=x86_64-w64-mingw32
> --prefix=/usr/local/pgsql_0ab9c56_debug --disable-rpath
> --enable-depend --enable-cassert --enable-debug
> --with-extra-version=_CFLAGS_O_0ab9c56 CFLAGS="-O -fno-omit-frame-point
> er"  2>&1 | tee configure_OPTIONS.txt
>
> I am getting the error message.
>
> checking for python... /c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3
> checking for Python distutils module... no
> configure: error: distutils module not found
>
> However, I do have 'distutils'
>
> Python 3.3.4 (default, Jan  5 2016, 16:11:51) [MSC v.1800 64 bit
> (AMD64)] on w
> 32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import distutils
>>>>
>
> Please help.
>
> Thank you.
>
> Andre Mikulec
> Andre_Mikulec@Hotmail.com
>
>
>
>
>
>
>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com

Re: configure PostgreSQL with the python: distutils module not found

From
Andre Mikulec
Date:

Tom,

O.K., 

I re-wrote my ./configure to start with

./configure PYTHON=/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3/python.exe ... etc ...

Thanks that works right now.

checking for python... /c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3/python.exe
checking for Python distutils module... yes
checking Python configuration directory...
checking Python include directories... -Ic:/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3/include
checking how to link an embedded Python application... -L -lpython3.3

Maybe the docs should say, something similar to

"Full path name and file name of the XXX interpreter"?
https://www.postgresql.org/docs/9.5/static/install-procedure.html

I also ended up needing. . . .

1. A copy of python33.dll to be in the folder C:\Windows\System32.
(This 'location requirement' seems *stangely* hardcoded.)

2. pexports.exe ( that the mingw x86_64-6.2.0-release-posix-seh-rt_v5-rev0 does not have.)
I ended up attaching the 'PostgreSQL happy' Strawberry PERL distribution c_bin_directory
(that has pexports.exe ) to the end of my path.

set PATH=%PATH%;C:\Strawberry\c\bin

(But this guy know how to get pexports.exe directly)
MinGW: pexports for Windows DLLs
https://forbharat.wordpress.com/2010/12/30/mingw-pexports-for-windows-dlls/

I followed the instructions in here.
http://get.enterprisedb.com/docs/README-languagepack-950.txt

Then, I did.

create language plpython3u;

I followed the instructions in here.
https://www.postgresql.org/docs/9.5/static/plpython-funcs.html

Last, I did a very simple test.

postgres=# select pymax(5,3);
 pymax
-------
     5
(1 row)

Thanks,
Andre Mikulec
Andre_Mikulec@Hotmail.com




From: Tom Lane <tgl@sss.pgh.pa.us>
Sent: Thursday, October 20, 2016 10:03 AM
To: Andre Mikulec
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] configure PostgreSQL with the python: distutils module not found
 
Andre Mikulec <andre_mikulec@hotmail.com> writes:
> I am trying to configure PostgreSQL with the plpython language available.

> Here is my ./configure line

> $ ./configure PYTHON=/c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3 --with-python --with-includes=/c/EnterpriseDB/Lang

Are you sure that that PYTHON specification actually points at a usable
executable?

> I am getting the error message.

> checking for python... /c/EnterpriseDB/LanguagePack/9.5/x64/Python-3.3
> checking for Python distutils module... no
> configure: error: distutils module not found

The test that's failing is just

if "${PYTHON}" -c 'import distutils' 2>&AS_MESSAGE_LOG_FD
then
    AC_MSG_RESULT(yes)
else
    AC_MSG_RESULT(no)
    AC_MSG_ERROR([distutils module not found])
fi

so it seems pretty likely that the value of PYTHON you're forcing doesn't
identify a usable Python.  Looking into config.log to see what the stderr
output of this test was might be informative.

                        regards, tom lane