Skip to content
Merged
Show file tree
Hide file tree
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
73 changes: 39 additions & 34 deletions isaaclab.bat
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,33 @@ if not exist "%isaac_path%" (
)
goto :eof

rem --- Ensure CUDA PyTorch helper ------------------------------------------
:ensure_cuda_torch
rem expects: !python_exe! set by :extract_python_exe
setlocal EnableExtensions EnableDelayedExpansion
set "TORCH_VER=2.7.0"
set "TV_VER=0.22.0"
set "CUDA_TAG=cu128"
set "PYTORCH_INDEX=https://download.pytorch.org/whl/%CUDA_TAG%"

rem Do we already have torch?
call "!python_exe!" -m pip show torch >nul 2>&1
if errorlevel 1 (
echo [INFO] Installing PyTorch !TORCH_VER! with CUDA !CUDA_TAG!...
call "!python_exe!" -m pip install "torch==!TORCH_VER!" "torchvision==!TV_VER!" --index-url "!PYTORCH_INDEX!"
) else (
for /f "tokens=2" %%V in ('"!python_exe!" -m pip show torch ^| findstr /B /C:"Version:"') do set "TORCH_CUR=%%V"
echo [INFO] Found PyTorch version !TORCH_CUR!.
if /I not "!TORCH_CUR!"=="!TORCH_VER!+!CUDA_TAG!" (
echo [INFO] Replacing PyTorch !TORCH_CUR! -> !TORCH_VER!+!CUDA_TAG!...
call "!python_exe!" -m pip uninstall -y torch torchvision torchaudio >nul 2>&1
call "!python_exe!" -m pip install "torch==!TORCH_VER!" "torchvision==!TV_VER!" --index-url "!PYTORCH_INDEX!"
) else (
echo [INFO] PyTorch !TORCH_VER!+!CUDA_TAG! already installed.
)
)
endlocal & exit /b 0

rem -----------------------------------------------------------------------
rem Returns success (exit code 0) if Isaac Sim's version starts with "4.5"
rem -----------------------------------------------------------------------
Expand Down Expand Up @@ -334,23 +361,7 @@ if "%arg%"=="-i" (
call :extract_python_exe
rem check if pytorch is installed and its version
rem install pytorch with cuda 12.8 for blackwell support
call !python_exe! -m pip list | findstr /C:"torch" >nul
if %errorlevel% equ 0 (
for /f "tokens=2" %%i in ('!python_exe! -m pip show torch ^| findstr /C:"Version:"') do (
set torch_version=%%i
)
if not "!torch_version!"=="2.7.0+cu128" (
echo [INFO] Uninstalling PyTorch version !torch_version!...
call !python_exe! -m pip uninstall -y torch torchvision torchaudio
echo [INFO] Installing PyTorch 2.7.0 with CUDA 12.8 support...
call !python_exe! -m pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu128
) else (
echo [INFO] PyTorch 2.7.0 is already installed.
)
) else (
echo [INFO] Installing PyTorch 2.7.0 with CUDA 12.8 support...
call !python_exe! -m pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu128
)
call :ensure_cuda_torch

for /d %%d in ("%ISAACLAB_PATH%\source\*") do (
set ext_folder="%%d"
Expand All @@ -372,6 +383,13 @@ if "%arg%"=="-i" (
)
rem install the rl-frameworks specified
call !python_exe! -m pip install -e %ISAACLAB_PATH%\source\isaaclab_rl[!framework_name!]
rem in rare case if some packages or flaky setup override default torch installation, ensure right torch is
rem installed again
call :ensure_cuda_torch
rem update the vscode settings
rem once we have a docker container, we need to disable vscode settings
call :update_vscode_settings
shift
shift
) else if "%arg%"=="--install" (
rem install the python packages in source directory
Expand All @@ -380,23 +398,7 @@ if "%arg%"=="-i" (

rem check if pytorch is installed and its version
rem install pytorch with cuda 12.8 for blackwell support
call !python_exe! -m pip list | findstr /C:"torch" >nul
if %errorlevel% equ 0 (
for /f "tokens=2" %%i in ('!python_exe! -m pip show torch ^| findstr /C:"Version:"') do (
set torch_version=%%i
)
if not "!torch_version!"=="2.7.0+cu128" (
echo [INFO] Uninstalling PyTorch version !torch_version!...
call !python_exe! -m pip uninstall -y torch torchvision torchaudio
echo [INFO] Installing PyTorch 2.7.0 with CUDA 12.8 support...
call !python_exe! -m pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu128
) else (
echo [INFO] PyTorch 2.7.0 is already installed.
)
) else (
echo [INFO] Installing PyTorch 2.7.0 with CUDA 12.8 support...
call !python_exe! -m pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu128
)
call :ensure_cuda_torch

for /d %%d in ("%ISAACLAB_PATH%\source\*") do (
set ext_folder="%%d"
Expand All @@ -418,6 +420,9 @@ if "%arg%"=="-i" (
)
rem install the rl-frameworks specified
call !python_exe! -m pip install -e %ISAACLAB_PATH%\source\isaaclab_rl[!framework_name!]
rem in rare case if some packages or flaky setup override default torch installation, ensure right torch is
rem installed again
call :ensure_cuda_torch
rem update the vscode settings
rem once we have a docker container, we need to disable vscode settings
call :update_vscode_settings
Expand Down
43 changes: 28 additions & 15 deletions isaaclab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,30 @@ is_docker() {
[[ "$(hostname)" == *"."* ]]
}

ensure_cuda_torch() {
local py="$1"
local -r TORCH_VER="2.7.0"
local -r TV_VER="0.22.0"
local -r CUDA_TAG="cu128"
local -r PYTORCH_INDEX="https://download.pytorch.org/whl/${CUDA_TAG}"
local torch_ver

if "$py" -m pip show torch >/dev/null 2>&1; then
torch_ver="$("$py" -m pip show torch 2>/dev/null | awk -F': ' '/^Version/{print $2}')"
echo "[INFO] Found PyTorch version ${torch_ver}."
if [[ "$torch_ver" != "${TORCH_VER}+${CUDA_TAG}" ]]; then
echo "[INFO] Replacing PyTorch ${torch_ver} → ${TORCH_VER}+${CUDA_TAG}..."
"$py" -m pip uninstall -y torch torchvision torchaudio >/dev/null 2>&1 || true
"$py" -m pip install "torch==${TORCH_VER}" "torchvision==${TV_VER}" --index-url "${PYTORCH_INDEX}"
else
echo "[INFO] PyTorch ${TORCH_VER}+${CUDA_TAG} already installed."
fi
else
echo "[INFO] Installing PyTorch ${TORCH_VER}+${CUDA_TAG}..."
"$py" -m pip install "torch==${TORCH_VER}" "torchvision==${TV_VER}" --index-url "${PYTORCH_INDEX}"
fi
}

# extract isaac sim path
extract_isaacsim_path() {
# Use the sym-link path to Isaac Sim directory
Expand Down Expand Up @@ -364,21 +388,7 @@ while [[ $# -gt 0 ]]; do
python_exe=$(extract_python_exe)
# check if pytorch is installed and its version
# install pytorch with cuda 12.8 for blackwell support
if ${python_exe} -m pip list 2>/dev/null | grep -q "torch"; then
torch_version=$(${python_exe} -m pip show torch 2>/dev/null | grep "Version:" | awk '{print $2}')
echo "[INFO] Found PyTorch version ${torch_version} installed."
if [[ "${torch_version}" != "2.7.0+cu128" ]]; then
echo "[INFO] Uninstalling PyTorch version ${torch_version}..."
${python_exe} -m pip uninstall -y torch torchvision torchaudio
echo "[INFO] Installing PyTorch 2.7.0 with CUDA 12.8 support..."
${python_exe} -m pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu128
else
echo "[INFO] PyTorch 2.7.0 is already installed."
fi
else
echo "[INFO] Installing PyTorch 2.7.0 with CUDA 12.8 support..."
${python_exe} -m pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu128
fi
ensure_cuda_torch ${python_exe}
# recursively look into directories and install them
# this does not check dependencies between extensions
export -f extract_python_exe
Expand All @@ -404,6 +414,9 @@ while [[ $# -gt 0 ]]; do
${python_exe} -m pip install -e ${ISAACLAB_PATH}/source/isaaclab_rl["${framework_name}"]
${python_exe} -m pip install -e ${ISAACLAB_PATH}/source/isaaclab_mimic["${framework_name}"]

# in some rare cases, torch might not be installed properly by setup.py, add one more check here
# can prevent that from happening
ensure_cuda_torch ${python_exe}
# check if we are inside a docker container or are building a docker image
# in that case don't setup VSCode since it asks for EULA agreement which triggers user interaction
if is_docker; then
Expand Down
15 changes: 8 additions & 7 deletions source/isaaclab/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""Installation script for the 'isaaclab' python package."""

import os
import platform
import toml

from setuptools import setup
Expand Down Expand Up @@ -47,12 +46,14 @@
"flaky",
]

# Additional dependencies that are only available on Linux platforms
if platform.system() == "Linux":
INSTALL_REQUIRES += [
"pin-pink==3.1.0", # required by isaaclab.isaaclab.controllers.pink_ik
"dex-retargeting==0.4.6", # required by isaaclab.devices.openxr.retargeters.humanoid.fourier.gr1_t2_dex_retargeting_utils
]
# Append Linux x86_64–only deps via PEP 508 markers
X64 = "platform_machine in 'x86_64,AMD64'"
INSTALL_REQUIRES += [
# required by isaaclab.isaaclab.controllers.pink_ik
f"pin-pink==3.1.0 ; platform_system == 'Linux' and ({X64})",
# required by isaaclab.devices.openxr.retargeters.humanoid.fourier.gr1_t2_dex_retargeting_utils
f"dex-retargeting==0.4.6 ; platform_system == 'Linux' and ({X64})",
]

PYTORCH_INDEX_URL = ["https://download.pytorch.org/whl/cu128"]

Expand Down