ModuleNotFoundError: No module named 'llama_cpp' in ComfyUI
Fix ModuleNotFoundError: No module named 'llama_cpp' in ComfyUI for AILab_QwenVL_GGUF, QwenVL GGUF PromptEnhancer, local LLM, VLM, and GGUF text nodes.
If you searched for ModuleNotFoundError: No module named 'llama_cpp', comfyui no module named llama_cpp, Error loading module AILab_QwenVL_GGUF_PromptEnhancer: No module named 'llama_cpp', or AILab_QwenVL_GGUF: No module named 'llama_cpp', the important detail is the package name: the import is llama_cpp, but the package you usually install is llama-cpp-python.
This error often appears when a custom node for local LLM, VLM, QwenVL GGUF, prompt enhancement, or GGUF text inference tries to load llama_cpp during startup.
Fast answer
Install llama-cpp-python into the exact Python environment that starts ComfyUI, then verify import llama_cpp before restarting. Do not run pip install from a random terminal and do not assume every GGUF image model workflow needs this package.
In the July 8, 2026 Wonderful Launcher telemetry export, llama_cpp appeared
as a repeated missing-module signature in QwenVL GGUF and PromptEnhancer
contexts: 64 fatal events across 5 installs for AILab_QwenVL_GGUF_PromptEnhancer,
41 events across 5 installs without a plugin context, and 51 events across 2
installs for AILab_QwenVL_GGUF. Treat it as a focused LLM/VLM dependency
issue, not a generic ComfyUI or GGUF image-model repair.
Exact Error Logs
If your terminal or startup logs show one of the following error messages, this guide is for you:
ModuleNotFoundError: No module named 'llama_cpp'
Error loading module AILab_QwenVL_GGUF_PromptEnhancer: No module named 'llama_cpp'
Error loading module AILab_QwenVL_GGUF: No module named 'llama_cpp'
RuntimeError: [qwenvl] llama_cpp is not available. Install the gguf vision dependency first.Symptoms
The startup log may show:
ModuleNotFoundError: No module named 'llama_cpp'or:
Cannot import <path> module for custom nodes: No module named 'llama_cpp'In Wonderful Launcher telemetry, this error repeatedly appeared with QwenVL GGUF style modules:
Error loading module AILab_QwenVL_GGUF_PromptEnhancer: No module named 'llama_cpp'When that happens, ComfyUI itself may still open, but the custom node family that depends on llama_cpp will not register.
What llama_cpp Is
llama_cpp is the Python import module provided by llama-cpp-python, the Python bindings for llama.cpp.
In ComfyUI, custom nodes may use it to run local GGUF language or vision-language models. That is separate from ordinary Stable Diffusion image checkpoints and separate from many image-model GGUF loader nodes.
Common places this can appear:
| Log clue | Usually means |
|---|---|
AILab_QwenVL_GGUF | A QwenVL GGUF helper node needs llama_cpp |
AILab_QwenVL_GGUF_PromptEnhancer | A QwenVL prompt enhancer tried to import llama_cpp during startup |
PromptEnhancer | A local LLM prompt enhancer tried to import llama_cpp |
| LLM or VLM custom node import failed | The node's Python package dependency is missing |
| Red LLM/GGUF text nodes | The plugin did not register because import failed |
If the workflow only loads image diffusion GGUF files and never mentions llama_cpp, use the workflow's GGUF loader documentation first. Do not add llama-cpp-python just because a model filename ends in .gguf.
Quick Diagnosis
| Check | Command |
|---|---|
| Which Python starts ComfyUI | python -c "import sys; print(sys.executable)" |
| Whether the package is installed | python -m pip show llama-cpp-python |
| Whether the import works | python -c "import llama_cpp; print('llama_cpp OK')" |
| Whether ComfyUI still opens | Look for To see the GUI go to: http://127.0.0.1:8188 |
For the official GitHub Windows portable package, run from the portable package root:
.\python_embeded\python.exe -s -c "import sys; print(sys.executable)"
.\python_embeded\python.exe -s -m pip show llama-cpp-python
.\python_embeded\python.exe -s -c "import llama_cpp; print('llama_cpp OK')"For a manual Git install, activate the same venv that launches ComfyUI:
python -c "import sys; print(sys.executable)"
python -m pip show llama-cpp-python
python -c "import llama_cpp; print('llama_cpp OK')"For ComfyUI Desktop or another managed launcher, use the app's environment tools. Do not assume the portable python_embeded folder exists.
Step 1: Decide Whether It Is Blocking
Fix llama_cpp when:
- the failing workflow uses QwenVL GGUF, VLM, local LLM, or prompt enhancer nodes
- the startup log says a custom node failed to import because of
llama_cpp - the workflow has red nodes from the same custom node family
Skip it for now when:
- ComfyUI opens and the workflow you need does not use local LLM/GGUF text nodes
- the visible issue is a missing image checkpoint, LoRA, VAE, or ControlNet model
- several unrelated plugins are failing at once and the earliest error is not
llama_cpp
If many packages are failing together, start with ComfyUI Plugin Import Failed or ComfyUI Dependency Conflicts before adding another native package.
Step 2: Install the Package in the Right Python
The import name and package name are different:
| User-visible text | What to enter |
|---|---|
No module named 'llama_cpp' | Diagnose the missing import |
| Package name field | llama-cpp-python |
| Full terminal command | python -m pip install llama-cpp-python in ComfyUI's Python |
| Requirements file | Install with -r requirements.txt; do not type requirements.txt as a package name |
For the official Windows portable package:
.\python_embeded\python.exe -s -m pip install llama-cpp-pythonFor a manual venv:
python -m pip install llama-cpp-pythonThat basic command may build from source. The official llama-cpp-python documentation also provides prebuilt wheel indexes for CPU and some CUDA builds. If a build fails, use a wheel that matches your Python and CUDA setup instead of repeatedly retrying the same command.
Step 3: Use CPU First Unless You Need GPU Acceleration
If your goal is only to make the custom node import, a CPU wheel can be the lowest-risk first repair:
.\python_embeded\python.exe -s -m pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpuFor a manual venv:
python -m pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpuUse a CUDA wheel only when the node actually runs local LLM inference and CPU performance is not enough. Match the wheel to your Python and CUDA version; do not paste a CUDA wheel URL from another machine.
Step 4: Verify the Import
Run:
.\python_embeded\python.exe -s -c "import llama_cpp; print(getattr(llama_cpp, '__file__', 'llama_cpp OK'))"For a manual venv:
python -c "import llama_cpp; print(getattr(llama_cpp, '__file__', 'llama_cpp OK'))"If this fails, ComfyUI will fail too. Fix the Python environment before restarting.
Common Failure Cases
| Error | Likely Cause | Safer Fix |
|---|---|---|
No module named 'llama_cpp' after install | Installed into the wrong Python | Use portable Python, the launch venv, or app-managed terminal |
| Build fails with CMake or compiler errors | Source build needs a compiler toolchain | Use an official prebuilt wheel index when compatible |
| CUDA wheel install fails | Wheel does not match Python/CUDA | Check Python version and CUDA version before choosing a wheel |
| Import works but nodes are still red | Plugin did not register or another dependency failed | Check /v2/customnode/import_fail_info_bulk |
| A QwenVL GGUF node still fails at runtime | Model file or chat handler is missing | Read the custom node's workflow requirements |
What Not To Do
- Do not search for a package literally named
llama_cppfirst; the common package name isllama-cpp-python. - Do not install into system Python if ComfyUI uses embedded Python or a venv.
- Do not install CUDA wheels blindly just because the machine has an NVIDIA GPU.
- Do not treat this as a normal image-model GGUF problem unless the traceback names
llama_cpp. - Do not reinstall all of ComfyUI before checking the custom node import failure.
How Wonderful Launcher Helps
This error is a good fit for environment-aware repair because the wrong Python is the most common trap. Wonderful Launcher helps by keeping installs separated, preserving the startup log, and making it easier to identify which environment actually starts ComfyUI before changing packages.
If llama_cpp is only one of many import failures, use the log to fix the earliest dependency first instead of adding more packages blindly.
Related Guides
- ComfyUI Plugin Import Failed
- ComfyUI-GGUF: Fix No Module Named 'gguf'
- ComfyUI Dependency Conflicts
- No Module Named 'onnx' or 'onnxruntime'
- Fix No module named errors in ComfyUI
- ComfyUI No Module Named Error: 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.