选项
首页首页 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 包将 Holoscan SDK Python 绑定安装到虚拟环境中,并使用hello_world和video_replayer 进行验证。

先决条件

  • 配备 NVIDIA GPU 及驱动程序(nvidia-smi)的 Linux x86_64 系统。
  • PATH环境变量中包含的 CUDA 工具包版本需与主机 CUDA 主版本(12 或 13)一致。
  • 已安装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 工具包),以及任何可选附加项(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工具包,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})匹配的标签上。在运行它们之前,请告知用户
# 您即将从该 URL 下载并执行远程示例脚本。如果
# 用户拒绝或无法访问 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 帧,无头模式)— 预期结果:"Graph execution finished."
# 始终以无头模式运行:无论是否有显示器均可运行,可避免通过 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   # 抑制栈大小警告

然后提供后续步骤:

  • 在https://github.com/nvidia-holoscan/holoscan-sdk/tree/v/examples上探索 Python 示例
  • 逐步演示一个具体示例:/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