Skip to content

Commit

Permalink
Set PYTHON_INCLUDE_DIR in setup.py
Browse files Browse the repository at this point in the history
Prevents
```
      CMake Error at /home/bas.nijholt/micromamba/envs/qsim/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
        Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (Required is at
        least version "3.7")
      Call Stack (most recent call first):
        /home/bas.nijholt/micromamba/envs/qsim/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
        /home/bas.nijholt/micromamba/envs/qsim/share/cmake-3.27/Modules/FindPythonLibs.cmake:323 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
        pybind_interface/cuda/CMakeLists.txt:18 (find_package)
```
  • Loading branch information
basnijholt committed Dec 6, 2023
1 parent 1f37b8b commit 34cab62
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil
import platform
import subprocess
import sysconfig

from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
Expand Down Expand Up @@ -38,10 +39,12 @@ def run(self):

def build_extension(self, ext):
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
python_include_dir = sysconfig.get_path("include")
cmake_args = [
"-DCMAKE_CUDA_COMPILER=nvcc",
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=" + extdir,
"-DPYTHON_EXECUTABLE=" + sys.executable,
"-DPYTHON_INCLUDE_DIR=" + python_include_dir,
]

cfg = "Debug" if self.debug else "Release"
Expand Down

0 comments on commit 34cab62

Please sign in to comment.