Spark Environment Setup
Seth HobsonCommunityCreated by Seth Hobson
- Skill
- Tool integration
- Cloud and DevOps
- MIT
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to configuring machine learning environments on NVIDIA DGX Spark (GB10, aarch64, CUDA 13). It emphasizes a container-first strategy to manage complex ABI dependencies and architecture-specific requirements, while offering a verified bare-pip fallback for custom needs. It addresses common pitfalls such as libcudart errors, SM121 compatibility, and package version skew.
What it does
- Provides container-first deployment patterns for NGC and Unsloth images.
- Defines a verified, pinned pip installation sequence for bare-metal setups.
- Diagnoses and resolves CUDA ABI mismatches and library loading errors.
- Offers verification commands to confirm GPU visibility and environment health.
- Provides workarounds for specific component incompatibilities like Triton and torchao.
- Guides users on when to pull versus rebuild container images.
When to use it
- When initializing a new DGX Spark environment for training or inference.
- When encountering import errors related to libcudart or missing symbols.
- When ML frameworks fail to load or silently fall back to CPU execution.
- When deciding between NGC containers and manual pip installations.
- When restoring a system after an OS update or environment corruption.
Advantages
- Reduces environment setup time by using validated container configurations.
- Prevents common ABI-related crashes by enforcing CUDA 13 compatibility.
- Ensures reproducibility through pinned package versions and container digests.
- Provides clear diagnostic steps for hardware-specific failures.
- Avoids dependency hell by prioritizing tested, pre-configured stacks.
Usage examples
- “How do I start a standard PyTorch training container on my DGX Spark?”
- The agent provides the docker run command using the nvcr.io/nvidia/pytorch:25.09-py3 image with the necessary runtime, IPC, and volume mount flags.
- “My code is failing with an undefined symbol error related to CUDA. How do I fix it?”
- The agent guides you to check your torch version's CUDA tag and suggests switching to a container or wheel built against CUDA 13 to resolve the ABI mismatch.
- “I need to install Unsloth on Spark without a container. What is the correct sequence?”
- The agent provides the specific, pinned pip install commands for transformers, peft, and unsloth, including the mandatory --no-deps flag and torchao update.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/wshobson/spark-environment-setup/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip spark-environment-setup.zip -d .agents/skills
Documentation by Seth Hobson
Spark Environment Setup
DGX Spark ships a GB10 Grace Blackwell chip: aarch64 CPU, SM121 GPU, 128GB unified memory, CUDA 13. This is a narrower and younger platform than a standard x86 CUDA 12 box, so package selection and ABI matching matter more than usual — the wheel ecosystem for aarch64 + CUDA 13 is still filling in.
When to Use This Skill
Setting up a fresh Spark box for training or inference.
Hitting an import error mentioning
libcudart, a missing symbol, or a wheel that "installed fine but won't load."A framework install (PyTorch, Unsloth, TRL, vLLM, xformers) fails, hangs, or silently falls back to CPU.
Deciding whether to use an NGC container or bare pip.
Restoring a working setup after an OS reinstall or a base-image update, needing to re-verify from scratch.
Each of these accepts the same general fix: match the container/wheel combination to CUDA 13 and SM121, don't fight the ABI.
Container-First Rule
Quick decision, before the detail below:
Standard training/inference work → NGC PyTorch container.
Unsloth-centric fine-tuning → Unsloth container (it ships the pinned Triton/xformers/transformers combination already validated for that path).
Neither fits (custom system package, local IDE interpreter) → bare pip, following the exact sequence further down.
Default to a container. Use nvcr.io/nvidia/pytorch:25.09-py3
as the base for general work — the newest tag confirmed working
on this hardware; pull a newer blessed tag if locally available
rather than hard-blocking on 25.11-py3. NGC's tag is dated, so
running it directly is fine:
docker run --runtime=nvidia --gpus all -it --rm \
nvcr.io/nvidia/pytorch:25.09-py3unsloth/unsloth:dgxspark-latest is a moving tag by
contrast — resolve and pin its digest before running it for
anything reproducible; the bare tag is a discovery step only,
not the default invocation. Full pull-inspect-pin sequence and
flag rationale/volume mounts for finetuning/ run dirs:
references/container-workflow.md. Treat bare pip as the exception.
The reason for the container-first stance is pinning, not convenience. Triton, xformers, and transformers versions interact narrowly with GB10's SM121 target and CUDA 13; a container locks all of them together against a combination already validated on this hardware. Bare pip leaves that resolution to you, one broken import at a time.
When bare pip is warranted, follow the NVIDIA playbook's install sequence verbatim and in order:
pip install "transformers==5.13.1" "peft==0.19.1" "hf_transfer==0.1.9" "datasets==4.3.0" "trl==1.8.0"
pip install --no-deps "unsloth==2026.7.2" "unsloth_zoo==2026.7.2" "bitsandbytes==0.49.2"
pip install -U "torchao==0.17.0"The second command's --no-deps flag is not optional —
letting pip re-resolve Unsloth's dependency tree on aarch64 is
a common way to pull in an incompatible torch or triton build.
The third line is not optional either: the NGC base image's
bundled torchao is too old for current peft's LoRA-attach
path (ImportError: ... torchao ... only versions above 0.16.0 are supported) — a hard blocker, not a warning. Every == pin
above is load-bearing, taken from the dated known-good version
matrix in references/stack-matrix.md (its Last verified date
governs staleness) — an unpinned install resolves current PyPI
versions well outside what this Unsloth release supports.
Pull a fresh tag when a new blessed release is announced.
Rebuild locally from one of the two bases only when a project
needs an extra system package layered in — not to "upgrade" a
component the image already pins. Details on both paths:
references/container-workflow.md.
One more preflight: official DGX Spark playbooks have shipped
broken before. Check recent issues on
github.com/NVIDIA/dgx-spark-playbooks (and the other
resources in references/stack-matrix.md) before trusting a
recipe verbatim for a long run.
The ABI Rule
The single most common failure on Spark is a CUDA 12/13 ABI
mismatch: a wheel built against libcudart.so.12 loaded on a
system that only has libcudart.so.13. The install usually
succeeds; the failure surfaces later as a missing-symbol error
or a segfault that doesn't obviously point at CUDA.
Fix: pull wheels from download.pytorch.org/whl/cu130 (the
cu130-tagged aarch64 builds), or use one of the containers
above, which already carry a matched build. Before chasing a
stack trace that mentions a CUDA symbol, check which CUDA tag
the installed wheel was built against:
python3 -c "import torch; print(torch.version.cuda)"If that output doesn't start with 13, the ABI mismatch is the
first thing to fix. NGC container builds (e.g.
nvcr.io/nvidia/pytorch:25.09-py3) build torch internally
against CUDA 13 with no +cu130 wheel tag — pip show torch
won't say cu130 there, and that absence alone is not a failure.
Typical symptoms:
ImportError: undefined symbolreferencing a CUDA runtime function.A segfault on the first
.cuda()call, no useful traceback.A wheel that installs cleanly, then fails at import time — pip's resolver doesn't check CUDA ABI, only version constraints.
Two "identical" environments behaving differently — usually one has a cu130 wheel, the other a cu121/cu124 leftover.
The fix is the same regardless of symptom: match the wheel's CUDA tag to the system, or use a container that already does.
Component Quick Table
Condensed status for the components most likely to come up.
Full table with wheel URLs, build flags, the sm_121 vs sm_121a
distinction, and the dated known-good version matrix:
references/stack-matrix.md.
| Component | Status |
|---|---|
| PyTorch | ✅ official cu130 aarch64 wheels |
| bitsandbytes | ✅ works out of the box |
| Triton | ✅ needs the TRITON_PTXAS_PATH parameter set |
| flash-attn | ❌ skip pip build; NGC bundles a working one — see spark-training-gotchas G2 |
| xformers | source build only (TORCH_CUDA_ARCH_LIST=12.1) |
| vLLM | nightly wheels only |
| TransformerEngine / NVFP4 train | container-only |
Everything else — Unsloth, Axolotl, TRL, PEFT — installs cleanly through the container-first path above. LLaMA-Factory and NeMo are fragile on Spark; check upstream issues first.
Verification Commands
Confirm the environment can actually see the GPU before running anything expensive:
import torch
print(torch.cuda.is_available(), torch.version.cuda)This call returns two values; the exact output format is one
line, <bool> <cuda-version>:
True 13.0If it prints False instead, don't jump straight to a wheel
reinstall — ABI mismatch is one cause among several:
| Hypothesis | Quick check |
|---|---|
| Runtime/flags | nvidia-smi fails in-container too |
| Device visibility | echo $CUDA_VISIBLE_DEVICES |
| Permissions | ls -l /dev/nvidia* |
| CUDA init state | wedged process; retry fresh shell/container |
| ABI mismatch (usual culprit) | torch.version.cuda not 13.x |
Check nvidia-smi first — if it doesn't show the GPU, it's one
of the first three, not ABI. Reinstall a wheel only once ABI is
confirmed. Per-hypothesis detail: references/stack-matrix.md.
Run right after the container starts, before installing
project-specific packages.
One more check: if Triton kernel compilation fails once
training starts, set
TRITON_PTXAS_PATH=/usr/local/cuda/bin/ptxas and retry — see
references/stack-matrix.md for the full workaround list.
Next Steps
A verified environment is only the starting point. See also:
spark-training-gotchas for failure preflights before a
training run, and spark-memory-thermal-ops for unified-memory
OOMs and thermal throttling during long ones.
Files
- ATTRIBUTION.mdAdded by AutoGineer995 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md7.9 KiB
- references/container-workflow.md4.1 KiB
- references/stack-matrix.md6.9 KiB
references/stack-matrix.md
Last verified: 2026-07-14 — refresh when CUDA, PyTorch, or Unsloth major versions change.
Spark Stack Matrix
Full component-by-component status for the ML training/inference stack on DGX Spark (GB10, SM121, aarch64, CUDA 13). This is the detail table behind the "Component Quick Table" in SKILL.md.
| Component | Status | Notes |
|---|---|---|
| PyTorch (cu130, aarch64) | ✅ | Official wheels at download.pytorch.org/whl/cu130. Matches the system CUDA 13 ABI — see the ABI Rule in SKILL.md. |
| bitsandbytes | ✅ | 0.48+ works out of the box. |
| Triton | ✅ (with env var) | Needs TRITON_PTXAS_PATH=/usr/local/cuda/bin/ptxas set, or kernel compilation fails to find ptxas. |
| flash-attn | ❌ skip | No sm_121 kernels shipped or buildable yet. PyTorch's SDPA backend is faster on this hardware anyway — don't spend time chasing a flash-attn build. |
| xformers | source build only | No prebuilt aarch64/SM121 wheel. Build with TORCH_CUDA_ARCH_LIST=12.1 set, or the build targets the wrong architecture and either fails or silently produces non-functional kernels. |
| vLLM | nightly wheels only | Use wheels.vllm.ai/nightly/cu130. The SM121 fix landed in the nightly channel around 2026-06; stable/release wheels predate it. |
| TransformerEngine / NVFP4 training | container-only | Not practical via bare pip; use the NGC PyTorch container. NVFP4BlockScaling targets SM100 — treat SM121 support as caveated, not guaranteed. |
| Unsloth | ✅ (container preferred) | Official Docker image unsloth/unsloth:dgxspark-latest (a moving tag — resolve and pin its digest for reproducible/CI use, see references/container-workflow.md), or the NVIDIA playbook pip sequence (see SKILL.md). Bare pip installs have hit torchcodec and GPU-detection gotchas. |
| Axolotl / TRL / PEFT | ✅ | Standard install, no special handling needed. |
| LLaMA-Factory / NeMo | fragile / in progress | Known to be unreliable on this platform as of this writing; expect breakage and check upstream issues before depending on either for a run. |
Known-Good Version Matrix (Dated)
SKILL.md's bare-pip sequence pins datasets/trl explicitly
for a reason: an unpinned pip install transformers peft hf_transfer datasets trl accelerate resolves current PyPI
versions of transformers/trl/datasets that sit well
outside what a given Unsloth release declares support for — pip
installs them anyway and only warns after the fact. The
combination below was confirmed working end-to-end (bf16 LoRA
load + attach + a full SFT run) on nvcr.io/nvidia/pytorch:25.09-py3
as of the date above; treat it as a dated snapshot to re-verify,
not a permanent pin:
| Package | Verified-working version |
|---|---|
transformers | 5.13.1 |
trl | 1.8.0 |
peft | 0.19.1 |
datasets | 4.3.0 (pin as-is; not re-verified independently of the combination above) |
unsloth / unsloth_zoo | 2026.7.2 |
torchao | 0.17.0 (pure-Python wheel; NGC base image ships 0.13.0+git, too old — pip install -U torchao after the Unsloth line) |
bitsandbytes | 0.49.2 |
hf_transfer | 0.1.9 (current stable; see the deprecation note below before relying on it) |
If a bare-pip install lands on a different combination than
this table (pip resolver drift is expected as new releases
ship), re-run the load+LoRA-attach smoke test in SKILL.md's
Verification Commands before trusting the environment, and
check gh issue list --repo NVIDIA/dgx-spark-playbooks for a
version-skew report matching the symptom before assuming it's
novel.
HF_HUB_ENABLE_HF_TRANSFER is deprecated on huggingface_hub
1.23+. Setting it now only produces FutureWarning: The HF_HUB_ENABLE_HF_TRANSFER environment variable is deprecated ... Please use HF_XET_HIGH_PERFORMANCE instead, and downloads route
through Xet rather than hf_transfer regardless. This is cosmetic
(downloads still succeed, and fast) on current huggingface_hub
— stale task instructions or older recipes that still reference
hf_transfer-based env setup should be read as intent ("make
downloads fast"), not a literal current-API requirement; set
HF_XET_HIGH_PERFORMANCE=1 instead on huggingface_hub 1.23+.
GPU-Detection False Negative: Per-Hypothesis Detail
The full discriminating check behind SKILL.md's Verification
Commands hypothesis table, in the order to work through them:
Runtime/flags. If
docker runwas missing--runtime=nvidia --gpus all,nvidia-smirun inside the container fails or shows no devices even though the host sees the GPU fine. Fix: re-run with both flags.Device visibility.
echo $CUDA_VISIBLE_DEVICES— an empty string set explicitly (not merely unset) hides all devices from CUDA; a stale index (e.g.1on a single-GPU box) hides the only device present. Fix:unset CUDA_VISIBLE_DEVICESor set it to0.Permissions.
ls -l /dev/nvidia*— missing entries or aPermission deniedon read means the container/user can't open the device nodes (common when running rootless or with a restrictive seccomp/AppArmor profile). Fix: match the host's device-cgroup rules, or don't run rootless for GPU workloads.CUDA init state. A prior process that crashed mid-kernel can leave the driver's CUDA context wedged for that process tree. Retrying in a fresh shell or a freshly started container (not just a new Python process in the same shell) rules this out cheaply before assuming anything deeper is wrong.
ABI mismatch. The last hypothesis to check, not the first:
python3 -c "import torch; print(torch.version.cuda)"not starting with13confirms alibcudart.so.12-linked wheel on a CUDA-13-only system — see the ABI Rule inSKILL.md. This is the only one of the five that a wheel reinstall actually fixes; reinstalling before ruling out 1-4 wastes a cycle without changing the outcome if the real cause is a flag, an env var, or a permission.
A torchcodec/driver interaction is the most frequently reported
instance of (5) on this hardware specifically — see
gh issue list --repo NVIDIA/dgx-spark-playbooks for current
reports before assuming a novel cause.
sm_121 vs sm_121a
GB10's GPU identifies as sm_121. Some newer kernel features — notably NVFP4's native cvt.e2m1x2 conversion instruction — require code compiled for sm_121a, a superset target, not plain sm_121. If NVFP4 inference is ~32% slower than FP8 on this hardware, this is why: the kernel likely wasn't compiled with the a variant. Check the build flags of whatever wheel or container you're using before assuming the hardware itself is the bottleneck.
Canonical resources
github.com/NVIDIA/dgx-spark-playbooksbuild.nvidia.com/spark/unslothgithub.com/natolambert/dgx-spark-setupgithub.com/albond/DGX_Spark_Unsloth_Lossless_Speedupgithub.com/NvMayMay/nvfp4-lora-spark
Official playbooks have shipped broken before. Check each repo's recent issues before starting a long run, not after it fails.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs a command-line tool, Needs Python
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Seth Hobson
- Publisher
- Seth Hobson (Community)
- Source
- wshobson/agents · plugins/dgx-spark-ops/skills/spark-environment-setup · commit 4bde316
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Seth Hobson.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download spark-environment-setup.zip