Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 96 additions & 23 deletions docs/source/_static/win-install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ 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 (
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=">> "
Expand All @@ -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
)
)
Expand All @@ -38,15 +39,15 @@ 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
)

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 (
Expand All @@ -55,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 (
Expand All @@ -65,7 +66,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
Expand All @@ -81,54 +81,127 @@ 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 (
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.VCTools;includeRecommended
if !errorlevel! neq 0 (
echo [ERROR] Installing MSVC and Windows SDK failed.
pause
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
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.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 "!BINPATH!;!USERPATH!" >nul
) else (
echo [INFO] Skip. PATH already contains !BINPATH!
)
)
Loading