FindPython3 Python_FIND_VIRTUALENV seems to be ignored

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

FindPython3 Python_FIND_VIRTUALENV seems to be ignored

sebastian.mueller3

Hi all,

 

I’ve been trying to convince Cmake 15.1 to use the python installation in my virtual anaconda environment rather than the anaconda base installation.

I’m using this to find python:

 

set(Python3_FIND_VIRTUALENV "FIRST")

find_package(Python3 3.6.8 EXACT COMPONENTS Development NumPy)

 

First, I’m using Anaconda Prompt to execute the commands. I `activate testenv`, to activate my environment.

When I then run `cmake .. -G "Visual Studio 14 2015 Win64"`, I get this output:

 

-- Selecting Windows SDK version  to target Windows 10.0.16299.

-- The C compiler identification is MSVC 19.0.24215.1

-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe

-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe – works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info – done

-- Detecting C compile features

-- Detecting C compile features - done

-- Found Git: C:/app/tools/Git/cmd/git.exe (found version "2.17.1.windows.2")

-- Could NOT find Python3: Found unsuitable version "3.6.4", but required is exact version "3.6.8" (found C:/app/anaconda3/libs/python36.lib)

-- Configuring done

-- Generating done

-- Build files have been written to: D:/src/project/vsbuild

 

I would expect cmake rather to find the python in C:/app/anaconda3/envs/testenv/… since this is the active environment and according to the

HINT I set it to be favored over other python installations (as documented in https://cmake.org/cmake/help/v3.15/module/FindPython3.html).

 

Additional info:

$ which python

C:/app/anaconda3/envs/testenv/python.exe

$ python –version

Python 3.6.8 :: Anaconda, Inc.

 

I’m working on Windows 10. Any ideas what is going wrong?

 

Kind regards/Viele Grüße

Sebastian Müller

 


--

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:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: FindPython3 Python_FIND_VIRTUALENV seems to be ignored

Marc CHEVRIER
This is a bug already identified (see https://gitlab.kitware.com/cmake/cmake/issues/19525).

I am currently working on a fix.
Le 1 août 2019 à 11:33 +0200, [hidden email], a écrit :

Hi all,

 

I’ve been trying to convince Cmake 15.1 to use the python installation in my virtual anaconda environment rather than the anaconda base installation.

I’m using this to find python:

 

set(Python3_FIND_VIRTUALENV "FIRST")

find_package(Python3 3.6.8 EXACT COMPONENTS Development NumPy)

 

First, I’m using Anaconda Prompt to execute the commands. I `activate testenv`, to activate my environment.

When I then run `cmake .. -G "Visual Studio 14 2015 Win64"`, I get this output:

 

-- Selecting Windows SDK version  to target Windows 10.0.16299.

-- The C compiler identification is MSVC 19.0.24215.1

-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe

-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe – works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info – done

-- Detecting C compile features

-- Detecting C compile features - done

-- Found Git: C:/app/tools/Git/cmd/git.exe (found version "2.17.1.windows.2")

-- Could NOT find Python3: Found unsuitable version "3.6.4", but required is exact version "3.6.8" (found C:/app/anaconda3/libs/python36.lib)

-- Configuring done

-- Generating done

-- Build files have been written to: D:/src/project/vsbuild

 

I would expect cmake rather to find the python in C:/app/anaconda3/envs/testenv/… since this is the active environment and according to the

HINT I set it to be favored over other python installations (as documented in https://cmake.org/cmake/help/v3.15/module/FindPython3.html).

 

Additional info:

$ which python

C:/app/anaconda3/envs/testenv/python.exe

$ python –version

Python 3.6.8 :: Anaconda, Inc.

 

I’m working on Windows 10. Any ideas what is going wrong?

 

Kind regards/Viele Grüße

Sebastian Müller

 

--

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:
https://cmake.org/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:
https://cmake.org/mailman/listinfo/cmake