port select python and config error

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

port select python and config error

Mark Brethen-2
Quite by accident I have discovered a flaw with my libreduce port as regards to "port select —set python". I had not set a default python version before I built the reduce libraries, unaware it was using apple's system python 2.7 to build. However, when I set a python version using port select —set python and add the python group, libreduce fails at configure. There is a file ‘ac_python_devel.m4’ in the source directory that is throwing the error (see attached). I’m not sure why builds with apple’s python and not macports.





Mark Brethen
[hidden email]




main.log (223K) Download Attachment
ac_python_devel.m4 (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Ryan Schmidt-24


On Oct 28, 2018, at 16:08, Mark Brethen wrote:

> Quite by accident I have discovered a flaw with my libreduce port as regards to "port select —set python". I had not set a default python version before I built the reduce libraries, unaware it was using apple's system python 2.7 to build. However, when I set a python version using port select —set python and add the python group, libreduce fails at configure. There is a file ‘ac_python_devel.m4’ in the source directory that is throwing the error (see attached). I’m not sure why builds with apple’s python and not macports.
>
> <main.log><ac_python_devel.m4>

Which version of python did you select?

The error shown in your log is:

:info:configure checking for python... /opt/local/bin/python
:info:configure checking for a version of Python >= '2.1.0'...   File "<string>", line 1
:info:configure     import sys, string; ver = string.split(sys.version)[0]; print ver >= '2.1.0'
:info:configure                                                                         ^
:info:configure SyntaxError: invalid syntax
:info:configure no

If I pass that code to MacPorts python2.7 it works fine. If I pass it to MacPorts python3.5 it shows an invalid syntax error, because it is: python3 changed the syntax of the print command. It's now a function, not a language construct, so parentheses need to be used.

In addition, string.split is gone in python3.

Code that works with both python2 and python3 is:

import sys, string; ver = sys.version.split()[0]; print(ver >= '2.1.0')

You might suggest that to the developers of this software.

Using a string comparison operator on version numbers is probably wrong too.

If the configure script's code wasn't compatible with python3, who knows if the rest of the project's python code is. If it's not, easiest to just force the port to use /usr/bin/python. Setting "configure.python /usr/bin/python" might do that.

Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Mark Brethen-2
In reply to this post by Mark Brethen-2
I didn’t seem to matter. I tried both python27 and 36.


Mark Brethen
[hidden email]



> On Oct 28, 2018, at 4:08 PM, Mark Brethen <[hidden email]> wrote:
>
> Quite by accident I have discovered a flaw with my libreduce port as regards to "port select —set python". I had not set a default python version before I built the reduce libraries, unaware it was using apple's system python 2.7 to build. However, when I set a python version using port select —set python and add the python group, libreduce fails at configure. There is a file ‘ac_python_devel.m4’ in the source directory that is throwing the error (see attached). I’m not sure why builds with apple’s python and not macports.
>
> <main.log><ac_python_devel.m4>
>
>
> Mark Brethen
> [hidden email]
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Mark Brethen-2
brethen-air:~ marbre$ port select --summary
Name       Selected      Options
====       ========      =======
clang      none          mp-clang-6.0 none
cython     none          cython36 none
gcc        none          mp-gcc7 none
ipython    py34-ipython  none
llvm       none          mp-llvm-3.4 mp-llvm-6.0 none
mpi        none          mpich-mp-fortran none
nosetests  none          nosetests36 none
pip        pip34         none
py-sympy   py36-sympy    py36-sympy none
python     python36      python26-apple python27 python27-apple python36 none
python2    python27      python26-apple python27 python27-apple none
python3    python36      python36 none
wxWidgets  none          wxWidgets-3.0 none




Mark Brethen
[hidden email]



> On Oct 28, 2018, at 4:36 PM, Mark Brethen <[hidden email]> wrote:
>
> I didn’t seem to matter. I tried both python27 and 36.
>
>
> Mark Brethen
> [hidden email]
>
>
>
>> On Oct 28, 2018, at 4:08 PM, Mark Brethen <[hidden email]> wrote:
>>
>> Quite by accident I have discovered a flaw with my libreduce port as regards to "port select —set python". I had not set a default python version before I built the reduce libraries, unaware it was using apple's system python 2.7 to build. However, when I set a python version using port select —set python and add the python group, libreduce fails at configure. There is a file ‘ac_python_devel.m4’ in the source directory that is throwing the error (see attached). I’m not sure why builds with apple’s python and not macports.
>>
>> <main.log><ac_python_devel.m4>
>>
>>
>> Mark Brethen
>> [hidden email]
>>
>>
>>
>


reduce.zip (28K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Mark Brethen-2
In reply to this post by Ryan Schmidt-24
brethen-air:~ marbre$ port select --summary
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
Name       Selected      Options
====       ========      =======
clang      none          mp-clang-6.0 none
cython     none          cython36 none
gcc        none          mp-gcc7 none
ipython    py34-ipython  none
llvm       none          mp-llvm-3.4 mp-llvm-6.0 none
mpi        none          mpich-mp-fortran none
nosetests  none          nosetests36 none
pip        pip34         none
py-sympy   py36-sympy    py36-sympy none
python     python27      python26-apple python27 python27-apple python36 none
python2    python27      python26-apple python27 python27-apple none
python3    python36      python36 none
wxWidgets  none          wxWidgets-3.0 none

With macports python 2.7 it’s a different error:

:info:build /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
:info:build Command failed:  cd "/opt/local/var/macports/build/_Users_marbre_ports_math_reduce/libreduce/work/Reduce-svn4765-src/generic/libreduce/x86_64-mac_10.12_sierra-darwin16.7.0" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build
:info:build Exit code: 2
:error:build Failed to build libreduce: command execution failed
:debug:build Error code: CHILDSTATUS 96796 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_Users_marbre_ports_math_reduce/libreduce/main.log for details.





Mark Brethen
[hidden email]



> On Oct 28, 2018, at 4:25 PM, Ryan Schmidt <[hidden email]> wrote:
>
>
>
> On Oct 28, 2018, at 16:08, Mark Brethen wrote:
>
>> Quite by accident I have discovered a flaw with my libreduce port as regards to "port select —set python". I had not set a default python version before I built the reduce libraries, unaware it was using apple's system python 2.7 to build. However, when I set a python version using port select —set python and add the python group, libreduce fails at configure. There is a file ‘ac_python_devel.m4’ in the source directory that is throwing the error (see attached). I’m not sure why builds with apple’s python and not macports.
>>
>> <main.log><ac_python_devel.m4>
>
> Which version of python did you select?
>
> The error shown in your log is:
>
> :info:configure checking for python... /opt/local/bin/python
> :info:configure checking for a version of Python >= '2.1.0'...   File "<string>", line 1
> :info:configure     import sys, string; ver = string.split(sys.version)[0]; print ver >= '2.1.0'
> :info:configure                                                                         ^
> :info:configure SyntaxError: invalid syntax
> :info:configure no
>
> If I pass that code to MacPorts python2.7 it works fine. If I pass it to MacPorts python3.5 it shows an invalid syntax error, because it is: python3 changed the syntax of the print command. It's now a function, not a language construct, so parentheses need to be used.
>
> In addition, string.split is gone in python3.
>
> Code that works with both python2 and python3 is:
>
> import sys, string; ver = sys.version.split()[0]; print(ver >= '2.1.0')
>
> You might suggest that to the developers of this software.
>
> Using a string comparison operator on version numbers is probably wrong too.
>
> If the configure script's code wasn't compatible with python3, who knows if the rest of the project's python code is. If it's not, easiest to just force the port to use /usr/bin/python. Setting "configure.python /usr/bin/python" might do that.
>


main.log (110K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Mark Brethen-2
It looks to me that it failed because the source does not provide a ‘setup.py’ configuration file. Apple must provide a default setup.

Mark Brethen
[hidden email]



> On Oct 28, 2018, at 4:50 PM, Mark Brethen <[hidden email]> wrote:
>
> brethen-air:~ marbre$ port select --summary
> Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
> Name       Selected      Options
> ====       ========      =======
> clang      none          mp-clang-6.0 none
> cython     none          cython36 none
> gcc        none          mp-gcc7 none
> ipython    py34-ipython  none
> llvm       none          mp-llvm-3.4 mp-llvm-6.0 none
> mpi        none          mpich-mp-fortran none
> nosetests  none          nosetests36 none
> pip        pip34         none
> py-sympy   py36-sympy    py36-sympy none
> python     python27      python26-apple python27 python27-apple python36 none
> python2    python27      python26-apple python27 python27-apple none
> python3    python36      python36 none
> wxWidgets  none          wxWidgets-3.0 none
>
> With macports python 2.7 it’s a different error:
>
> :info:build /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
> :info:build Command failed:  cd "/opt/local/var/macports/build/_Users_marbre_ports_math_reduce/libreduce/work/Reduce-svn4765-src/generic/libreduce/x86_64-mac_10.12_sierra-darwin16.7.0" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build
> :info:build Exit code: 2
> :error:build Failed to build libreduce: command execution failed
> :debug:build Error code: CHILDSTATUS 96796 2
> :debug:build Backtrace: command execution failed
> :debug:build     while executing
> :debug:build "system {*}$notty {*}$nice $fullcmdstring"
> :debug:build     invoked from within
> :debug:build "command_exec build"
> :debug:build     (procedure "portbuild::build_main" line 8)
> :debug:build     invoked from within
> :debug:build "$procedure $targetname"
> :error:build See /opt/local/var/macports/logs/_Users_marbre_ports_math_reduce/libreduce/main.log for details.
>
> <main.log>
>
>
> Mark Brethen
> [hidden email]
>
>
>
>> On Oct 28, 2018, at 4:25 PM, Ryan Schmidt <[hidden email]> wrote:
>>
>>
>>
>> On Oct 28, 2018, at 16:08, Mark Brethen wrote:
>>
>>> Quite by accident I have discovered a flaw with my libreduce port as regards to "port select —set python". I had not set a default python version before I built the reduce libraries, unaware it was using apple's system python 2.7 to build. However, when I set a python version using port select —set python and add the python group, libreduce fails at configure. There is a file ‘ac_python_devel.m4’ in the source directory that is throwing the error (see attached). I’m not sure why builds with apple’s python and not macports.
>>>
>>> <main.log><ac_python_devel.m4>
>>
>> Which version of python did you select?
>>
>> The error shown in your log is:
>>
>> :info:configure checking for python... /opt/local/bin/python
>> :info:configure checking for a version of Python >= '2.1.0'...   File "<string>", line 1
>> :info:configure     import sys, string; ver = string.split(sys.version)[0]; print ver >= '2.1.0'
>> :info:configure                                                                         ^
>> :info:configure SyntaxError: invalid syntax
>> :info:configure no
>>
>> If I pass that code to MacPorts python2.7 it works fine. If I pass it to MacPorts python3.5 it shows an invalid syntax error, because it is: python3 changed the syntax of the print command. It's now a function, not a language construct, so parentheses need to be used.
>>
>> In addition, string.split is gone in python3.
>>
>> Code that works with both python2 and python3 is:
>>
>> import sys, string; ver = sys.version.split()[0]; print(ver >= '2.1.0')
>>
>> You might suggest that to the developers of this software.
>>
>> Using a string comparison operator on version numbers is probably wrong too.
>>
>> If the configure script's code wasn't compatible with python3, who knows if the rest of the project's python code is. If it's not, easiest to just force the port to use /usr/bin/python. Setting "configure.python /usr/bin/python" might do that.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Joshua Root-8
On 2018-10-29 09:03 , Mark Brethen wrote:
> It looks to me that it failed because the source does not provide a ‘setup.py’ configuration file. Apple must provide a default setup.

The python portgroup is for software that builds with a setup.py. If
this software doesn't have one, don't use it.

- Josh
Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Ryan Schmidt-24
In reply to this post by Mark Brethen-2


On Oct 28, 2018, at 16:50, Mark Brethen wrote:

> brethen-air:~ marbre$ port select --summary
> Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
> Name       Selected      Options
> ====       ========      =======
> clang      none          mp-clang-6.0 none
> cython     none          cython36 none
> gcc        none          mp-gcc7 none
> ipython    py34-ipython  none
> llvm       none          mp-llvm-3.4 mp-llvm-6.0 none
> mpi        none          mpich-mp-fortran none
> nosetests  none          nosetests36 none
> pip        pip34         none
> py-sympy   py36-sympy    py36-sympy none
> python     python27      python26-apple python27 python27-apple python36 none
> python2    python27      python26-apple python27 python27-apple none
> python3    python36      python36 none
> wxWidgets  none          wxWidgets-3.0 none
>
> With macports python 2.7 it’s a different error:
>
> :info:build /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
> :info:build Command failed:  cd "/opt/local/var/macports/build/_Users_marbre_ports_math_reduce/libreduce/work/Reduce-svn4765-src/generic/libreduce/x86_64-mac_10.12_sierra-darwin16.7.0" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build
> :info:build Exit code: 2
> :error:build Failed to build libreduce: command execution failed
> :debug:build Error code: CHILDSTATUS 96796 2
> :debug:build Backtrace: command execution failed
> :debug:build     while executing
> :debug:build "system {*}$notty {*}$nice $fullcmdstring"
> :debug:build     invoked from within
> :debug:build "command_exec build"
> :debug:build     (procedure "portbuild::build_main" line 8)
> :debug:build     invoked from within
> :debug:build "$procedure $targetname"
> :error:build See /opt/local/var/macports/logs/_Users_marbre_ports_math_reduce/libreduce/main.log for details.
>
> <main.log>
>

In that logfile, autoreconf has run, but configure has not been run, which is probably why the build later fails. I don't know why configure hasn't been run.


On Oct 28, 2018, at 17:03, Mark Brethen wrote:

> It looks to me that it failed because the source does not provide a ‘setup.py’ configuration file. Apple must provide a default setup.

setup.py is where a python project defines how it is to be set up. It's like a configure file. It's specific to each project. There isn't a default. Maybe for this software the configure script creates the setup.py file; I'm not sure.


Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Mark Brethen-2

On Oct 28, 2018, at 5:46 PM, Ryan Schmidt <[hidden email]> wrote:



On Oct 28, 2018, at 16:50, Mark Brethen wrote:

brethen-air:~ marbre$ port select --summary
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
Name       Selected      Options
====       ========      =======
clang      none          mp-clang-6.0 none
cython     none          cython36 none
gcc        none          mp-gcc7 none
ipython    py34-ipython  none
llvm       none          mp-llvm-3.4 mp-llvm-6.0 none
mpi        none          mpich-mp-fortran none
nosetests  none          nosetests36 none
pip        pip34         none
py-sympy   py36-sympy    py36-sympy none
python     python27      python26-apple python27 python27-apple python36 none
python2    python27      python26-apple python27 python27-apple none
python3    python36      python36 none
wxWidgets  none          wxWidgets-3.0 none

With macports python 2.7 it’s a different error:

:info:build /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory
:info:build Command failed:  cd "/opt/local/var/macports/build/_Users_marbre_ports_math_reduce/libreduce/work/Reduce-svn4765-src/generic/libreduce/x86_64-mac_10.12_sierra-darwin16.7.0" && /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 setup.py --no-user-cfg build 
:info:build Exit code: 2
:error:build Failed to build libreduce: command execution failed
:debug:build Error code: CHILDSTATUS 96796 2
:debug:build Backtrace: command execution failed
:debug:build     while executing
:debug:build "system {*}$notty {*}$nice $fullcmdstring"
:debug:build     invoked from within
:debug:build "command_exec build"
:debug:build     (procedure "portbuild::build_main" line 8)
:debug:build     invoked from within
:debug:build "$procedure $targetname"
:error:build See /opt/local/var/macports/logs/_Users_marbre_ports_math_reduce/libreduce/main.log for details.

<main.log>


In that logfile, autoreconf has run, but configure has not been run, which is probably why the build later fails. I don't know why configure hasn't been run.



The makefile handles it thusly,

all:
cd src; \
autoconf; \
autoheader
mkdir -p $(BUILD); \
cd $(BUILD); \
../src/configure --disable-universal; \
$(MAKE)

and so I got the following error:

--->  Configuring libreduce
Error: Failed to configure libreduce: configure failure: command execution failed
Error: See /opt/local/var/macports/logs/_Users_marbre_ports_math_reduce/libreduce/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to report a bug.
Error: Processing of port libreduce failed

So I did the following:

    use_autoreconf yes
    autoreconf.dir ${worksrcpath}/generic/libreduce/src

    pre-configure {
        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
        
        configure.dir ${worksrcpath}/generic/libreduce/${builddir}
        configure.cmd ${autoreconf.dir}/configure
        configure.args-append --disable-universal
        
        xinstall -d ${configure.dir}
    }

    pre-build {
        set builddir [exec ${worksrcpath}/scripts/findhost.sh [exec ${worksrcpath}/config.guess]]
        build.dir ${worksrcpath}/generic/libreduce/${builddir}
    }



Mark Brethen



On Oct 28, 2018, at 17:03, Mark Brethen wrote:

It looks to me that it failed because the source does not provide a ‘setup.py’ configuration file. Apple must provide a default setup.

setup.py is where a python project defines how it is to be set up. It's like a configure file. It's specific to each project. There isn't a default. Maybe for this software the configure script creates the setup.py file; I'm not sure.

Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Mark Brethen-2
In reply to this post by Ryan Schmidt-24

Mark Brethen



On Oct 28, 2018, at 5:46 PM, Ryan Schmidt <[hidden email]> wrote:

setup.py is where a python project defines how it is to be set up. It's like a configure file. It's specific to each project. There isn't a default. Maybe for this software the configure script creates the setup.py file; I'm not sure.

RedPy.so is written in c code. The makefile has this:

RedPy.o: $(srcdir)/RedPy.c
$(CC) -c $(CFLAGS) $(shell python-config --includes) -o RedPy.o $(srcdir)/RedPy.c





RedPy.c (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Mark Brethen-2
There is no python setup file. The makefile uses python-config to get the path to the python header files. When port select sets python to none, it builds with apple python 2.7 without error. When port select sets python to python27 it fails because it cannot find a python setup.

In the terminal, with it set to python27 I get:

brethen-air:~ marbre$ python-config --includes
-I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

with it set to none:

brethen-air:~ marbre$ python-config --includes
-bash: /opt/local/bin/python-config: No such file or directory

but /usr/bin//usr/bin/python-config works,

brethen-air:~ marbre$ /usr/bin/python-config --includes
-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7


Mark Brethen



On Oct 28, 2018, at 6:23 PM, Mark Brethen <[hidden email]> wrote:


Mark Brethen



On Oct 28, 2018, at 5:46 PM, Ryan Schmidt <[hidden email]> wrote:

setup.py is where a python project defines how it is to be set up. It's like a configure file. It's specific to each project. There isn't a default. Maybe for this software the configure script creates the setup.py file; I'm not sure.

RedPy.so is written in c code. The makefile has this:

RedPy.o: $(srcdir)/RedPy.c
$(CC) -c $(CFLAGS) $(shell python-config --includes) -o RedPy.o $(srcdir)/RedPy.c

<RedPy.c>



Reply | Threaded
Open this post in threaded view
|

Re: port select python and config error

Joshua Root-8
On 2018-10-29 10:49 , Mark Brethen wrote:

> There is no python setup file. The makefile uses python-config to get
> the path to the python header files. When port select sets python to
> none, it builds with apple python 2.7 without error. When port select
> sets python to python27 it fails because it cannot find a python setup.
>
> In the terminal, with it set to python27 I get:
>
> brethen-air:~ marbre$ python-config --includes
> -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
>
> with it set to none:
>
> brethen-air:~ marbre$ python-config --includes
> -bash: /opt/local/bin/python-config: No such file or directory
>
> but /usr/bin//usr/bin/python-config works,
>
> brethen-air:~ marbre$ /usr/bin/python-config --includes
> -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
> -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

Then you need to tell the makefile to use ${prefix}/bin/python2.7-config
if you want it to use the python27 port.

- Josh