Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python3] vcpkg-cmake-wrapper.cmake prevents finding system installed Python #42322

Open
nickanthony-dgl opened this issue Nov 22, 2024 · 2 comments
Assignees
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist

Comments

@nickanthony-dgl
Copy link

One of the packages listed in my manifest ("pybind11") has the "python3" package listed as a dependency which causes vcpkg to install Python 3.11. However, I have by own version of Python that I want to use like so: find_package(Python3 3.12 COMPONENTS Interpreter Development REQUIRED). When I didn't have vcpkg's Pyton 3.11 installed this worked fine, however I am now getting an error.

CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Python3: Found unsuitable version "3.11.10", but required is
  at least "3.12" (found
  C:/Users/NicholasAnthony/source/repos/wt_gui/external/WaveTracer/out/build/MSVC-Release/vcpkg_installed/x64-windows-digilens/tools/python3/python.exe,
  found components: Interpreter Development Development.Module
  Development.Embed)
Call Stack (most recent call first):
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:598 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPython/Support.cmake:3867 (find_package_handle_standard_args)
  C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29/Modules/FindPython3.cmake:545 (include)
  out/build/MSVC-Release/vcpkg_installed/x64-windows-digilens/share/python3/vcpkg-cmake-wrapper.cmake:72 (_find_package)
  C:/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
  src/wt_imageAnalysisPy/CMakeLists.txt:2 (find_package)

It seems that this is because of this section in vcpkg-cmake-wrapper is overriding cmake's default behavior for finding python in order to force that VCPKG's version is found.

Environment

  • OS: Windows

Expected behavior
CMake's find_package(Python3 3.12 COMPONENTS Interpreter Development REQUIRED) works even when VCPKg has installed Python

@jimwang118 jimwang118 added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Nov 25, 2024
@jimwang118
Copy link
Contributor

You can use overlay-port to override vcpkg's python3 and use the python3 you installed.

@dg0yt
Copy link
Contributor

dg0yt commented Nov 25, 2024

Full discussion in #42323.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
Development

No branches or pull requests

3 participants