I am using cmake version 3.17 on windows with the following code to find the Python3 interpreter.
set(Python3_FIND_VIRTUALENV FIRST)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
For the python3 virtual environment, it fails with the following error
CMake Error at D:/.conan/b17c57/1/share/cmake-3.17/Modules/FindPython/Support.cmake:1313 (list):
list index: 10 out of range (-10, 9)
Call Stack (most recent call first):
D:/.conan/b17c57/1/share/cmake-3.17/Modules/FindPython3.cmake:311 (include)
I tried to print the values of _Python3_INTERPRETER_PROPERTIES for which the indexing is failing.
0:Python
1:3
2:6
3:6
4:64
5:cp36-win_amd64
6:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib
7:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib
8:D:\work\projects\devops\cip\temp\cip_build_system\venv\Lib\site-packages
9:D:\work\projects\devops\cip\temp\cip_build_system\venv\Lib\site-packages
CMake Error at D:/.conan/b17c57/1/share/cmake-3.17/Modules/FindPython/Support.cmake:1297 (list):
list index: 10 out of range (-10, 9)
when I replaced it with find_package(PythonInterp 3.5 REQUIRED) it works fine with following values for _Python3_INTERPRETER_PROPERTIES
0:Python
1:3
2:6
3:6
4:64
5:
6:cp36-win_amd64
7:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib
8:C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\Lib
9:D:\work\projects\devops\cip\temp\cip_build_system\venv\Lib\site-packages
10:D:\work\projects\devops\cip\temp\cip_build_system\venv\Lib\site-packages
In the error case Python3_SOABI is missing. Any idea how can I fix this since PythonInterp is deprecated since cmake version 3.12?