Repository navigation
Description
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct.
Type of Bug
Runtime Error
Component
cuda.pathfinder
Describe the bug
When a static or bitcode library is missing, the CUDA Toolkit search tries to list the target directory for diagnostics. If the directory is searchable but not readable, the listing raises PermissionError and replaces the documented BitcodeLibNotFoundError or StaticLibNotFoundError. A caller catching the documented exception cannot handle the missing library as expected.
The same problem occurs if the directory disappears between the directory check and the diagnostic listing.
Reproduced on main at commit deb3d040b6d31b8514f19d026c298982c9b6260b.
How to Reproduce
Run as an unprivileged user on a POSIX filesystem, in a clean Python environment without NVIDIA wheel directories taking precedence:
import os
import tempfile
from pathlib import Path
from cuda.pathfinder import (
find_bitcode_lib,
find_static_lib,
get_cuda_path_or_home,
locate_bitcode_lib,
locate_static_lib,
)
os.environ.pop("CUDA_PATH", None)
os.environ.pop("CONDA_PREFIX", None)
with tempfile.TemporaryDirectory() as temporary:
root = Path(temporary)
directories = [root / "nvvm" / "libdevice", root / "lib64"]
for directory in directories:
directory.mkdir(parents=True)
directory.chmod(0o111)
os.environ["CUDA_HOME"] = str(root)
get_cuda_path_or_home.cache_clear()
try:
for name, lookup in (
("find_bitcode", lambda: find_bitcode_lib("device")),
("locate_bitcode", lambda: locate_bitcode_lib("device")),
("find_static", lambda: find_static_lib("cudadevrt")),
("locate_static", lambda: locate_static_lib("cudadevrt")),
):
try:
lookup()
except Exception as exc:
print(name, type(exc).__name__)
finally:
for directory in directories:
directory.chmod(0o700)Observed on Linux: all four calls print PermissionError.
Expected behavior
Bitcode lookups raise BitcodeLibNotFoundError, and static-library lookups raise StaticLibNotFoundError. The exception message should retain the original directory-listing failure so the permission problem remains visible.
Operating System
Linux x86_64 and aarch64, Python 3.12.3.
nvidia-smi output
Not GPU-dependent; reproduced with CUDA devices hidden.
Activity
Andy-Jost commentedon Nov 6, 2026
Thanks for the report and for the linked fix in #3367. This is triaged as a
cuda.pathfinderbug and assigned to the area owner, who will review the issue and the fix together.