From bd7c17708bf71629080f0f6b09449f36eb5271f8 Mon Sep 17 00:00:00 2001 From: Roland Tannous Date: Fri, 27 Feb 2026 21:50:54 +0000 Subject: [PATCH] Set short TORCHINDUCTOR_CACHE_DIR to fix Windows MAX_PATH crash --- setup.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/setup.ps1 b/setup.ps1 index cbf636983f..10e7900d44 100644 --- a/setup.ps1 +++ b/setup.ps1 @@ -493,6 +493,15 @@ pip install --upgrade pip 2>&1 | Out-Null # PyTorch bundles its own CUDA runtime, so this works regardless # of whether the CUDA Toolkit is installed yet. # The CUDA tag is chosen based on the driver's max supported CUDA version. + +# Windows MAX_PATH (260 chars) causes Triton kernel compilation to fail because +# the auto-generated filenames are extremely long. Use a short cache directory. +$TorchCacheDir = "C:\tc" +if (-not (Test-Path $TorchCacheDir)) { New-Item -ItemType Directory -Path $TorchCacheDir -Force | Out-Null } +$env:TORCHINDUCTOR_CACHE_DIR = $TorchCacheDir +[Environment]::SetEnvironmentVariable('TORCHINDUCTOR_CACHE_DIR', $TorchCacheDir, 'User') +Write-Host "[OK] TORCHINDUCTOR_CACHE_DIR set to $TorchCacheDir (avoids MAX_PATH issues)" -ForegroundColor Green + $CuTag = Get-PytorchCudaTag Write-Host " Installing PyTorch with CUDA support ($CuTag)..." -ForegroundColor Cyan pip install torch torchvision torchaudio --index-url "https://download.pytorch.org/whl/$CuTag" 2>&1 | Out-Null