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://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/container-workflow.md
Last verified: 2026-07-14 — refresh when the blessed container tags change.
Container Workflow
Concrete docker run invocations for the two blessed images, plus the bare-pip fallback.
NGC PyTorch container
General-purpose training/inference base:
docker run --runtime=nvidia --gpus all -it --rm \
--ipc=host --ulimit memlock=-1 --ulimit stack=67108864 \
-v "$(pwd)/finetuning:/workspace/finetuning" \
nvcr.io/nvidia/pytorch:25.09-py3Tag guidance: 25.09-py3 is the tag actually verified working on this hardware (torch 2.9.0a0+50eac811a6.nv25.09, CUDA 13.0 baked in, matches the ABI Rule's expectations — no functional delta observed for the packages exercised in fine-tuning workflows). Treat SKILL.md's mention of a newer blessed tag as guidance to pull when locally available, not a hard requirement — if the cited newer tag isn't locally cached and pulling isn't practical, fall back to the newest available 25.x tag and record the gap in the run's notes rather than blocking on it.
--runtime=nvidia --gpus allgives the container access to the GB10 GPU; without it, PyTorch inside the container will report no CUDA device even though the host sees one fine.--ipc=hostand theulimitflags avoid shared-memory starvation for PyTorch's DataLoader workers.Mount the repo's
finetuning/run directory so checkpoints and logs land on the host filesystem, not inside the ephemeral container layer — the--rmflag deletes the container (and anything not mounted out) on exit.
Unsloth container
For Unsloth-centric fine-tuning runs, prefer the purpose-built image over the generic NGC one — it ships the pinned Triton/xformers/transformers combination already validated for this hardware.
dgxspark-latest is a moving tag, unlike the NGC image's dated 25.09-py3 tag above. Don't run it directly as the invocation you'll rely on for a real run — resolve and pin its digest first, then run by digest:
# 1. Discovery step: pull the moving tag and confirm it starts.
docker pull unsloth/unsloth:dgxspark-latest
# 2. Resolve the tag to its current digest.
docker inspect --format='{{index .RepoDigests 0}}' unsloth/unsloth:dgxspark-latest
# -> unsloth/unsloth@sha256:<resolved digest>
# 3. Run by digest — this is the reproducible invocation.
docker run --runtime=nvidia --gpus all -it --rm \
--ipc=host --ulimit memlock=-1 --ulimit stack=67108864 \
-v "$(pwd)/finetuning:/workspace/finetuning" \
unsloth/unsloth@sha256:<resolved digest>Substitute the pinned @sha256:... digest for the tag in CI or any pipeline where reproducibility matters — a run recorded against dgxspark-latest by tag alone cannot be reproduced later if the tag has moved on. Re-resolve and re-pin the digest whenever picking up a new blessed release (see "Pull vs rebuild" below).
Same flag rationale as the NGC invocation above. Prefer this over rebuilding a custom Unsloth image from the NGC base.
Pull vs rebuild
Pull a fresh tag when: a new blessed release is announced, or you're chasing a bug that a recent tag's changelog says it fixes.
Rebuild locally (starting FROM one of the two images above) when: you need an extra system package or Python dependency layered in for a specific project, and that dependency doesn't conflict with the pinned training stack. Don't rebuild to "upgrade" a component that the base image already pins — that reintroduces the version-matrix problem the container exists to avoid.
Bare-pip escape hatch
If a container genuinely doesn't fit (see SKILL.md's Container-First Rule), isolate the environment with uv rather than the system Python, and follow the NVIDIA playbook install sequence from SKILL.md inside it.
Caveat: if uv insists on a dependency version that conflicts with what the playbook pins (a common outcome given how young the aarch64/CUDA-13 wheel ecosystem is), use uv pip install --override to force the pinned versions through rather than letting the resolver silently substitute an incompatible build. Verify the result with the Verification Commands section of SKILL.md before trusting the environment.
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 or Seth Hobson.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download spark-environment-setup.zip