How to run torchaudio with Docker+GPU on DGX Spark

2026-01-06

Shunsuke Fukazawa

Hello! I'm Fukazawa, an intern at Quixotiks Inc. since October 2024. I am currently involved in tasks related to speech recognition (ASR) using NVIDIA DGX Spark.

When running local ASR with Docker + GPU, I encountered a PyTorch compatibility error, so I'm documenting the cause and solution here. I hope this helps anyone in a similar situation!

Background

When running local ASR on Docker using a GPU,pip install torchaudio a compatibility error occurred when installed:

NVIDIA GB10 with CUDA capability sm_121 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_80 sm_86 sm_90 compute_90.

Cause of the error

  • pip install torchaudio When installed with dependency resolution, to match the PyPI distribution (wheel), torch may be updated or replaced.
  • Since DGX Spark (GB10) is sm_121 , the replaced torch is sm_121 The above compatibility error occurs if the build does not support it.

Solution

Build torchaudio from source

  • Use NVIDIA's official PyTorch container as the base image.
  • Inside the container, CUDA-enabled PyTorch (torch) is pre-installed.
  • During pip's dependency resolution, torch to prevent replacement, this torch is fixed.

Dockerfile:

FROM nvcr.io/nvidia/pytorch:25.09-py3

RUN apt-get update && apt-get install -y --no-install-recommends \\
    build-essential wget ca-certificates

ARG TORCHAUDIO_VERSION=2.9.0

WORKDIR /tmp
RUN wget -O audio-v${TORCHAUDIO_VERSION}.tar.gz \\
    <https://github.com/pytorch/audio/archive/refs/tags/v${TORCHAUDIO_VERSION}.tar.gz> \\
    && tar xzf audio-v${TORCHAUDIO_VERSION}.tar.gz

WORKDIR /tmp/audio-${TORCHAUDIO_VERSION}
RUN python -m pip install -v . --no-deps --no-build-isolation --no-use-pep517

WORKDIR /workspace
CMD ["/bin/bash"]
  • -no-deps: During dependency resolution, torch do not modify.
  • -no-build-isolation: NGC's torch Build for
  • -no-use-pep517: Torchaudio's official recommendation

To pass the GPU when launching the container, --gpus all is required:

docker run --rm -it --gpus all <image> bash

Verification

import torch, torchaudio

print("torch:", torch.__version__, "cuda:", torch.version.cuda)
print("CUDA available:", torch.cuda.is_available())
print(f"Device: {torch.cuda.get_device_name(0)}")
print("torchaudio:", torchaudio.__version__)

Output:

torch: 2.9.0a0+50eac811a6.nv25.09 cuda: 13.0
CUDA available: True
Device: NVIDIA GB10
torchaudio: 2.9.0

Summary

When setting up a Docker + GPU environment on DGX Spark (GB10 / sm_121),pip install torchaudio can cause torch to be replaced, potentially leading to compatibility errors.

In such cases, torch can be kept fixed in the base image, and torchaudio can be installed from source to avoid this issue. I hope this information is helpful!