From c8b4cd24e0f910a94a8ed2a7d3344e526a220ed2 Mon Sep 17 00:00:00 2001 From: horribleCodes Date: Fri, 5 Jun 2026 21:34:41 +0200 Subject: [PATCH] fix: Add WSL paths to hardware detection fallback (#2933) This change extends both the `PATH` variable and the list of absolute paths used to locate the `nvidia-smi` package to include `/usr/lib/wsl/lib`. This path is a candidate for the default location of nvidia-smi for WSL machines (tested on WSL Ubuntu 22.04.5). --- services/hwfit/hardware.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/hwfit/hardware.py b/services/hwfit/hardware.py index f961b7040..191f0e61d 100644 --- a/services/hwfit/hardware.py +++ b/services/hwfit/hardware.py @@ -82,14 +82,14 @@ def _detect_nvidia(): # Retry through a login shell with the common CUDA bin dirs on PATH. if not out and _remote_host: out = _run( - "bash -lc 'export PATH=\"$PATH:/usr/bin:/usr/local/bin:/usr/local/cuda/bin\"; " + "bash -lc 'export PATH=\"$PATH:/usr/bin:/usr/local/bin:/usr/local/cuda/bin:/usr/lib/wsl/lib\"; " "nvidia-smi --query-gpu=memory.total,name --format=csv,noheader,nounits'" ) # Last resort: call nvidia-smi by absolute path. Some hosts have a login # shell that isn't bash (or a profile that errors), so the bash -lc retry # above still comes back empty even though the binary is right there. if not out and _remote_host: - for _p in ("/usr/bin/nvidia-smi", "/usr/local/bin/nvidia-smi", "/usr/local/cuda/bin/nvidia-smi"): + for _p in ("/usr/bin/nvidia-smi", "/usr/local/bin/nvidia-smi", "/usr/local/cuda/bin/nvidia-smi", "/usr/lib/wsl/lib/nvidia-smi"): out = _run(f"{_p} --query-gpu=memory.total,name --format=csv,noheader,nounits") if out: break