Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Ask for the NPP runtime by the name that has wheels on CUDA 13 (#10587)

Daniel Hanad6738997696
diff --git a/studio/install_python_stack.py b/studio/install_python_stack.py
index 3a55cab1f16..b01b59a527c 100644
--- a/studio/install_python_stack.py
+++ b/studio/install_python_stack.py
@@ -514,6 +514,27 @@ def _cuda_major_for_npp(torch_version: "str | None", index_url: str) -> str:
return match.group(1)[:2] if match else ""
+# `nvidia-npp-cu13` is a wheel-less stub ("DEPRECATED: Use nvidia-npp instead"); plain
+# `nvidia-npp` is the 13.x runtime. WRONG to widen into "13 drops the suffix": `nvidia-cudnn`
+# and `nvidia-nccl` kept theirs, and their unsuffixed names are fake warning packages.
+_NPP_SUFFIXED_THROUGH_CUDA_MAJOR = 12
+
+
+def _npp_requirement(cuda_major: str) -> str:
+ """The NPP runtime for this CUDA major, spelled the way its publisher spells it.
+
+ Bounded because `nvidia-npp` carries the same 0.0.0a0 junk the stub is made of, and a cu14
+ host must not take a 13 runtime. `[0-9]+` not `isdigit()`, as in _hsa_override_gfx_arch:
+ isdigit() also takes the superscripts, where `int()` below raises, and the non-ASCII digits,
+ which reach a str `\\d` and emit an unparseable `>=١٣`.
+ """
+ if not re.fullmatch(r"[0-9]+", cuda_major):
+ return f"nvidia-npp-cu{cuda_major}"
+ if int(cuda_major) <= _NPP_SUFFIXED_THROUGH_CUDA_MAJOR:
+ return f"nvidia-npp-cu{cuda_major}"
+ return f"nvidia-npp>={cuda_major},<{int(cuda_major) + 1}"
+
+
# Any sign of the CUDA runtime, versioned or not: nvcudart_hybrid64.dll is the Windows cu130
# spelling and carries no major. Absent entirely from a cpu build, which is what makes "" safe.
_CUDA_RUNTIME_MARKER_RE = re.compile(
@@ -8116,11 +8137,9 @@ def install_python_stack() -> int:
"the rest of the install is unaffected"
)
elif _codec_index:
- # torchcodec's CUDA build dlopens libnppicc and libnppc, and NPP is NOT in
- # torch's own dependency set, so a --no-deps install from a cuNNN index reports
- # success and then fails to import, disabling audio for a reason nothing here
- # would otherwise name. docker/Dockerfile installs nvidia-npp-cu12 beside the
- # same wheel for exactly this. cu13x wheels want nvidia-npp-cu13.
+ # torchcodec's CUDA build dlopens libnppicc and libnppc, and NPP is not in torch's
+ # dependency set, so a --no-deps install from a cuNNN index imports and then fails.
+ # _npp_requirement spells the name, which stops being suffixed after 12.
_npp_major = _cuda_major_for_npp(_codec_torch_ver, _codec_index)
if _codec_fellback:
# The pin is gone, so the tag no longer describes this wheel. Probe EVERY
@@ -8134,13 +8153,14 @@ def install_python_stack() -> int:
"which its torch tag implies -- matching NPP to the wheel"
)
_npp_major = _npp_probed
- if _npp_major and not pip_install_try(
+ _npp_spec = _npp_requirement(_npp_major) if _npp_major else ""
+ if _npp_spec and not pip_install_try(
"Installing torchcodec CUDA runtime (NPP)",
"--no-cache-dir",
- f"nvidia-npp-cu{_npp_major}",
+ _npp_spec,
):
_note(
- f"could not install nvidia-npp-cu{_npp_major} -- torchcodec may fail to "
+ f"could not install {_npp_spec} -- torchcodec may fail to "
"import on a host without the CUDA toolkit, leaving audio disabled"
)
diff --git a/tests/python/test_torchcodec_torch_compat.py b/tests/python/test_torchcodec_torch_compat.py
index 69418e9ae7b..92f553f94a3 100644
--- a/tests/python/test_torchcodec_torch_compat.py
+++ b/tests/python/test_torchcodec_torch_compat.py
@@ -1234,7 +1234,7 @@ def test_a_cuda_index_codec_also_installs_npp():
dependency set, so a --no-deps install from a cuNNN index reports success and then fails
to import. docker/Dockerfile installs nvidia-npp-cu12 beside the same wheel."""
source = (REPO_ROOT / "studio" / "install_python_stack.py").read_text(encoding = "utf-8")
- assert 'f"nvidia-npp-cu{_npp_major}"' in source
+ assert '_npp_spec = _npp_requirement(_npp_major) if _npp_major else ""' in source
assert "Installing torchcodec CUDA runtime (NPP)" in source
# The major follows the index leaf, and a cpu or rocm index asks for nothing.
@@ -1255,6 +1255,77 @@ def test_a_cuda_index_codec_also_installs_npp():
assert "nvidia-npp-cu12" in dockerfile
+def test_cuda_13_asks_for_the_unsuffixed_npp():
+ """`nvidia-npp-cu13` is a wheel-less stub, so asking for it builds from source (or takes a
+ 1.1 kB placeholder under --only-binary); plain `nvidia-npp` is the 13.x runtime."""
+ from studio.install_python_stack import _npp_requirement
+
+ assert _npp_requirement("11") == "nvidia-npp-cu11"
+ assert _npp_requirement("12") == "nvidia-npp-cu12"
+ assert _npp_requirement("13") == "nvidia-npp>=13,<14"
+ assert _npp_requirement("14") == "nvidia-npp>=14,<15"
+ assert not any(
+ _npp_requirement(str(major)).startswith("nvidia-npp-cu13") for major in range(11, 20)
+ )
+ assert _npp_requirement("not-a-major") == "nvidia-npp-cunot-a-major"
+
+
+def test_the_npp_rename_is_per_package_not_a_rule_about_13():
+ """ "13 means no suffix" is WRONG: NCCL and cuDNN kept theirs, and their unsuffixed names
+ resolve to "A fake package to warn the user they are not installing the correct package".
+ Hence a named constant with the counterexamples beside it, not a bare 13."""
+ source = (REPO_ROOT / "studio" / "install_python_stack.py").read_text(encoding = "utf-8")
+ assert "_NPP_SUFFIXED_THROUGH_CUDA_MAJOR = 12" in source
+ assert "nvidia-cudnn" in source and "nvidia-nccl" in source
+
+
+def test_the_unsuffixed_request_is_bounded_to_the_major():
+ """`nvidia-npp` carries the same 0.0.0a0 junk the stub is made of, which an unbounded
+ resolve behind an exclude-newer cutoff or a partial mirror can select."""
+ from studio.install_python_stack import _npp_requirement
+ for major in ("13", "14", "15"):
+ spec = _npp_requirement(major)
+ assert spec.startswith(f"nvidia-npp>={major}"), spec
+ assert spec != "nvidia-npp", "a bare name can resolve to the 0.0.0a0 placeholder"
+ # Upper bound too, so a cu14 host cannot take a 13 runtime or the reverse.
+ assert f",<{int(major) + 1}" in spec, spec
+
+
+def test_no_major_can_kill_the_install_or_emit_an_unparseable_requirement():
+ """`isdigit()` accepts more than `int()` does, and both gaps land here: the superscripts
+ raise ValueError out of an OPTIONAL dependency, and the non-ASCII decimal digits pass
+ `int()` but emit a non-PEP-440 `>=١٣`. The latter is reachable, since `_cuda_major_for_npp`
+ matches with a str pattern where `\\d` is every Unicode decimal digit."""
+ from studio.install_python_stack import _npp_requirement
+
+ source = (REPO_ROOT / "studio" / "install_python_stack.py").read_text(encoding = "utf-8")
+ assert (
+ 'if not re.fullmatch(r"[0-9]+", cuda_major):' in source
+ ), "the major check must be an explicit ASCII digit match, not str.isdigit()"
+
+ # int()-hostile: must degrade, never raise.
+ for major in ("²", "³", "⁵"):
+ assert major.isdigit(), "fixture is only meaningful if isdigit() accepts it"
+ assert _npp_requirement(major) == f"nvidia-npp-cu{major}"
+
+ # PEP 440-hostile: int()-able, so only an ASCII check keeps them out of a version bound.
+ for major in ("١٣", "۱۳", "१३"):
+ assert major.isdigit() and int(major) == 13
+ spec = _npp_requirement(major)
+ assert not spec.startswith(
+ "nvidia-npp>="
+ ), f"{major!r} reached a PEP 440 version bound as {spec!r}"
+ assert spec == f"nvidia-npp-cu{major}"
+
+ # The real domain: a one or two character slice of an ASCII match. All of it must parse.
+ packaging_req = pytest.importorskip("packaging.requirements").Requirement
+ for major in [str(n) for n in range(0, 100)]:
+ packaging_req(_npp_requirement(major))
+
+ for major in ("", " ", "12.0", "-1", "+13", "13a", "1" * 64, "\U0001d7d9\U0001d7db"):
+ assert isinstance(_npp_requirement(major), str)
+
+
def test_the_npp_major_comes_from_the_resident_torch_not_the_index_url():
"""Matching `/cuNNN$` against an authenticated mirror ending `/simple?token=...` skipped
NPP on a `+cu128` host, so the codec then failed to import without a CUDA toolkit."""