I am trying to include the pybind11 vcpkg port in a CMake project that also depends on MLIR (which I don't include via vcpkg). Both work independently, but when used together, MLIR is unable to find Development.Module NumPy. MLIR already has already introduced the MLIR_DETECT_PYTHON_ENV_PRIME_SEARCH variable to deal with the partially broken Python search capabilities of CMake, see here. But whether or not this is set, the problem remains for me (at least on MacOS). Python is found but the NumPy development module is not.
Environment
OS: MacOS
Compiler: clang 16.0.0
To Reproduce
A minimal example just involves adding pybind11 via vcpkg, setting CMAKE_TOOLCHAIN_FILE and Python3_EXECUTABLE appropriately and then adding the following in CMakeLists.txt (making MLIR_DIR point to an installation of MLIR):
I would expect this to just work out of the box. When I integrate pybind11 into my project without vcpkg, i.e. by just pointing pybind11_DIR to an installation of pybind11 it works.
Failure logs
CMake Error at /opt/homebrew/Cellar/cmake/3.30.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
Could NOT find Python3 (missing: Development.Module NumPy) (found version
"3.12.7")
Call Stack (most recent call first):
/opt/homebrew/Cellar/cmake/3.30.5/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
/opt/homebrew/Cellar/cmake/3.30.5/share/cmake/Modules/FindPython/Support.cmake:4001 (find_package_handle_standard_args)
/opt/homebrew/Cellar/cmake/3.30.5/share/cmake/Modules/FindPython3.cmake:602 (include)
build-debug/vcpkg_installed/arm64-osx/share/python3/vcpkg-cmake-wrapper.cmake:72 (_find_package)
/Users/timonicolai/github/vcpkg/scripts/buildsystems/vcpkg.cmake:813 (include)
/Users/timonicolai/github/llvm-project/build/lib/cmake/mlir/MLIRDetectPythonEnv.cmake:21 (find_package)
CMakeLists.txt:39 (mlir_configure_python_dev_packages)
Describe the bug
I am trying to include the
pybind11
vcpkg port in a CMake project that also depends on MLIR (which I don't include via vcpkg). Both work independently, but when used together, MLIR is unable to findDevelopment.Module NumPy
. MLIR already has already introduced theMLIR_DETECT_PYTHON_ENV_PRIME_SEARCH
variable to deal with the partially broken Python search capabilities of CMake, see here. But whether or not this is set, the problem remains for me (at least on MacOS). Python is found but the NumPy development module is not.Environment
To Reproduce
A minimal example just involves adding
pybind11
via vcpkg, settingCMAKE_TOOLCHAIN_FILE
andPython3_EXECUTABLE
appropriately and then adding the following inCMakeLists.txt
(makingMLIR_DIR
point to an installation of MLIR):Expected behavior
I would expect this to just work out of the box. When I integrate pybind11 into my project without vcpkg, i.e. by just pointing
pybind11_DIR
to an installation of pybind11 it works.Failure logs