No module named 'transformers' in ComfyUI
Fix ComfyUI No module named transformers errors in the active Python environment and understand when the failure comes from ComfyUI's core text stack.
ComfyUI stops with ModuleNotFoundError: No module named 'transformers'. This is not always a plugin problem: in current builds the error often comes from ComfyUI's own text and tokenizer stack, where the traceback runs through comfy\sd1_clip.py and fails on from transformers import CLIPTokenizer before the server starts.
File "...\ComfyUI\comfy\sd1_clip.py", line 3, in <module>
from transformers import CLIPTokenizer
ModuleNotFoundError: No module named 'transformers'That path is ComfyUI's own model/tokenizer import, not a random custom node.
Triage
| What you see | Meaning | First action |
|---|---|---|
No module named 'transformers' from comfy\sd1_clip.py | Core text/tokenizer dependency missing | Install transformers in ComfyUI's active Python |
pip show transformers works in system Python but ComfyUI still fails | Wrong Python environment | Use python_embeded\python.exe or the active venv |
Local requirements.txt lists transformers>=... / tokenizers>=... | ComfyUI expects this package family | Repair it from the same environment |
Installing transformers exposes a new missing package | Wider dependency drift | Keep following the new first blocker |
Server already starts and only a plugin fails on transformers | Could be plugin-specific | Still install into the same ComfyUI Python first |
Step 1: Check the local requirement line
Get-Content ComfyUI\requirements.txt | Select-String "transformers|tokenizers"A recent ComfyUI requirement is transformers>=4.50.3 and tokenizers>=0.13.3. This tells you whether your ComfyUI code already expects the package, and which version to match.
Step 2: Install in the Python that launches ComfyUI
For Windows portable:
.\python_embeded\python.exe -s -m pip install "transformers>=4.50.3"For a manual venv:
python -m pip install "transformers>=4.50.3"This may also install adjacent packages such as tokenizers, huggingface-hub, and regex. Use the version in your own local requirements.txt when it differs. For ComfyUI Desktop or another managed launcher, install through that app's environment, not a separate terminal Python.
Step 3: Restart and read the next blocker
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-buildIn a broken portable environment, transformers is often not the last missing package (a common next blocker is No module named 'torchsde'). Fix the next first blocker in the same Python rather than guessing several packages at once.
Step 4: Distinguish core failure from plugin failure
If the traceback points into ComfyUI\comfy\sd1_clip.py, supported_models.py, or sd.py, the missing transformers import is part of ComfyUI's own text stack. If it points into a folder under custom_nodes, it may be plugin-specific — but the repair still belongs in the same Python environment that launches ComfyUI.
What not to do
- do not install
transformersinto system Python when ComfyUI usespython_embeded - do not downgrade Torch, NumPy, or Pillow when the only error is a missing
transformersimport - do not assume a plugin error means core ComfyUI is healthy until you read the traceback path
- do not keep installing packages without restarting and reading the new first blocker
Related Guides
- Repair ComfyUI Portable Dependencies One Missing Module At A Time
- ModuleNotFoundError: No module named 'torch' in ComfyUI
- comfyui-frontend-package is not installed in ComfyUI
- ComfyUI Startup Failed
- Plugin Missing Module Warning: When It Is Safe to Ignore
Source References
Start free with Wonderful Launcher if this affects your real ComfyUI environment. It keeps launcher-native repair, task logs, and runtime checks in one place; credits are only for image generation and metered tools.
Download Wonderful LauncherSee credit packagesDid this fix your issue?
Your answer helps prioritize verified ComfyUI repairs.