File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313import tempfile
1414from warnings import warn
1515
16- from cuda .pathfinder ._utils .env_vars import get_cuda_home_or_path
1716from Cython import Tempita
1817from Cython .Build import cythonize
1918from pyclibrary import CParser
2726# ----------------------------------------------------------------------
2827# Fetch configuration options
2928
30- CUDA_HOME = get_cuda_home_or_path ()
29+ try :
30+ from cuda .pathfinder ._utils .env_vars import get_cuda_home_or_path
31+ CUDA_HOME = get_cuda_home_or_path ()
32+ except ImportError :
33+ # Fallback for build environments where cuda-pathfinder may not be available
34+ CUDA_HOME = os .environ .get ("CUDA_HOME" , os .environ .get ("CUDA_PATH" , None ))
35+
3136if not CUDA_HOME :
3237 raise RuntimeError ("Environment variable CUDA_PATH or CUDA_HOME is not set" )
3338
Original file line number Diff line number Diff line change @@ -31,9 +31,13 @@ def _get_cuda_paths() -> list[str]:
3131 Supports multiple paths separated by os.pathsep (: on Unix, ; on Windows).
3232 Returns a list of paths for use in include_dirs and library_dirs.
3333 """
34- from cuda .pathfinder ._utils .env_vars import get_cuda_home_or_path
35-
36- CUDA_PATH = get_cuda_home_or_path ()
34+ try :
35+ from cuda .pathfinder ._utils .env_vars import get_cuda_home_or_path
36+ CUDA_PATH = get_cuda_home_or_path ()
37+ except ImportError :
38+ # Fallback for build environments where cuda-pathfinder may not be available
39+ CUDA_PATH = os .environ .get ("CUDA_PATH" , os .environ .get ("CUDA_HOME" , None ))
40+
3741 if not CUDA_PATH :
3842 raise RuntimeError ("Environment variable CUDA_PATH or CUDA_HOME is not set" )
3943 CUDA_PATH = CUDA_PATH .split (os .pathsep )
You can’t perform that action at this time.
0 commit comments