Expand description
NVIDIA/CUDA exclusion — the SINGLE source of truth for the hard prime requirement that NO NVIDIA/CUDA dependency is ever installed.
§Tenet (v0.3.0 remediation)
“Nvidia CUDA deps are NEVER installed by ANY component — ESPECIALLY Rusty Llama. THIS IS A HARD PRIME REQUIREMENT. NOT A SINGLE NVIDIA DEP MAY EVER BE INSTALLED. Rusty is for AMD GPUs.”
§Why this module exists
The crate previously had THREE divergent CUDA/nvidia blocklists:
installer.rs::filter_cuda_requirements(requirements-file filter, narrow)megatron.rs::is_safe_package(single-package check, broadest)textgen.rs::EXCLUDED_PATTERNS(regex form)
They disagreed (e.g. the first lacks cudnn/cublas/nvjitlink/nccl
that the second catches), and comfyui used NONE of them. Everything now
routes through here so the rule is defined once and applied everywhere.
§Enforcement layers
This module is the detection + filtering layer. It feeds two enforcement mechanisms used together:
- Requirements filtering —
filter_requirementsstrips banned lines fromrequirements.txtfiles beforepip install -r. --no-deps+ explicit deps (Stage 3) — for torch-adjacent packages whose transitive deps could pullnvidia-*wheels; installed with--no-depsand a curated dependency list. pip constraints cannot cleanly “ban” a package, so--no-depsis the transitive guarantee.- Post-install contamination check —
contaminated_packagesscanspip listoutput so verification (Stage 4) can raiseInstallerError::NvidiaContamination.
Constants§
- BLOCKED_
EXACT - Exact package names (after normalization) that are NVIDIA/CUDA/ROCm-conflicting.
- BLOCKED_
PREFIXES - Package-name prefixes that mark an NVIDIA/CUDA dependency.
- CUDA_
URL_ MARKERS - CUDA wheel URL markers (in URLs like
...+cu124...whl). - NVIDIA_
RUNTIME_ PREFIXES - NVIDIA/CUDA runtime-library prefixes (the
nvidia-*/cuda*wheels), for the execution chokepoint. Deliberately EXCLUDES the torch/triton family — those are legitimately installed from the ROCm index by the core pytorch/triton installers, and are instead kept out of third-party installs byis_cuda_nvidia_package(requirements filtering) +--no-deps.
Functions§
- contaminated_
packages - Scan
pip listoutput for any installed NVIDIA/CUDA runtime packages. - extract_
pkg_ name - Normalize a requirement spec to its bare package name.
- filter_
requirements - Filter requirements TEXT, returning lines that are safe to install on a ROCm/AMD stack (all NVIDIA/CUDA/ROCm-conflicting lines removed).
- filter_
requirements_ file - Filter a requirements FILE, returning the content with all NVIDIA/CUDA/ROCm-conflicting lines removed.
- is_
cuda_ nvidia_ package - Is this package name an NVIDIA/CUDA/ROCm-conflicting package?
- is_
cuda_ wheel_ url - Does this wheel URL carry a CUDA build marker? (e.g.
...+cu124...whl) - is_
nvidia_ cuda_ runtime_ package - Is this an NVIDIA/CUDA runtime package (a
nvidia-*/cuda*lib)?