-
Notifications
You must be signed in to change notification settings - Fork 253
Labels
cuda.pathfinderEverything related to the cuda.pathfinder moduleEverything related to the cuda.pathfinder module
Description
This summarizes a group chat discussion and additionally documents Cursor-based verification:
Problem
When cuda.pathfinder.load_nvidia_dynamic_lib searches for NVIDIA dynamic libraries in site-packages, it currently searches in the following order unconditionally:
- User site-packages (
site.getusersitepackages()) - Site packages from
site.getsitepackages()(which includes both virtual environment and system site-packages)
This ordering causes issues in a venv created with --system-site-packages: according to PEP 405 the correct search order should be (verified as explained below):
- Virtual environment site-packages
- User site-packages
- System site-packages
Cursor-based verification
PEP 405 (Virtual Environments):
- States that in a
venvwith--system-site-packages, system site directories are added after virtual environment site directories. - Notes that PEP 370 user-level site-packages are considered part of system site-packages for
venvpurposes.
PEP 370 (User Site-Packages):
- States that user-site-packages are added before system site-packages (outside
venvcontext).
Actual Python Behavior (verified by test):
In a venv with --system-site-packages, Python's sys.path order is:
- Virtual environment site-packages
- User site-packages
- System site-packages
This confirms that the correct search order described above matches both PEP 405, PEP 370, and Python's actual behavior.
References
- PEP 405: https://peps.python.org/pep-0405/
- PEP 370: https://peps.python.org/pep-0370/
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
cuda.pathfinderEverything related to the cuda.pathfinder moduleEverything related to the cuda.pathfinder module