From f9e1b313c34255a36004d34d54dff0ad467ad27e Mon Sep 17 00:00:00 2001 From: zaber <20830726+ZaberKo@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:29:22 +0800 Subject: [PATCH 1/5] fix issues in win-install.bat --- docs/source/_static/win-install.bat | 87 ++++++++++++++++++++++++----- 1 file changed, 72 insertions(+), 15 deletions(-) diff --git a/docs/source/_static/win-install.bat b/docs/source/_static/win-install.bat index 63022396..0512e6e6 100644 --- a/docs/source/_static/win-install.bat +++ b/docs/source/_static/win-install.bat @@ -65,7 +65,6 @@ if %errorlevel% neq 0 ( REM Install Miniforge3 (example using curl) -@REM where conda > nul 2>&1 echo [INFO] Downloading Miniforge... if not exist "%UserProfile%\miniforge3" ( curl -L -o Miniforge3-Windows-x86_64.exe https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Windows-x86_64.exe @@ -81,29 +80,36 @@ if not exist "%UserProfile%\miniforge3" ( REM Temp activate conda call %UserProfile%\miniforge3\Scripts\activate.bat %UserProfile%\miniforge3 -call mamba info -echo [INFO] Installing EvoX packages... +call conda info + +echo [INFO] Creating evox-env environment... call conda env list | findstr "evox-env" >nul if %ERRORLEVEL%==0 ( echo Environment evox-env already exists. Removing... call conda env remove -n evox-env -y ) -call mamba create -n evox-env python=3.12 -y -call mamba activate evox-env +call conda create -n evox-env python=3.12 -y +call conda activate evox-env + +echo [INFO] Installing basic packages... pip install numpy jupyterlab nbformat + +echo [INFO] Installing Pytorch packages... if /i "!use_cpu!"=="Y" ( - pip install torch + pip install "torch==2.7.1" "torchvision~=0.22" --index-url https://download.pytorch.org/whl/cpu ) else ( - pip install "torch>=2.7.0" --index-url https://download.pytorch.org/whl/cu124 - pip show triton > nul 2>&1 - REM Check if install_triton is Y and triton-windows is not installed - if /i "!install_triton!"=="Y" if %errorlevel% neq 0 ( + REM use fixed torch version and cu118 for compt on old nvidia driver + pip install "torch==2.7.1" "torchvision~=0.22" --index-url https://download.pytorch.org/whl/cu118 + + REM Check if install_triton is Y + if /i "!install_triton!"=="Y" ( echo [INFO] Installing triton-windows echo [INFO] Downloading MSVC and Windows SDK curl -L -o vs_buildtools.exe https://aka.ms/vs/17/release/vs_BuildTools.exe if exist vs_buildtools.exe ( echo [INFO] Installing MSVC and Windows SDK - start /wait vs_buildtools.exe --quiet --wait --norestart --nocache --installPath %UserProfile%\vs_buildtools + start /wait vs_buildtools.exe --passive --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.NativeDesktop + call :config_msvc_path ) echo [INFO] Downloading vcredist curl -L -o vcredist.exe https://aka.ms/vs/17/release/vc_redist.x64.exe @@ -112,23 +118,74 @@ if /i "!use_cpu!"=="Y" ( start /wait vcredist.exe /install /quiet /norestart ) echo [INFO] Installing triton-windows pip package - pip install -U "triton-windows<3.4" + pip install -U "triton-windows~=3.3" - echo [INFO] Check if Windows file path length limit (260) exists + echo [INFO] Check if Windows file path length limit ^(260^) exists echo [INFO] Attempting to modify registry to enable long path support. powershell -Command "Start-Process powershell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -Command New-ItemProperty -Path \"HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem\" -Name \"LongPathsEnabled\" -Value 1 -PropertyType DWORD -Force' -Verb RunAs" echo [INFO] Long Path Support should now be enabled. Restart required. ) ) echo [INFO] Installing EvoX packages... -pip install "evox[vis]>=1.0.0" torchvision +pip install "evox[vis]>=1.0.0" REM Download some demo mkdir %UserProfile%\evox-demo git clone --depth 1 https://github.com/EMI-Group/evox.git %UserProfile%\evox-demo\evox -xcopy %UserProfile%\evox-demo\evox\docs\source\example\ %UserProfile%\evox-demo /E /I /Y +xcopy %UserProfile%\evox-demo\evox\docs\source\examples\ %UserProfile%\evox-demo /E /I /Y start code %UserProfile%\evox-demo echo Reboot is highly recommended to apply the changes. pause :: ...existing code... +goto :EOF + + +:config_msvc_path + REM 1. get root path of VS BuildTools + for /f "usebackq delims=" %%I in (` + "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ^ + -latest ^ + -products * ^ + -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^ + -property installationPath + `) do set "VSROOT=%%I" + + if not defined VSROOT ( + echo [ERROR] BuildTools not found + exit /b 1 + ) + + REM 2. select the largest version folder in VC\Tools\MSVC + set "MSVCDIR=" + for /f "delims=" %%V in ('dir "%VSROOT%\VC\Tools\MSVC" /b /ad /o-n') do ( + set "MSVCDIR=%%V" + goto :got_msvc + ) + :got_msvc + + if not defined MSVCDIR ( + echo [ERROR] Not found dir of MSVC + exit /b 1 + ) + + set "BINPATH=%VSROOT%\VC\Tools\MSVC\%MSVCDIR%\bin\Hostx64\x64" + + echo [INFO] write to user's PATH env %BINPATH% + set "PATH=%BINPATH%;%PATH%" + + set "USERPATH=" + for /f "skip=2 tokens=2*" %%A in (' + reg query "HKCU\Environment" /v PATH 2^>nul + ') do set "USERPATH=%%B" + + if "%USERPATH%"=="" ( + setx PATH "%BINPATH%" >nul + ) else ( + echo "%USERPATH%" | find /I "%BINPATH%" >nul + if %errorlevel% neq 0 ( + setx PATH "%USERPATH%;%BINPATH%" >nul + ) else ( + echo [INFO] Skip. PATH already contains %BINPATH% + ) + ) \ No newline at end of file From 95e6c794a50e0a49a9a13148d4f4ff5ca828d728 Mon Sep 17 00:00:00 2001 From: zaber <20830726+ZaberKo@users.noreply.github.com> Date: Wed, 9 Jul 2025 12:47:52 +0800 Subject: [PATCH 2/5] fix wrong vs_buildtools package --- docs/source/_static/win-install.bat | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/source/_static/win-install.bat b/docs/source/_static/win-install.bat index 0512e6e6..3b49c5a1 100644 --- a/docs/source/_static/win-install.bat +++ b/docs/source/_static/win-install.bat @@ -108,7 +108,12 @@ if /i "!use_cpu!"=="Y" ( curl -L -o vs_buildtools.exe https://aka.ms/vs/17/release/vs_BuildTools.exe if exist vs_buildtools.exe ( echo [INFO] Installing MSVC and Windows SDK - start /wait vs_buildtools.exe --passive --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.NativeDesktop + start /wait vs_buildtools.exe --passive --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended + if %errorlevel% neq 0 ( + echo [ERROR] Installing MSVC and Windows SDK failed. + pause + exit /b 1 + ) call :config_msvc_path ) echo [INFO] Downloading vcredist @@ -116,6 +121,11 @@ if /i "!use_cpu!"=="Y" ( if exist vcredist.exe ( echo [INFO] Installing vcredist start /wait vcredist.exe /install /quiet /norestart + if %errorlevel% neq 0 ( + echo [ERROR] Installing vcredist failed. + pause + exit /b 1 + ) ) echo [INFO] Installing triton-windows pip package pip install -U "triton-windows~=3.3" From 6157aeff35ff5928e6a316f766eba6321119f3b9 Mon Sep 17 00:00:00 2001 From: zaber <20830726+ZaberKo@users.noreply.github.com> Date: Wed, 9 Jul 2025 14:05:29 +0800 Subject: [PATCH 3/5] fix delay expansion issue --- docs/source/_static/win-install.bat | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/source/_static/win-install.bat b/docs/source/_static/win-install.bat index 3b49c5a1..3bbde8a8 100644 --- a/docs/source/_static/win-install.bat +++ b/docs/source/_static/win-install.bat @@ -115,6 +115,11 @@ if /i "!use_cpu!"=="Y" ( exit /b 1 ) call :config_msvc_path + if %errorlevel% neq 0 ( + echo [ERROR] Config PATH failed. + pause + exit /b 1 + ) ) echo [INFO] Downloading vcredist curl -L -o vcredist.exe https://aka.ms/vs/17/release/vc_redist.x64.exe @@ -181,21 +186,21 @@ goto :EOF set "BINPATH=%VSROOT%\VC\Tools\MSVC\%MSVCDIR%\bin\Hostx64\x64" - echo [INFO] write to user's PATH env %BINPATH% - set "PATH=%BINPATH%;%PATH%" + echo [INFO] write to user's PATH env !BINPATH! + set "PATH=!BINPATH!;%PATH%" set "USERPATH=" for /f "skip=2 tokens=2*" %%A in (' reg query "HKCU\Environment" /v PATH 2^>nul ') do set "USERPATH=%%B" - if "%USERPATH%"=="" ( - setx PATH "%BINPATH%" >nul + if "!USERPATH!"=="" ( + setx PATH "!BINPATH!" >nul ) else ( - echo "%USERPATH%" | find /I "%BINPATH%" >nul + echo "!USERPATH!" | find /I "!BINPATH!" >nul if %errorlevel% neq 0 ( - setx PATH "%USERPATH%;%BINPATH%" >nul + setx PATH "!USERPATH!;!BINPATH!" >nul ) else ( - echo [INFO] Skip. PATH already contains %BINPATH% + echo [INFO] Skip. PATH already contains !BINPATH! ) ) \ No newline at end of file From 2e15b15f8f890d5e5ee3945625812cf1a39629c1 Mon Sep 17 00:00:00 2001 From: zaber <20830726+ZaberKo@users.noreply.github.com> Date: Wed, 9 Jul 2025 15:11:40 +0800 Subject: [PATCH 4/5] fix PATH bug && set default install_triton=N --- docs/source/_static/win-install.bat | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/source/_static/win-install.bat b/docs/source/_static/win-install.bat index 3bbde8a8..75f1a500 100644 --- a/docs/source/_static/win-install.bat +++ b/docs/source/_static/win-install.bat @@ -3,7 +3,7 @@ setlocal enabledelayedexpansion REM Check NVIDIA driver version set "use_cpu=N" -set "install_triton=Y" +set "install_triton=N" where nvidia-smi > nul 2>&1 if %errorlevel% neq 0 ( echo [ERROR] NVIDIA driver not found. Please install the latest NVIDIA driver first from https://www.nvidia.com/drivers/. @@ -19,12 +19,13 @@ if %errorlevel% neq 0 ( REM If using GPU, ask if the user want to install triton-windows for torch.compile support if /i "!use_cpu!"=="N" ( - echo Do you want to install triton-windows for torch.compile support? ^(Y/N, default Y^) + echo Do you want to install triton-windows for torch.compile support? ^(Y/N, default N^) set /p install_triton=">> " - if "!install_triton!"=="" set "install_triton=Y" + if "!install_triton!"=="" set "install_triton=N" if /i "!install_triton!"=="Y" ( echo [INFO] Will install triton-windows ) else ( + set "install_triton=N" echo [INFO] Skip triton-windows installation ) ) @@ -197,7 +198,7 @@ goto :EOF if "!USERPATH!"=="" ( setx PATH "!BINPATH!" >nul ) else ( - echo "!USERPATH!" | find /I "!BINPATH!" >nul + echo !USERPATH! | find /I "!BINPATH!" >nul if %errorlevel% neq 0 ( setx PATH "!USERPATH!;!BINPATH!" >nul ) else ( From cc41b13a8e8374fa068e4d72b70171e6127b5a39 Mon Sep 17 00:00:00 2001 From: zaber <20830726+ZaberKo@users.noreply.github.com> Date: Wed, 9 Jul 2025 16:27:44 +0800 Subject: [PATCH 5/5] fix delay expansion issue --- docs/source/_static/win-install.bat | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/source/_static/win-install.bat b/docs/source/_static/win-install.bat index 75f1a500..d7da3f16 100644 --- a/docs/source/_static/win-install.bat +++ b/docs/source/_static/win-install.bat @@ -5,7 +5,7 @@ REM Check NVIDIA driver version set "use_cpu=N" set "install_triton=N" where nvidia-smi > nul 2>&1 -if %errorlevel% neq 0 ( +if !errorlevel! neq 0 ( echo [ERROR] NVIDIA driver not found. Please install the latest NVIDIA driver first from https://www.nvidia.com/drivers/. echo Do you want install torch cpu version instead? ^(Y/N, default N^) set /p use_cpu=">> " @@ -39,7 +39,7 @@ for /f "tokens=1* delims=," %%A in ('nvidia-smi --query-gpu=driver_version --for @REM echo %use_cpu% REM check winget is installed where winget > nul 2>&1 -if %errorlevel% neq 0 ( +if !errorlevel! neq 0 ( echo [ERROR] winget is not installed. This usually happens on LTSC and Server OS. Please manually install winget from https://github.com/microsoft/winget-cli, then reopen this script. pause exit /b 1 @@ -47,7 +47,7 @@ if %errorlevel% neq 0 ( REM Check if VS Code is installed where code > nul 2>&1 -if %errorlevel% neq 0 ( +if !errorlevel! neq 0 ( echo [INFO] VSCode is not found. Downloading Visual Studio Code installer... winget install -e --id Microsoft.VisualStudioCode ) else ( @@ -56,7 +56,7 @@ if %errorlevel% neq 0 ( REM Checking if Git is installed where git > nul 2>&1 -if %errorlevel% neq 0 ( +if !errorlevel! neq 0 ( echo [INFO] Git is not found. Downloading Git installer... winget install -e --id Git.Git ) else ( @@ -85,7 +85,7 @@ call conda info echo [INFO] Creating evox-env environment... call conda env list | findstr "evox-env" >nul -if %ERRORLEVEL%==0 ( +if !errorlevel!==0 ( echo Environment evox-env already exists. Removing... call conda env remove -n evox-env -y ) @@ -110,13 +110,13 @@ if /i "!use_cpu!"=="Y" ( if exist vs_buildtools.exe ( echo [INFO] Installing MSVC and Windows SDK start /wait vs_buildtools.exe --passive --wait --norestart --nocache --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended - if %errorlevel% neq 0 ( + if !errorlevel! neq 0 ( echo [ERROR] Installing MSVC and Windows SDK failed. pause exit /b 1 ) call :config_msvc_path - if %errorlevel% neq 0 ( + if !errorlevel! neq 0 ( echo [ERROR] Config PATH failed. pause exit /b 1 @@ -127,7 +127,7 @@ if /i "!use_cpu!"=="Y" ( if exist vcredist.exe ( echo [INFO] Installing vcredist start /wait vcredist.exe /install /quiet /norestart - if %errorlevel% neq 0 ( + if !errorlevel! neq 0 ( echo [ERROR] Installing vcredist failed. pause exit /b 1 @@ -174,7 +174,7 @@ goto :EOF REM 2. select the largest version folder in VC\Tools\MSVC set "MSVCDIR=" - for /f "delims=" %%V in ('dir "%VSROOT%\VC\Tools\MSVC" /b /ad /o-n') do ( + for /f "delims=" %%V in ('dir "!VSROOT!\VC\Tools\MSVC" /b /ad /o-n') do ( set "MSVCDIR=%%V" goto :got_msvc ) @@ -185,10 +185,10 @@ goto :EOF exit /b 1 ) - set "BINPATH=%VSROOT%\VC\Tools\MSVC\%MSVCDIR%\bin\Hostx64\x64" + set "BINPATH=!VSROOT!\VC\Tools\MSVC\!MSVCDIR!\bin\Hostx64\x64" echo [INFO] write to user's PATH env !BINPATH! - set "PATH=!BINPATH!;%PATH%" + set "PATH=!BINPATH!;!PATH!" set "USERPATH=" for /f "skip=2 tokens=2*" %%A in (' @@ -199,8 +199,8 @@ goto :EOF setx PATH "!BINPATH!" >nul ) else ( echo !USERPATH! | find /I "!BINPATH!" >nul - if %errorlevel% neq 0 ( - setx PATH "!USERPATH!;!BINPATH!" >nul + if !errorlevel! neq 0 ( + setx PATH "!BINPATH!;!USERPATH!" >nul ) else ( echo [INFO] Skip. PATH already contains !BINPATH! )