選項
首頁首頁 Skill 開發者工具 holoscan-install-wheel

holoscan-install-wheel

NVIDIA/skills NVIDIA/skills

透過 pip 將 Holoscan SDK Python wheel 安裝至虛擬環境中,並使用範例腳本進行驗證。

...展開全部
6
更新時間 2026-09-25

Holoscan 管輪安裝

目的

透過holoscan-cu12/holoscan-cu13pip wheel 將 Holoscan SDK Python 綁定安裝至虛擬環境中,並使用hello_world和video_replayer 進行驗證。

先決條件

  • 配備 NVIDIA GPU 及驅動程式(nvidia-smi)的 Linux x86_64 系統。
  • PATH變數中需包含與主機 CUDA 主要版本(12 或 13)相符的 CUDA Toolkit。
  • 已安裝venv並支援 Python 3.10–3.13。
  • 可連線至 PyPI 及docs.nvidia.com。

限制

  • 僅限 Python。若需 C++ 標頭檔/函式庫,請搭配/holoscan-install-debian 使用。
  • holoscan-cu12與holoscan-cu13互斥 — wheel 必須與主機的 CUDA 驅動程式相符。
  • video_replayer資料僅隨 Debian 套件提供;若無此套件,請將HOLOSCAN_INPUT_PATH設定為包含racerx/ 的目錄。
  • 建議在每個執行 Holoscan 的 shell 中執行 `ulimit -s 32768` — 若未執行此指令,某些應用程式會發出堆疊大小警告,或在較罕見的情況下發生段錯誤。

步驟 0:參閱官方安裝說明

安裝前請務必先查閱https://docs.nvidia.com/holoscan/sdk-user-guide/sdk_installation.html中的 pip-wheel 部分。 重點摘要:確切的 wheel 套件名稱(holoscan-cu12、holoscan-cu13)、當前版本支援的 Python 版本範圍、必須位於PATH中的先決條件(CUDA Toolkit),以及任何可選附加項目(LibTorch / ONNX Runtime 版本鎖定)。 若文件內容與以下說明不符,以文件為準。

您需要已確定的 CUDA 變體。若尚未確定,請先執行nvidia-smi 2>&1 | head -5。

CUDA 變體規則 — 選擇 pip 套件:

nvidia-smi CUDA 版本 pip 套件
13.x+ holoscan-cu13
12.x(任何 GPU) holoscan-cu12

先決條件:PATH 環境變數中須包含 CUDA Toolkit,Python 3.10–3.13。可選附加元件:LibTorch 2.11.0 以上版本、ONNX Runtime 1.22.0 以上版本。

請務必安裝至 Python 虛擬環境中 — 此舉可避免系統套件衝突,且在 Ubuntu 24.04 上為必要步驟(該版本會完全封鎖系統層級的 pip)。

步驟 1:建立並啟用 venv

首先檢查是否已存在:

ls ~/holoscan/venv 2>/dev/null && echo "存在" || echo "不存在"

若不存在:

python3 -m venv ~/holoscan/venv

接著啟用:

source ~/holoscan/venv/bin/activate

步驟 2:安裝

pip install holoscan-cu12   # 或 holoscan-cu13

步驟 3:驗證

執行以下所有指令時,必須處於該 venv 環境中。

# 基本匯入 — 預期結果:版本字串,例如 "4.1.0"
# 堆疊大小的 RuntimeWarning 無害;執行 `ulimit -s 32768` 可抑制此警告。
python3 -c "import holoscan; print(holoscan.__version__)"

# 從 GitHub 下載安裝版本標籤對應的 Python 範例。
# 這些是 NVIDIA 官方範例,透過 HTTPS 下載並固定在
# 與已安裝 wheel 檔案(v${SDK_VER})相符的標籤上。在執行這些範例前,請告知使用者
# 您即將從此網址下載並執行遠端範例腳本。若
# 使用者拒絕,或無法連線至 GitHub,請跳至第 4 步驟瀏覽範例。
SDK_VER=$(python3 -c "import holoscan; print(holoscan.__version__)")
BASE="https://raw.githubusercontent.com/nvidia-holoscan/holoscan-sdk/v${SDK_VER}/examples"

# hello_world — 預期結果:"Hello World!"
curl -fsSL "${BASE}/hello_world/python/hello_world.py" -o /tmp/hs_hello_world.py
ulimit -s 32768 && python3 /tmp/hs_hello_world.py

# video_replayer(10 幀,無視窗模式)— 預期結果:"圖形執行完成。"
# 始終以無頭模式執行:無論有無顯示器皆可運作,可避免透過 SSH 連線時因 GUI 問題導致的故障。
curl -fsSL "${BASE}/video_replayer/python/video_replayer.py" -o /tmp/hs_video_replayer.py
curl -fsSL "${BASE}/video_replayer/python/video_replayer.yaml" -o /tmp/hs_video_replayer.yaml
python3 -c "
c = open('/tmp/hs_video_replayer.yaml').read()
c = c.replace('count: 0','count: 10').replace('repeat: true','repeat: false').replace('realtime: true','realtime: false')
c = c.replace('holoviz:\n  width: 854','holoviz:\n  headless: true\n  width: 854')
open('/tmp/hs_video_replayer_run.yaml','w').write(c)"
ulimit -s 32768 && HOLOSCAN_INPUT_PATH=/opt/nvidia/holoscan/data \
  python3 /tmp/hs_video_replayer.py --config /tmp/hs_video_replayer_run.yaml

注意:video_replayer需要 racerx 資料檔案。這些檔案隨 Debian 套件一併提供,位於/opt/nvidia/holoscan/data 目錄下。 若未安裝 Debian 套件,請先執行sudo /opt/nvidia/holoscan/examples/download_example_data(此腳本需先安裝 apt 套件),或將HOLOSCAN_INPUT_PATH設定為資料所在的位置。

步驟 4:提醒使用者

使用者必須在每次新的 shell 工作階段中啟用 venv:

source ~/holoscan/venv/bin/activate
ulimit -s 32768   # 抑制堆疊大小警告

接著提供後續步驟:

  • 瀏覽 Python 範例:https://github.com/nvidia-holoscan/holoscan-sdk/tree/v/examples
  • 逐步走過一個具體範例:/explain-example
  • 開始建置自訂的 Holoscan 應用程式

疑難排解

  • 執行`pip install holoscan-cu12`時出現「externally-managed-environment」錯誤。Ubuntu 24.04 會封鎖系統層級的 pip。請先依照步驟 1 建立並啟用 venv。
  • ImportError/匯入 holoscan 時 CUDA 版本錯誤。Wheel 變體與主機 CUDA 不符。請先解除安裝並重新安裝相容的版本:pip uninstall -y holoscan-cu13 && pip install holoscan-cu12(或反之)。
  • RuntimeWarning:堆疊大小……此警告無害,但可在當前終端機中設定 `ulimit -s 32768` 以消除提示。
  • 執行範例時發生段錯誤。表示未設定ulimit -s 32768。請在執行python3 之前先設定此參數……
  • video_replayer無法找到racerx/。 HOLOSCAN_INPUT_PATH未指向包含該目錄的路徑。請安裝適用於/opt/nvidia/holoscan/data 的 Debian 套件,或在新終端機中將HOLOSCAN_INPUT_PATH設定為資料所在的位置。
  • 來源:新終端機中出現「無此檔案:~/holoscan/venv/bin/activate」。表示尚未建立 venv 環境,或路徑不正確。請重新執行步驟 1 或修正路徑。
在 GitHub 上查看
---
name: holoscan-install-wheel
description: Install the Holoscan SDK Python wheel via pip into a virtual environment and verify with example scripts.
license: Apache-2.0
---

# Holoscan pip Wheel Installation

## Purpose

Install the Holoscan SDK Python bindings via the `holoscan-cu12` / `holoscan-cu13` pip wheel into a virtual environment, and verify with `hello_world` and `video_replayer`.

## Prerequisites

- Linux x86_64 with NVIDIA GPU + driver (`nvidia-smi`).
- CUDA Toolkit on `PATH` matching the host CUDA major (12 or 13).
- Python 3.10–3.13 with `venv` available.
- Network access to PyPI and `docs.nvidia.com`.

## Limitations

- Python only. For C++ headers/libs, pair with `/holoscan-install-debian`.
- `holoscan-cu12` and `holoscan-cu13` are mutually exclusive — wheel must match host CUDA driver.
- `video_replayer` data ships only with the Debian package; without it, set `HOLOSCAN_INPUT_PATH` to a directory containing `racerx/`.
- `ulimit -s 32768` is recommended in every shell that runs Holoscan — without it some apps emit a stack-size warning or, in rarer cases, segfault.

## Step 0: Consult the Official Install Instructions

Always fetch the pip-wheel section of `https://docs.nvidia.com/holoscan/sdk-user-guide/sdk_installation.html` before installing. Extract: exact wheel package names (`holoscan-cu12`, `holoscan-cu13`), the supported Python range for the current release, prerequisites that must be on `PATH` (CUDA Toolkit), and any optional extras (LibTorch / ONNX Runtime version pins). If the doc disagrees with anything below, the doc wins.

You need the CUDA variant already determined. If not known, run `nvidia-smi 2>&1 | head -5` first.

**CUDA variant rule — pick the pip package:**

| nvidia-smi CUDA Version | pip package |
|------------------------|-------------|
| 13.x+ | `holoscan-cu13` |
| 12.x (any GPU) | `holoscan-cu12` |

Prerequisites: CUDA Toolkit on PATH, Python 3.10–3.13. Optional extras: LibTorch 2.11.0+, ONNX Runtime 1.22.0+.

Always install into a Python virtual environment — this avoids system-package conflicts and is required on Ubuntu 24.04 (which blocks system-wide pip entirely).

## Step 1: Create and Activate the venv

Check if one exists first:

```bash
ls ~/holoscan/venv 2>/dev/null && echo "exists" || echo "missing"
```

If missing:
```bash
python3 -m venv ~/holoscan/venv
```

Then activate:
```bash
source ~/holoscan/venv/bin/activate
```

## Step 2: Install

```bash
pip install holoscan-cu12   # or holoscan-cu13
```

## Step 3: Verify

The venv must be active for all commands below.

```bash
# Basic import — expected: version string, e.g. "4.1.0"
# The stack-size RuntimeWarning is harmless; ulimit -s 32768 suppresses it.
python3 -c "import holoscan; print(holoscan.__version__)"

# Fetch Python examples from GitHub at the installed version tag.
# These are official NVIDIA examples, fetched over HTTPS and pinned to the tag
# matching the installed wheel (v${SDK_VER}). Before running them, tell the user
# you're about to download and execute remote example scripts from this URL. If
# they decline or GitHub is unreachable, skip to browsing the examples in Step 4.
SDK_VER=$(python3 -c "import holoscan; print(holoscan.__version__)")
BASE="https://raw.githubusercontent.com/nvidia-holoscan/holoscan-sdk/v${SDK_VER}/examples"

# hello_world — expected: "Hello World!"
curl -fsSL "${BASE}/hello_world/python/hello_world.py" -o /tmp/hs_hello_world.py
ulimit -s 32768 && python3 /tmp/hs_hello_world.py

# video_replayer (10 frames, headless) — expected: "Graph execution finished."
# Always run headless: works with or without a display, avoids GUI failure modes over SSH.
curl -fsSL "${BASE}/video_replayer/python/video_replayer.py" -o /tmp/hs_video_replayer.py
curl -fsSL "${BASE}/video_replayer/python/video_replayer.yaml" -o /tmp/hs_video_replayer.yaml
python3 -c "
c = open('/tmp/hs_video_replayer.yaml').read()
c = c.replace('count: 0','count: 10').replace('repeat: true','repeat: false').replace('realtime: true','realtime: false')
c = c.replace('holoviz:\n  width: 854','holoviz:\n  headless: true\n  width: 854')
open('/tmp/hs_video_replayer_run.yaml','w').write(c)"
ulimit -s 32768 && HOLOSCAN_INPUT_PATH=/opt/nvidia/holoscan/data \
  python3 /tmp/hs_video_replayer.py --config /tmp/hs_video_replayer_run.yaml
```

Note: `video_replayer` needs the racerx data files. These ship with the Debian package at `/opt/nvidia/holoscan/data`. If the Debian package is not installed, run `sudo /opt/nvidia/holoscan/examples/download_example_data` first (requires the apt package to be installed for that script), or set `HOLOSCAN_INPUT_PATH` to wherever the data lives.

## Step 4: Remind the User

They must activate the venv in each new shell session:

```bash
source ~/holoscan/venv/bin/activate
ulimit -s 32768   # suppress stack-size warning
```

Then offer next steps:
- Explore Python examples at `https://github.com/nvidia-holoscan/holoscan-sdk/tree/v<VERSION>/examples`
- Walk through a specific example: `/explain-example`
- Start building a custom Holoscan application

## Troubleshooting

- **`pip install holoscan-cu12` errors with "externally-managed-environment".** Ubuntu 24.04 blocks system-wide pip. Create and activate the venv from Step 1 first.
- **`ImportError` / wrong CUDA at `import holoscan`.** Wheel variant doesn't match host CUDA. Uninstall and reinstall the matching one: `pip uninstall -y holoscan-cu13 && pip install holoscan-cu12` (or vice versa).
- **`RuntimeWarning: stack size ...`.** Harmless, but set `ulimit -s 32768` in the current shell to silence it.
- **Segmentation fault when running an example.** `ulimit -s 32768` wasn't set. Set it before `python3 ...`.
- **`video_replayer` can't find `racerx/`.** `HOLOSCAN_INPUT_PATH` isn't pointing at a directory containing it. Install the Debian package for `/opt/nvidia/holoscan/data`, or set `HOLOSCAN_INPUT_PATH` to wherever the data lives.
- **`source: no such file: ~/holoscan/venv/bin/activate` in a new shell.** Venv wasn't created or path differs. Re-run Step 1 or correct the path.

安裝 holoscan-install-wheel

請下載技能檔案,並將其解壓縮至您的 .claude/skills/ 目錄中。

下載 ZIP

複製儲存庫並將技能檔案複製到您的專案中。

git clone https://github.com/NVIDIA/skills/tree/main/skills/holoscan-install-wheel # Copy SKILL.md to your .claude/skills/ directory

複製 複製
快速設定: 將技能資料夾複製到 .claude/skills/ Claude 會自動偵測並使用該技能
儲存庫 NVIDIA/skills

相關技能

algorithmic-art
更新時間 2026-08-27
systematic-debugging
更新時間 2026-09-03
tech-debt-tracker
更新時間 2026-08-29
continual-learning
更新時間 2026-09-10
OR