fix: improve Python detection in manylinux environment

- Modify faiss CMakeLists.txt to try both FindPython and FindPython3
- Add scikit-build configuration to help with Python detection
- Simplify Linux environment variables in cibuildwheel
- Add CMake Python detection before faiss configuration
This commit is contained in:
Andy Lee
2025-07-25 10:27:04 -07:00
parent 0543cc9816
commit 13413dfae5
3 changed files with 38 additions and 3 deletions

View File

@@ -24,6 +24,23 @@ set(MSGPACK_USE_BOOST OFF CACHE BOOL "" FORCE)
add_compile_definitions(MSGPACK_NO_BOOST)
include_directories(third_party/msgpack-c/include)
# Find Python before configuring Faiss
# Check if we're in scikit-build environment
if(DEFINED SKBUILD)
message(STATUS "Building with scikit-build, using provided Python")
# scikit-build-core provides Python_* variables
else()
find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
endif()
# Print Python information for debugging
message(STATUS "Python_FOUND: ${Python_FOUND}")
message(STATUS "Python_VERSION: ${Python_VERSION}")
message(STATUS "Python_EXECUTABLE: ${Python_EXECUTABLE}")
message(STATUS "Python_INCLUDE_DIRS: ${Python_INCLUDE_DIRS}")
message(STATUS "Python_LIBRARIES: ${Python_LIBRARIES}")
message(STATUS "Python_NumPy_INCLUDE_DIRS: ${Python_NumPy_INCLUDE_DIRS}")
# Faiss configuration - streamlined build
set(FAISS_ENABLE_PYTHON ON CACHE BOOL "" FORCE)
set(FAISS_ENABLE_GPU OFF CACHE BOOL "" FORCE)

View File

@@ -24,4 +24,5 @@ cmake.verbose = true
# CMake definitions to optimize compilation
[tool.scikit-build.cmake.define]
CMAKE_BUILD_PARALLEL_LEVEL = "8"
CMAKE_BUILD_PARALLEL_LEVEL = "8"
SKBUILD_SOABI = "YES"