Skip to main content

Module nvidia_blocklist

Module nvidia_blocklist 

Source
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:

  1. Requirements filtering — filter_requirements strips banned lines from requirements.txt files before pip install -r.
  2. --no-deps + explicit deps (Stage 3) — for torch-adjacent packages whose transitive deps could pull nvidia-* wheels; installed with --no-deps and a curated dependency list. pip constraints cannot cleanly “ban” a package, so --no-deps is the transitive guarantee.
  3. Post-install contamination check — contaminated_packages scans pip list output so verification (Stage 4) can raise InstallerError::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 by is_cuda_nvidia_package (requirements filtering) + --no-deps.

Functions§

contaminated_packages
Scan pip list output 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)?