Thread: Configure/Build 9.0 rc1 - cannot build against python3.1, with two versions of python in the environment

[TEST REPORT]
[Release]: 9.0 RC1
[Test Type]: Install (Build)
[Test]: Configure/Build 9.0 rc1 - cannot build against python3.1, with two versions of python in the environment
[Platform]: Solaris 10 Sparc E450 Quad
[Parameters]: 
--with-python \
--with-includes=/usr/local/include/python3.1:/usr/local/include:/usr/local/ssl/include \
--with-libraries=/usr/local/lib/python3.1:/usr/local/lib:/usr/local/ssl/lib \
CONFIGURE OUTPUT: -----------------------------------------
checking for python... /usr/bin/python
checking Python configuration directory... /usr/lib/python2.4/config
checking how to link an embedded Python application... -L/usr/lib -lpython2.4 -lresolv -lsocket -lnsl -lrt -ldl -lm
configure: using CPPFLAGS= -I/usr/local/include/libxml2  -I/usr/local/include/python3.1 -I/usr/local/include -I/usr/local/ssl/include
configure: using LDFLAGS= -L/usr/local/lib  -L/usr/local/lib/python3.1
[Failure]:
 Can't seem to definitively config PG to a specific version of python - v3.1, at /usr/local/bin/python3
[Results]: configure seems to pick up python 2.4 configuration, but apparently links to (desired) python 3.1 libs.
# ldd plpython2.so
        libpython2.4.so.1.0 =>   /usr/lib/libpython2.4.so.1.0
[Comments]: Tried first to see if configure picks up the PYTHONPATH env variable to find python's configuration.  No joy.  Using this variable might be a reasonable approach for configure?
> *[Comments]:* Tried first to see if configure picks up the PYTHONPATH
> env variable to find python's configuration. No joy. Using this variable
> might be a reasonable approach for configure?

I'm pretty sure this was hashed out on hackers, and turned out to be an
issue with Python and not our fault.  James?

(forwarding James the whole issue report)

--
                                   -- Josh Berkus
                                      PostgreSQL Experts Inc.
                                      http://www.pgexperts.com

On Sep 11, 2010, at 2:36 PM, Josh Berkus wrote:
>> *[Comments]:* Tried first to see if configure picks up the PYTHONPATH
>> env variable to find python's configuration. No joy. Using this variable
>> might be a reasonable approach for configure?
>
> I'm pretty sure this was hashed out on hackers, and turned out to be an issue with Python and not our fault.  James?

Nah, this isn't a Python issue. It's our configure script.


I think the problem you're recalling was the discussion of having two libpython's loaded in the same backend process.

>> I'm pretty sure this was hashed out on hackers, and turned out to be an issue with Python and not our fault.  James?
>
> Nah, this isn't a Python issue. It's our configure script.

So, is this a bug?  Should we be fixing it before release?


--
                                   -- Josh Berkus
                                      PostgreSQL Experts Inc.
                                      http://www.pgexperts.com

On Sep 11, 2010, at 4:11 PM, Josh Berkus wrote:
> So, is this a bug?  Should we be fixing it before release?


Yes to both.

James,

> On Sep 11, 2010, at 4:11 PM, Josh Berkus wrote:
>> So, is this a bug?  Should we be fixing it before release?
>
>
> Yes to both.

Hmmm.  Tom Lane says "pilot error" because there are two versions of
Python in the path.  Specifically:

"In particular, how'd those 3.1 references get in there when the python
version in $PATH is 2.4? It's for damn sure we didn't introduce those."

If Tom is incorrect, please take up the thread on -BUGS.  I don't know
enough about python libs in builds to argue either way.

--
                                  -- Josh Berkus
                                     PostgreSQL Experts Inc.
                                     http://www.pgexperts.com

On Sep 12, 2010, at 3:23 PM, Josh Berkus wrote:
> Hmmm.  Tom Lane says "pilot error" because there are two versions of
> Python in the path.  Specifically:

ugh, :(

Yeah, that's correct:

--with-python \
--with-includes=/usr/local/include/python3.1:/usr/local/include:/usr/local/ssl/include
--with-libraries=/usr/local/lib/python3.1:/usr/local/lib:/usr/local/ssl/lib


I was drawing from some trickiness I experienced getting my plpy vs plpython test rig going.
I think it kept favoring python2 when I wanted python3 as both were in $PATH.

IIRC, what he needs to do is remove the python2 bin-directory from the PATH in order to get 3.x selected by configure.
Seemsless than user friendly... 

James William Pye <lists@jwp.name> writes:
> I think it kept favoring python2 when I wanted python3 as both were in $PATH.

AFAICS, it'll pick whichever version is executed when you say "python".
Doesn't seem like an unreasonable behavior to me.

You may well need to adjust $PATH before running configure.  I wouldn't
recommend hacking --with-includes or --with-libraries at all, though;
we find out what directories to use by asking "python".

            regards, tom lane

On Sep 12, 2010, at 8:19 PM, Tom Lane wrote:

> James William Pye <lists@jwp.name> writes:
>> I think it kept favoring python2 when I wanted python3 as both were in $PATH.
>
> AFAICS, it'll pick whichever version is executed when you say "python".
> Doesn't seem like an unreasonable behavior to me.

Perhaps reasonable, but:

jwp@torch[]:python/release31-maint/Include 0% ls /src/build/py32pg90/bin/py*
/src/build/py32pg90/bin/pydoc3            /src/build/py32pg90/bin/python3-config
/src/build/py32pg90/bin/python3.2-config
/src/build/py32pg90/bin/python3            /src/build/py32pg90/bin/python3.2

3.x doesn't have a "python" link by default, so the user will have to make one in order to get ./configure to select
it.

On 2010-09-12 8:19 PM, Tom Lane wrote:
> AFAICS, it'll pick whichever version is executed when you say "python".
> Doesn't seem like an unreasonable behavior to me.

I would argue that this is not reasonable behavior.

Because most current *NIX systems depend on python 2 for system scripts,
the only way to reasonably use python 3 is to install it in addition to,
not instead of, python 2. So most systems with python 3 will run python
2 when you say "python" and python 3 when you say "python3".

For example, on my Mac running OSX 10.6.4 ...

   $ python -V
   Python 2.6.1

   $ python3 -V
   Python 3.1.1

--

Bill Weinman
- Online training: http://bw.org/u/l01

Follow Bill:
- Web: http://bw.org/
- Facebook: http://bw.org/u/fb01
- Linked In: http://bw.org/u/li01
- Twitter: http://bw.org/u/tw01