Skip to content

Commit 0c71c35

Browse files
committed
also search for conda nvvm on windows
1 parent d425a88 commit 0c71c35

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cuda_bindings/cuda/bindings/_internal/nvvm_windows.pyx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ cdef void* __nvvmGetProgramLog = NULL
4141

4242

4343
cdef inline list get_site_packages():
44-
return [site.getusersitepackages()] + site.getsitepackages()
44+
return [site.getusersitepackages()] + site.getsitepackages() + ["conda"]
4545

4646

4747
cdef load_library(const int driver_ver):
@@ -60,9 +60,13 @@ cdef load_library(const int driver_ver):
6060
else:
6161
break
6262

63-
# Next, check if DLLs are installed via pip
63+
# Next, check if DLLs are installed via pip or conda
6464
for sp in get_site_packages():
65-
mod_path = os.path.join(sp, "nvidia", "cuda_nvcc", "nvvm", "bin")
65+
if sp == "conda" and "CONDA_PREFIX" in os.environ:
66+
# nvvm is not under $CONDA_PREFIX/lib, so it's not in the default search path
67+
mod_path = os.path.join(os.environ["CONDA_PREFIX"], "Library", "nvvm", "bin")
68+
else:
69+
mod_path = os.path.join(sp, "nvidia", "cuda_nvcc", "nvvm", "bin")
6670
if not os.path.isdir(mod_path):
6771
continue
6872
os.add_dll_directory(mod_path)

0 commit comments

Comments
 (0)