cmake vs. Python 3.4

classic Classic list List threaded Threaded
11 messages Options
Lev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cmake vs. Python 3.4

Lev
Hi list,


I have this:

FIND_PACKAGE(PythonInterp)

and cmake finds this:

-- Found PythonInterp: /usr/bin/python (found version "2.7.9")

However, 3.4 is also installed. How can I specify to find 3.4?

If I say:

set(Python_ADDITIONAL_VERSIONS 3.4)
FIND_PACKAGE(PythonInterp 3 REQUIRED)

still no luck.

This is on a Debian stable, so

$ cmake --version
cmake version 3.0.2


Thanks,
Levente

--
73 de HA5OGL
Op.: Levente
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Alan W. Irwin
On 2016-12-23 20:57+0100 Lev wrote:

> Hi list,
>
>
> I have this:
>
> FIND_PACKAGE(PythonInterp)
>
> and cmake finds this:
>
> -- Found PythonInterp: /usr/bin/python (found version "2.7.9")
>
> However, 3.4 is also installed. How can I specify to find 3.4?
>
> If I say:
>
> set(Python_ADDITIONAL_VERSIONS 3.4)
> FIND_PACKAGE(PythonInterp 3 REQUIRED)
>
> still no luck.
>
> This is on a Debian stable, so
>
> $ cmake --version
> cmake version 3.0.2

Try using the update-alternatives command so that "python" becomes
symbolically linked to python-3.4 rather than python-2.7.9

Or uninstall python 2.7.9.

Alan

__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Scott Kitterman
On Friday, December 23, 2016 12:53:30 PM Alan W. Irwin wrote:

> On 2016-12-23 20:57+0100 Lev wrote:
> > Hi list,
> >
> >
> > I have this:
> >
> > FIND_PACKAGE(PythonInterp)
> >
> > and cmake finds this:
> >
> > -- Found PythonInterp: /usr/bin/python (found version "2.7.9")
> >
> > However, 3.4 is also installed. How can I specify to find 3.4?
> >
> > If I say:
> >
> > set(Python_ADDITIONAL_VERSIONS 3.4)
> > FIND_PACKAGE(PythonInterp 3 REQUIRED)
> >
> > still no luck.
> >
> > This is on a Debian stable, so
> >
> > $ cmake --version
> > cmake version 3.0.2
>
> Try using the update-alternatives command so that "python" becomes
> symbolically linked to python-3.4 rather than python-2.7.9
>
> Or uninstall python 2.7.9.

No.  Don't do that.  Debian (and its derivatives don't work that way).

The way I've done this before (when building for multiple python and python3
versions is to set:

PYTHON_EXECUTABLE=/usr/bin/python$v

Where $v would, in your case, be 3.4.

Scott K
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Lev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Lev
In reply to this post by Alan W. Irwin
On Fri, 23 Dec 2016 12:53:30 -0800 (PST)
"Alan W. Irwin" <[hidden email]> wrote:

> Try using the update-alternatives command so that "python" becomes
> symbolically linked to python-3.4 rather than python-2.7.9
>
> Or uninstall python 2.7.9.

Ok. Thanks both of you.


Merry XMAS,
Levente

--
73 de HA5OGL
Op.: Levente
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Roger Leigh
In reply to this post by Alan W. Irwin


On 23/12/16 20:53, Alan W. Irwin wrote:

> On 2016-12-23 20:57+0100 Lev wrote:
>
>> Hi list,
>>
>>
>> I have this:
>>
>> FIND_PACKAGE(PythonInterp)
>>
>> and cmake finds this:
>>
>> -- Found PythonInterp: /usr/bin/python (found version "2.7.9")
>>
>> However, 3.4 is also installed. How can I specify to find 3.4?
>>
>> If I say:
>>
>> set(Python_ADDITIONAL_VERSIONS 3.4)
>> FIND_PACKAGE(PythonInterp 3 REQUIRED)
>>
>> still no luck.
>>
>> This is on a Debian stable, so
>>
>> $ cmake --version
>> cmake version 3.0.2
>
> Try using the update-alternatives command so that "python" becomes
> symbolically linked to python-3.4 rather than python-2.7.9
>
> Or uninstall python 2.7.9.

This seems a little drastic; I wouldn't expect to have to alter the
system for cmake to do what I want.  Does FindPython not have logic to
check the versioned pythonx.y alternatives when doing these checks?  Why
isn't it checking the python3 and python3.x commands in this circumstance?

Or, give the incompatibility here, do we need a separate
FindPython3Interp and equivalents so that we can find Python 2 and 3
version of the executable and libs independently.  This is something
which has been bugging me for a while since the current behaviour seems
somewhat unsatisfactory.


Regards,
Roger
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Elizabeth A. Fischer
In reply to this post by Alan W. Irwin
 

Try using the update-alternatives command so that "python" becomes
symbolically linked to python-3.4 rather than python-2.7.9

Or uninstall python 2.7.9.

The standard Python distribution for versions 3 or greater installs a binary called `python3`, not `python`.  That is the standard.  If you are running Python3 from a binary called `python`, that is not standard.  I know that distros do this (or can do it with tweaking); but that doesn't make it standard.  If you want to be sure you're getting Python3, you should look for a binary called `python3`.

Does FindPython not have logic to check the versioned pythonx.y alternatives when doing these checks?  Why isn't it checking the python3 and python3.x commands in this circumstance?

Have you tried the FindPython I referenced above?  It would solve the problems you brought to this thread (and maybe even some you didn't yet know you have).


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fwd: cmake vs. Python 3.4

Elizabeth A. Fischer
In reply to this post by Lev
Ooops, this message was supposed to be "Reply All"

---------- Forwarded message ----------
From: Elizabeth A. Fischer <[hidden email]>
Date: Fri, Dec 23, 2016 at 3:28 PM
Subject: Re: [CMake] cmake vs. Python 3.4
To: Lev <[hidden email]>


Look for a binary called `python3`, not `python`.  See here:


The `FindPython.cmake` I shared above also queries the Python system for the correct place to install things.  See here for how it's used:



On Fri, Dec 23, 2016 at 2:57 PM, Lev <[hidden email]> wrote:
Hi list,


I have this:

FIND_PACKAGE(PythonInterp)

and cmake finds this:

-- Found PythonInterp: /usr/bin/python (found version "2.7.9")

However, 3.4 is also installed. How can I specify to find 3.4?

If I say:

set(Python_ADDITIONAL_VERSIONS 3.4)
FIND_PACKAGE(PythonInterp 3 REQUIRED)

still no luck.

This is on a Debian stable, so

$ cmake --version
cmake version 3.0.2


Thanks,
Levente

--
73 de HA5OGL
Op.: Levente
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Dan Liew
In reply to this post by Lev


On 23 Dec 2016 7:58 pm, "Lev" <[hidden email]> wrote:
Hi list,


I have this:

FIND_PACKAGE(PythonInterp)

and cmake finds this:

-- Found PythonInterp: /usr/bin/python (found version "2.7.9")

However, 3.4 is also installed. How can I specify to find 3.4?

If I say:

set(Python_ADDITIONAL_VERSIONS 3.4)
FIND_PACKAGE(PythonInterp 3 REQUIRED)

still no luck.

When you did that did you wipe the CMake cache (e.g. delete any existing binary build directory)? In many cases where CMake is asked to find a binary it will create a cache variable if it was found so that on subsequent runs of CMake it doesn't have to search for it again. You may be hitting this. 


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Rolf Eike Beer
In reply to this post by Lev
Am Freitag, 23. Dezember 2016, 20:57:49 schrieb Lev:

> Hi list,
>
>
> I have this:
>
> FIND_PACKAGE(PythonInterp)
>
> and cmake finds this:
>
> -- Found PythonInterp: /usr/bin/python (found version "2.7.9")
>
> However, 3.4 is also installed. How can I specify to find 3.4?
>
> If I say:
>
> set(Python_ADDITIONAL_VERSIONS 3.4)
> FIND_PACKAGE(PythonInterp 3 REQUIRED)
The problem here is the "REQUIRED". Older CMake versions did not let "3.4"
satisfy "3" as required version, what newer versions do. However they let it
pass as a minimum version. And you don't need to add 3.4 to the list of
supported versions, if I read the log correct then 3.4 is already in the list
for CMake 3.0.

Eike, having done most of this version detection stuff
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Rolf Eike Beer
Am Samstag, 24. Dezember 2016, 12:06:10 schrieb Rolf Eike Beer:

> Am Freitag, 23. Dezember 2016, 20:57:49 schrieb Lev:
> > Hi list,
> >
> >
> > I have this:
> >
> > FIND_PACKAGE(PythonInterp)
> >
> > and cmake finds this:
> >
> > -- Found PythonInterp: /usr/bin/python (found version "2.7.9")
> >
> > However, 3.4 is also installed. How can I specify to find 3.4?
> >
> > If I say:
> >
> > set(Python_ADDITIONAL_VERSIONS 3.4)
> > FIND_PACKAGE(PythonInterp 3 REQUIRED)
>
> The problem here is the "REQUIRED". Older CMake versions did not let "3.4"
> satisfy "3" as required version, what newer versions do. However they let it
> pass as a minimum version. And you don't need to add 3.4 to the list of
> supported versions, if I read the log correct then 3.4 is already in the
> list for CMake 3.0.
Ehm, the "3" would not satisfy EXACT, but it of course satisfies REQUIRED. And
it works for me, btw.

Eike
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

signature.asc (188 bytes) Download Attachment
Lev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: cmake vs. Python 3.4

Lev
In reply to this post by Dan Liew
Yes. That did the trick. Sorry for the noise.

On 23 Dec 2016 23:52, "Dan Liew" <[hidden email]> wrote:


On 23 Dec 2016 7:58 pm, "Lev" <[hidden email]> wrote:
Hi list,


I have this:

FIND_PACKAGE(PythonInterp)

and cmake finds this:

-- Found PythonInterp: /usr/bin/python (found version "2.7.9")

However, 3.4 is also installed. How can I specify to find 3.4?

If I say:

set(Python_ADDITIONAL_VERSIONS 3.4)
FIND_PACKAGE(PythonInterp 3 REQUIRED)

still no luck.

When you did that did you wipe the CMake cache (e.g. delete any existing binary build directory)? In many cases where CMake is asked to find a binary it will create a cache variable if it was found so that on subsequent runs of CMake it doesn't have to search for it again. You may be hitting this. 


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...