From 19ac61280d3dd089891e3a46134c32da0e72e24f Mon Sep 17 00:00:00 2001 From: Zhengyu Zhang Date: Thu, 28 Aug 2025 05:39:46 +0000 Subject: [PATCH 1/8] make torch robust against flaky dependency override --- isaaclab.sh | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/isaaclab.sh b/isaaclab.sh index fed536e680a..4dc5c9d185c 100755 --- a/isaaclab.sh +++ b/isaaclab.sh @@ -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 @@ -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 @@ -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 extremly 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 From 12b3b1817f15254de5ee50ef3aaa13c430bc92e8 Mon Sep 17 00:00:00 2001 From: Zhengyu Zhang Date: Thu, 28 Aug 2025 05:41:44 +0000 Subject: [PATCH 2/8] only install teleloperation in linux or x86_64 system --- source/isaaclab/setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/isaaclab/setup.py b/source/isaaclab/setup.py index 5231c1bdaff..a8c6f4262cf 100644 --- a/source/isaaclab/setup.py +++ b/source/isaaclab/setup.py @@ -50,8 +50,10 @@ # 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 + # required by isaaclab.isaaclab.controllers.pink_ik + "pin-pink==3.1.0; platform_system=='Linux' and (platform_machine=='x86_64' or platform_machine=='AMD64')", + # required by isaaclab.devices.openxr.retargeters.humanoid.fourier.gr1_t2_dex_retargeting_utils + "dex-retargeting==0.4.6; platform_system=='Linux' and (platform_machine=='x86_64' or platform_machine=='AMD64')" ] PYTORCH_INDEX_URL = ["https://download.pytorch.org/whl/cu128"] From 1444c41a1c702a44c7300819d871d3fb637defed Mon Sep 17 00:00:00 2001 From: Octi Zhang Date: Wed, 27 Aug 2025 22:52:25 -0700 Subject: [PATCH 3/8] adapt the same script for windows installation --- isaaclab.bat | 73 ++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/isaaclab.bat b/isaaclab.bat index 6923c9ee917..fdfd0414d75 100644 --- a/isaaclab.bat +++ b/isaaclab.bat @@ -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 ----------------------------------------------------------------------- @@ -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" @@ -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 @@ -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" @@ -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 From 72a04fbec32e48238e383dec85faf70244f77b3b Mon Sep 17 00:00:00 2001 From: Octi Zhang Date: Wed, 27 Aug 2025 23:05:42 -0700 Subject: [PATCH 4/8] =?UTF-8?q?only=20install=20pink=20or=20retargert=20in?= =?UTF-8?q?=20Linux=20x86=5F64=E2=80=93only=20system?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/isaaclab/setup.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/source/isaaclab/setup.py b/source/isaaclab/setup.py index a8c6f4262cf..b56e78195d7 100644 --- a/source/isaaclab/setup.py +++ b/source/isaaclab/setup.py @@ -6,7 +6,6 @@ """Installation script for the 'isaaclab' python package.""" import os -import platform import toml from setuptools import setup @@ -47,14 +46,12 @@ "flaky", ] -# Additional dependencies that are only available on Linux platforms -if platform.system() == "Linux": - INSTALL_REQUIRES += [ - # required by isaaclab.isaaclab.controllers.pink_ik - "pin-pink==3.1.0; platform_system=='Linux' and (platform_machine=='x86_64' or platform_machine=='AMD64')", - # required by isaaclab.devices.openxr.retargeters.humanoid.fourier.gr1_t2_dex_retargeting_utils - "dex-retargeting==0.4.6; platform_system=='Linux' and (platform_machine=='x86_64' or platform_machine=='AMD64')" - ] +# Append Linux x86_64–only deps via PEP 508 markers +X64 = "platform_machine in 'x86_64,AMD64'" +INSTALL_REQUIRES += [ + f"pin-pink==3.1.0 ; platform_system == 'Linux' and ({X64})", + f"dex-retargeting==0.4.6 ; platform_system == 'Linux' and ({X64})", +] PYTORCH_INDEX_URL = ["https://download.pytorch.org/whl/cu128"] From 433143c5126b3921059aea0e234485539b20ac25 Mon Sep 17 00:00:00 2001 From: Octi Zhang Date: Wed, 27 Aug 2025 23:13:57 -0700 Subject: [PATCH 5/8] fix typo --- isaaclab.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isaaclab.sh b/isaaclab.sh index 4dc5c9d185c..3c8cf33a05d 100755 --- a/isaaclab.sh +++ b/isaaclab.sh @@ -414,7 +414,7 @@ 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 extremly rare cases, torch might not be installed properly by setup.py, add one more check here + # 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 From f8ece3bbaa32abca0a8bf18b406578c18470d61c Mon Sep 17 00:00:00 2001 From: Octi Zhang Date: Thu, 28 Aug 2025 15:12:44 -0700 Subject: [PATCH 6/8] add comment for dependency usecases and don't skip pink installation --- source/isaaclab/setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/isaaclab/setup.py b/source/isaaclab/setup.py index b56e78195d7..4f46b03b1a4 100644 --- a/source/isaaclab/setup.py +++ b/source/isaaclab/setup.py @@ -49,7 +49,9 @@ # Append Linux x86_64–only deps via PEP 508 markers X64 = "platform_machine in 'x86_64,AMD64'" INSTALL_REQUIRES += [ - f"pin-pink==3.1.0 ; platform_system == 'Linux' and ({X64})", + # required by isaaclab.isaaclab.controllers.pink_ik + f"pin-pink==3.1.0 ", + # required by isaaclab.devices.openxr.retargeters.humanoid.fourier.gr1_t2_dex_retargeting_utils f"dex-retargeting==0.4.6 ; platform_system == 'Linux' and ({X64})", ] From 176ae7d3a01b425c2b63fffe0523a1b1bf50f196 Mon Sep 17 00:00:00 2001 From: Octi Zhang Date: Thu, 28 Aug 2025 15:21:34 -0700 Subject: [PATCH 7/8] pass pre commit --- source/isaaclab/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/isaaclab/setup.py b/source/isaaclab/setup.py index 4f46b03b1a4..899013dba65 100644 --- a/source/isaaclab/setup.py +++ b/source/isaaclab/setup.py @@ -50,7 +50,7 @@ X64 = "platform_machine in 'x86_64,AMD64'" INSTALL_REQUIRES += [ # required by isaaclab.isaaclab.controllers.pink_ik - f"pin-pink==3.1.0 ", + "pin-pink==3.1.0", # required by isaaclab.devices.openxr.retargeters.humanoid.fourier.gr1_t2_dex_retargeting_utils f"dex-retargeting==0.4.6 ; platform_system == 'Linux' and ({X64})", ] From 44bbffd2c4f120359e45cef0618a79e3aff5031c Mon Sep 17 00:00:00 2001 From: Octi Zhang Date: Fri, 29 Aug 2025 14:42:51 -0700 Subject: [PATCH 8/8] avoid install pin in arm system --- source/isaaclab/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/isaaclab/setup.py b/source/isaaclab/setup.py index 899013dba65..c78f9817245 100644 --- a/source/isaaclab/setup.py +++ b/source/isaaclab/setup.py @@ -50,7 +50,7 @@ X64 = "platform_machine in 'x86_64,AMD64'" INSTALL_REQUIRES += [ # required by isaaclab.isaaclab.controllers.pink_ik - "pin-pink==3.1.0", + 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})", ]