Skip to content

[BUG]: Windows system search does use PATH, contrary to docs #3137

Open

Description

@yangcal

Is this a duplicate?

Type of Bug

Runtime Error

Component

cuda.pathfinder

Describe the bug

The load_nvidia_dynamic_lib docs say that on Windows the system search step doesn't look at PATH. #1781 was closed on that basis. But in practice it does find DLLs on PATH.
We hit this in nvmath-python CI. CUDA_PATH pointed at CTK 12.8, but CTK 13.4 was also on PATH:

load_nvidia_dynamic_lib("cublasLt")
-> ...\CUDA\v13.4\bin\x64\cublasLt64_13.dll, found_via="system-search"

System search runs before the CUDA_PATH step, so the 13.4 DLL won over the toolkit we'd selected. cutensor (cu12 wheel) then failed to load with Windows error 126, because it needs cublasLt64_12.dll.

How to Reproduce

Small repro, no CUDA needed. It makes the same call pathfinder's system search makes
(LoadLibraryExW(name, NULL, 0) in load_with_system_search), with a dummy DLL that
only lives in a folder on PATH:

import ctypes, os, shutil, subprocess, sys, tempfile
d = tempfile.mkdtemp()
shutil.copy(os.path.join(os.environ["SystemRoot"], "System32", "version.dll"),
            os.path.join(d, "zz_probe.dll"))
child = ("import ctypes; k = ctypes.WinDLL('kernel32');"
         "k.LoadLibraryExW.restype = ctypes.c_void_p;"
         "print(bool(k.LoadLibraryExW('zz_probe.dll', None, 0)))")
env = dict(os.environ, PATH=d + os.pathsep + os.environ["PATH"])
subprocess.run([sys.executable, "-c", child], env=env)  # prints True

Expected behavior

load_nvidia_dynamic_lib("cublasLt") should either skip PATH on as doc claimed on windows, or update the docs

Operating System

Windows

nvidia-smi output

No response

Activity

  1. nanookclaw commented on Oct 17, 2026

    @nanookclaw

    I would like to work on this issue. I can prepare the smallest targeted change in the Windows loader/search-step path, with focused regression coverage for the documented PATH behavior. Please assign the issue if that direction is appropriate; I will wait for maintainer confirmation before starting implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions