Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion tilelang/jit/adapter/cython/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import fcntl
from pathlib import Path
import logging
import site

logger = logging.getLogger(__name__)

Expand All @@ -39,7 +40,23 @@ def get_cython_compiler() -> Optional[str]:
"""

cython_names = ["cython", "cython3"]
dirs_in_path = os.get_exec_path()

# Check system PATH
dirs_in_path = list(os.get_exec_path())

# Add user site-packages bin directory
user_base = site.getuserbase()
if user_base:
user_bin = os.path.join(user_base, "bin")
if os.path.exists(user_bin):
dirs_in_path = [user_bin] + dirs_in_path

# If in a virtual environment, add its bin directory
if sys.prefix != sys.base_prefix:
venv_bin = os.path.join(sys.prefix, "bin")
if os.path.exists(venv_bin):
dirs_in_path = [venv_bin] + dirs_in_path

for cython_name in cython_names:
for d in dirs_in_path:
cython_path = os.path.join(d, cython_name)
Expand Down