目錄
- 一、前言
- 二、電腦配置
- 三、配置步驟
- 3.1 創建Conda環境
- 3.2 安裝PyTorch
- 3.3 安裝Isaac Sim
- 3.4 安裝Isaac Lab
- 四、總結
一、前言
博主自從去年開始就一直在關注Isaac Lab和Isaac Sim,但是一直以來由于手頭設備只有4060,甚至沒有達到最低配置16GB顯存要求,因此只能望洋興嘆。今年下定決心下血本購入頂配臺式一臺,為了讓我投入的資金充分轉化為生產力,因此最近開始搗鼓配置Isaac Lab和Isaac Sim。由于50系顯卡較新,且最新的CUDA版本只能使用Nightly版本的PyTorch,因此配置過程中有許多需要注意的細節,因此我寫下了這篇博客用來記錄配置過程,既是記錄配置過程中遇到的一些問題,也是給各位志同道合的朋友們拋磚引玉,一起用上最先進的GPU并行強化學習環境,共同進步。話不多說,我們正式開始配置吧。
二、電腦配置
名稱 | 型號 |
---|---|
操作系統 | Ubuntu 24.04 LTS |
CPU | AMD Ryzen 9 9950X3D 16-Core Processor |
運行內存 | 64GB |
GPU | NVIDIA GeForce RTX 5090 |
GPU 驅動 | 575.64.03 |
CUDA 版本 | 12.9 |
三、配置步驟
電腦需要首先安裝Nvidia驅動以及miniconda,已有博客詳細闡述了配置過程,本文不再贅述。下面的配置過程主要參考Isaac Lab官方文檔的Pip Installation,文檔提供了另外一種二進制安裝方式,主要區別在于使用的python環境以及Isaac Sim的安裝上,下面的安裝步驟僅針對Pip Installation,二進制安裝請自行嘗試。
3.1 創建Conda環境
conda create -n env_isaaclab python=3.10
conda activate env_isaaclab
3.2 安裝PyTorch
此處區別于官方文檔,截至Sat Jul 26 14:55:10 2025
,最新的CUDA版本12.9
不能使用PyTorch的穩定版2.7.1
,因此需要安裝Preview (Nightly)版本,安裝命令如下:
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu129
使用如下命令查看當前的PyTorch版本
python -m pip show torch 2>/dev/null | grep "Version" | awk "{print $2}"
我的版本是Version: 2.9.0.dev20250725+cu129
,需要記住這個版本號,在下面安裝Isaac Lab的時候要用到。
3.3 安裝Isaac Sim
pip install 'isaacsim[all,extscache]==4.5.0' --extra-index-url https://pypi.nvidia.com
安裝完成后使用如下命令驗證Isaac Sim是否安裝成功
isaacsim
首次運行isaacsim
時會有如下的NVIDIA Software License Agreement,需要手動輸入Yes
。
By installing or using Isaac Sim, I agree to the terms of NVIDIA SOFTWARE LICENSE AGREEMENT (EULA)
in https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-software-license-agreementDo you accept the EULA? (Yes/No): Yes
如果安裝成功,應該有如下界面
3.4 安裝Isaac Lab
首先克隆倉庫
git clone git@github.com:isaac-sim/IsaacLab.git
安裝依賴項
sudo apt install cmake build-essential
使用編輯器修改IsaacLab/isaaclab.sh
,這一步使用到的版本號就是3.2節中最后我們獲得的版本號,中間用echo
命令打印出來的信息可以不修改,最關鍵的兩點修改:
if [[ "${torch_version}" != "2.7.0+cu128" ]]; then
修改為if [[ "${torch_version}" != "2.9.0.dev20250725+cu129" ]]; then
;${python_exe} -m pip install torch==2.7.0 torchvision==0.22.0 --index-url https://download.pytorch.org/whl/cu128
修改為${python_exe} -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu129
。
原本的安裝腳本中會檢查torch版本是否是 2.7.0+cu128
,但是最新的CUDA版本是12.9,支持12.9的只有Nightly版本,因此需要把版本檢查和安裝的部分替換為最新的版本。
# pass the arguments
while [[ $# -gt 0 ]]; do# read the keycase "$1" in-i|--install)# 把原先這一段注釋,修改成下面的echo "[INFO] Installing extensions inside the Isaac Lab repository..."python_exe=$(extract_python_exe)# check if pytorch is installed and its version# install pytorch with cuda 12.9 for blackwell supportif ${python_exe} -m pip list 2>/dev/null | grep -q "torch"; thentorch_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.9.0.dev20250725+cu129" ]]; then # 替換此處的版本號echo "[INFO] Uninstalling PyTorch version ${torch_version}..."${python_exe} -m pip uninstall -y torch torchvision torchaudioecho "[INFO] Installing PyTorch 2.9.0 with CUDA 12.9 support..."${python_exe} -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu129elseecho "[INFO] PyTorch 2.9.0 is already installed."fielseecho "[INFO] Installing PyTorch 2.9.0 with CUDA 12.9 support..."${python_exe} -m pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu129fi
安裝強化學習/模仿學習框架
./isaaclab.sh -i
創建空場景驗證安裝
python scripts/tutorials/00_sim/create_empty.py
應當能看到如下輸出
下面我們就可以訓練一個機器人了,例如經典的ant環境
./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Ant-v0
# 如果要提高訓練效率,請加上--headless選項,完整命令如下
# ./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Ant-v0 --headless
機器人仿真(2)-視頻:訓練ANT環境
終端輸出如下
################################################################################Learning iteration 205/1000 Computation: 82994 steps/s (collection: 1.520s, learning 0.059s)Mean action noise std: 0.16Mean value_function loss: 0.0247Mean surrogate loss: -0.0023Mean entropy loss: -3.9463Mean reward: 102.77Mean episode length: 906.04Episode_Reward/progress: 6.4252Episode_Reward/alive: 0.4708Episode_Reward/upright: 0.0927Episode_Reward/move_to_target: 0.4684Episode_Reward/action_l2: -0.0141Episode_Reward/energy: -0.7186Episode_Reward/joint_pos_limits: -0.3366Episode_Termination/time_out: 2.2812Episode_Termination/torso_height: 0.1562
--------------------------------------------------------------------------------Total timesteps: 27000832Iteration time: 1.58sTime elapsed: 00:04:59ETA: 00:19:15################################################################################Learning iteration 206/1000 Computation: 82106 steps/s (collection: 1.537s, learning 0.059s)Mean action noise std: 0.15Mean value_function loss: 0.0313Mean surrogate loss: -0.0002Mean entropy loss: -3.9886Mean reward: 105.27Mean episode length: 929.74Episode_Reward/progress: 6.6413Episode_Reward/alive: 0.4845Episode_Reward/upright: 0.0961Episode_Reward/move_to_target: 0.4757Episode_Reward/action_l2: -0.0146Episode_Reward/energy: -0.7420Episode_Reward/joint_pos_limits: -0.3487Episode_Termination/time_out: 2.3438Episode_Termination/torso_height: 0.1250
--------------------------------------------------------------------------------Total timesteps: 27131904Iteration time: 1.60sTime elapsed: 00:05:01ETA: 00:19:14
Isaac Lab中還有其他環境,我們還可以訓練機器人、機械臂、無人機等對象完成不同的任務,例如我們可以訓練Animal四足機器人:
./isaaclab.sh -p scripts/reinforcement_learning/rsl_rl/train.py --task=Isaac-Velocity-Rough-Anymal-C-v0 # 同理可以加上--headless提高效率
機器人仿真(2)-視頻:訓練Anymal環境
輸出如下:
################################################################################Learning iteration 113/1500 Computation: 24455 steps/s (collection: 3.956s, learning 0.064s)Mean action noise std: 0.49Mean value_function loss: 0.0140Mean surrogate loss: -0.0094Mean entropy loss: 8.4871Mean reward: 6.06Mean episode length: 515.96
Episode_Reward/track_lin_vel_xy_exp: 0.3945
Episode_Reward/track_ang_vel_z_exp: 0.2131Episode_Reward/lin_vel_z_l2: -0.0302Episode_Reward/ang_vel_xy_l2: -0.0485Episode_Reward/dof_torques_l2: -0.0438Episode_Reward/dof_acc_l2: -0.0953Episode_Reward/action_rate_l2: -0.0474Episode_Reward/feet_air_time: -0.0075Episode_Reward/undesired_contacts: -0.0016
Episode_Reward/flat_orientation_l2: 0.0000Episode_Reward/dof_pos_limits: 0.0000Curriculum/terrain_levels: 0.2560
Metrics/base_velocity/error_vel_xy: 0.2929
Metrics/base_velocity/error_vel_yaw: 0.2349Episode_Termination/time_out: 1.7917Episode_Termination/base_contact: 5.0417
--------------------------------------------------------------------------------Total timesteps: 11206656Iteration time: 4.02sTime elapsed: 00:06:54ETA: 01:24:00################################################################################Learning iteration 114/1500 Computation: 24878 steps/s (collection: 3.888s, learning 0.064s)Mean action noise std: 0.49Mean value_function loss: 0.0144Mean surrogate loss: -0.0091Mean entropy loss: 8.4738Mean reward: 6.77Mean episode length: 546.42
Episode_Reward/track_lin_vel_xy_exp: 0.3991
Episode_Reward/track_ang_vel_z_exp: 0.2165Episode_Reward/lin_vel_z_l2: -0.0308Episode_Reward/ang_vel_xy_l2: -0.0495Episode_Reward/dof_torques_l2: -0.0449Episode_Reward/dof_acc_l2: -0.0971Episode_Reward/action_rate_l2: -0.0484Episode_Reward/feet_air_time: -0.0080Episode_Reward/undesired_contacts: -0.0019
Episode_Reward/flat_orientation_l2: 0.0000Episode_Reward/dof_pos_limits: 0.0000Curriculum/terrain_levels: 0.2656
Metrics/base_velocity/error_vel_xy: 0.3042
Metrics/base_velocity/error_vel_yaw: 0.2438Episode_Termination/time_out: 2.0417Episode_Termination/base_contact: 5.3750
--------------------------------------------------------------------------------Total timesteps: 11304960Iteration time: 3.95sTime elapsed: 00:06:58ETA: 01:24:00
使用默認參數訓練的CPU和內存占用情況如下
GPU占用情況如下(不得不感嘆5090的強大)
(env_isaaclab) ? Environments nvidia-smi
Sat Jul 26 16:06:58 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 575.64.03 Driver Version: 575.64.03 CUDA Version: 12.9 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 5090 Off | 00000000:01:00.0 On | N/A |
| 0% 35C P0 171W / 575W | 17438MiB / 32607MiB | 25% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------++-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 2720 G /usr/lib/xorg/Xorg 613MiB |
| 0 N/A N/A 3027 G /usr/bin/gnome-shell 187MiB |
| 0 N/A N/A 3477 G ...exec/xdg-desktop-portal-gnome 8MiB |
| 0 N/A N/A 4017 G /usr/share/code/code 81MiB |
| 0 N/A N/A 4845 G ...ess --variations-seed-version 46MiB |
| 0 N/A N/A 5289 G ...ersion=20250725-130039.589000 140MiB |
| 0 N/A N/A 6131 G ...OTP --variations-seed-version 63MiB |
| 0 N/A N/A 21308 C+G .../envs/env_isaaclab/bin/python 15971MiB |
| 0 N/A N/A 21987 G /usr/bin/gnome-system-monitor 18MiB |
+-----------------------------------------------------------------------------------------+
四、總結
50系顯卡雖強,但軟件生態還在逐步完善,許多庫尚未完全適配,配置過程中需要頻繁查閱 Nightly 版本、修補依賴、調整腳本。Ubuntu 24.04 雖然新,但也存在一些兼容性問題,比如 Isaac Sim 4.5 目前還不支持 ROS 2 Jazzy,對于想要深度集成機器人中間件的用戶來說,需要提前規劃。
接下來我還打算繼續測試 Isaac Lab 在多智能體協同、規劃與博弈任務中的表現,并嘗試集成 ROS 2 等模塊,構建更加完善的實驗平臺。希望這篇文章能為正在探索這條技術路線的朋友帶來一些參考,也歡迎大家留言交流、一起摸索進步。