From addaeb6601aa8c136b44ccfca854667a4c333927 Mon Sep 17 00:00:00 2001 From: Graham Markall Date: Wed, 4 Dec 2024 17:24:41 +0000 Subject: [PATCH] Fix choice of conda package for includes (on Windows) The path to CUDA includes may exist in a conda environment even if they are not present, particularly on Windows where the include path is just `$CONDA_PREFIX\Library\include`. Therefore, the presence of the include dir alone doesn't signify that the CUDA includes are actually present in that location - we also need to check whether a relevant header file exists. --- numba_cuda/numba/cuda/cuda_paths.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/numba_cuda/numba/cuda/cuda_paths.py b/numba_cuda/numba/cuda/cuda_paths.py index fb73917..4290a0a 100644 --- a/numba_cuda/numba/cuda/cuda_paths.py +++ b/numba_cuda/numba/cuda/cuda_paths.py @@ -310,7 +310,9 @@ def get_conda_include_dir(): # though usually it shouldn't. include_dir = os.path.join(sys.prefix, 'include') - if os.path.exists(include_dir): + if (os.path.exists(include_dir) and os.path.isdir(include_dir) + and os.path.exists(os.path.join(include_dir, + 'cuda_device_runtime_api.h'))): return include_dir return