Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

setup: Ubuntu keeps its checked cuda-toolkit-13-0 install; Debian stops with a message when no 13.x installs (#2172 follow-up)

Niko122120b501743d6f
diff --git a/setup.py b/setup.py
index 3a3bc2de6..dc67e41c6 100644
--- a/setup.py
+++ b/setup.py
@@ -3287,10 +3287,16 @@ def install_build_tools(gpu, yes):
deb, "CUDA repository key")
run(["sudo", "dpkg", "-i", str(deb)])
run(["sudo", "apt-get", "update"])
- # Debian 13's CUDA repo carries no 13.0 package: take the oldest 13.x minor it has (Ubuntu still gets 13.0).
- for minor in range(5):
- if run(["sudo", "apt-get", "install", "-y", f"cuda-toolkit-13-{minor}"], check=False).returncode == 0:
- break
+ if repo.startswith("ubuntu"): # as before: 13.0, and a failed install stops setup here
+ run(["sudo", "apt-get", "install", "-y", "cuda-toolkit-13-0"])
+ else:
+ # Debian 13's CUDA repo carries no 13.0 package: take the oldest 13.x minor it has
+ for minor in range(10):
+ if run(["sudo", "apt-get", "install", "-y", f"cuda-toolkit-13-{minor}"], check=False).returncode == 0:
+ break
+ else:
+ fail(f"no cuda-toolkit-13-x package could be installed from NVIDIA's {repo} repository",
+ "install the CUDA Toolkit 13 from https://developer.nvidia.com/cuda-downloads and run it again")
nvcc, cuda_v = find_nvcc(below=(13, 0)) if old else find_nvcc()
if (WIN and find_vcvars(cuda_v) is None) or (not WIN and shutil.which("g++") is None):
fail("the C++ build tools did not install", "install them by hand (README.md) and run it again")
diff --git a/tools/test_setup_cuda_repo.py b/tools/test_setup_cuda_repo.py
index 5853a8690..1c59cf742 100644
--- a/tools/test_setup_cuda_repo.py
+++ b/tools/test_setup_cuda_repo.py
@@ -68,6 +68,36 @@ class AptRepo(unittest.TestCase):
setup.install_build_tools({"arch": "86", "archs": [86]}, True)
self.assertEqual(installed, ["cuda-toolkit-13-0"])
+ def test_debian_without_any_13_x_stops_with_guidance(self):
+ out = io.StringIO()
+ with mock.patch.object(setup, "WIN", False), \
+ mock.patch.object(setup, "find_nvcc", return_value=(None, (0, 0))), \
+ mock.patch.object(setup.shutil, "which", lambda n: "/usr/bin/" + n), \
+ mock.patch("builtins.open", mock.mock_open(read_data='ID=debian\nVERSION_ID="12"\n')), \
+ mock.patch.object(setup, "download"), \
+ mock.patch.object(setup, "run", return_value=types.SimpleNamespace(returncode=100)), \
+ contextlib.redirect_stdout(out):
+ with self.assertRaises(SystemExit):
+ setup.install_build_tools({"arch": "86", "archs": [86]}, True)
+ self.assertIn("no cuda-toolkit-13-x package", out.getvalue())
+
+ def test_ubuntu_install_failure_still_stops_setup(self):
+ def fake_run(cmd, check=True, **kw):
+ failed = cmd[-1] == "cuda-toolkit-13-0"
+ if failed and check:
+ raise SystemExit(1) # setup.run's own fail() on a checked command
+ return types.SimpleNamespace(returncode=100 if failed else 0)
+
+ with mock.patch.object(setup, "WIN", False), \
+ mock.patch.object(setup, "find_nvcc", return_value=(None, (0, 0))), \
+ mock.patch.object(setup.shutil, "which", lambda n: "/usr/bin/" + n), \
+ mock.patch("builtins.open", mock.mock_open(read_data='ID=ubuntu\nVERSION_ID="22.04"\n')), \
+ mock.patch.object(setup, "download"), \
+ mock.patch.object(setup, "run", side_effect=fake_run), \
+ contextlib.redirect_stdout(io.StringIO()):
+ with self.assertRaises(SystemExit):
+ setup.install_build_tools({"arch": "86", "archs": [86]}, True)
+
def test_unknown_distro_stops_with_guidance(self):
out = io.StringIO()
with mock.patch.object(setup, "WIN", False), \