Reference only

Transformers errors: separate imports, API changes and model downloads

Locate the failing stage before changing Transformers, model files or network settings.

Find the first failing stage

Transformers documents installation, model caching and offline use as separate concerns. Its from_pretrained() path can fetch repository files, so a successful package import does not prove that a particular model revision is present locally. Installation and cache

python -c "import sys; print(sys.executable); import transformers, huggingface_hub; print(transformers.__version__, huggingface_hub.__version__)"

Run the check with the exact Python interpreter that launches ComfyUI. Keep the full traceback and the node's declared dependency versions. A missing module points first to interpreter/package discovery; cannot import name calls for the requested symbol, installed package version and node API to be compared, not an automatic upgrade. If the failure occurs during model loading, record repository ID, exact revision, requested filename, cache location and any HTTP/authentication error. The Hub download API selects files and revisions separately. Hub download guide

Do not upgrade to a new major library version merely because a download failed. For offline use, document which model files are already cached and whether that call uses HF_HUB_OFFLINE=1 or local_files_only=True. The latter is a from_pretrained() option, not a promise that every node or plugin will stay offline. Avoid deleting a whole cache as an exploratory first step. Offline instructions

Retest one controlled change with the same model identity and a small input. Record import, file retrieval, model initialization and inference independently. The trust_remote_code=True route loads repository-provided custom model code; inspect its publisher and code before enabling it, rather than treating it as a generic fix for an import or download error. Custom models

Sources and English text reviewed 2026-09-26. No package, model or GPU run and no download/authentication test. The stages are editorial guidance, not a diagnosis of your environment.

Didn't solve it?

Check the next possible cause

The same symptom can come from a different cause. Work through these related entries in order.

  1. aiohttp and requests: a missing library is not a connection failureNo module named aiohttpCheck library availability before investigating DNS, TLS, HTTP responses or timeouts.
  2. Missing safetensors package or unreadable weights? Diagnose them separatelyNo module named safetensorsDistinguish the Python library from the weight file before reinstalling packages or downloading models again.
Paste your full log into the error finder

Was this page helpful?

Anonymous. Only a yes/no counter is stored; no account, IP address or device details.

Sources & references

2026-09-26 reviewed official Transformers installation/cache/offline docs, Hub revision/file download guide and custom-model code boundary; English text review only. No package, model, network, auth or GPU test.

01Transformers installation, cache and offline useSource checked: 2026-09-2602Hugging Face Hub file and revision downloadsSource checked: 2026-09-2603Transformers custom model codeSource checked: 2026-09-26

Report an issue · 090f4a62-c7c3-5f52-a5f5-58c18fb666ef