LogoWonderful Launcher
  • Product
  • Pricing
  • Solutions
  • Docs
  • Blog
  • Get Help
  • Download

No module named 'llama_cpp' in ComfyUI

Needs verification

Fix No module named 'llama_cpp' in ComfyUI QwenVL GGUF, local LLM, prompt enhancer, and GGUF text nodes by installing llama-cpp-python in the right Python.

If you searched for ModuleNotFoundError: No module named 'llama_cpp' or comfyui 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.

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 clueUsually means
AILab_QwenVL_GGUFA QwenVL GGUF helper node needs llama_cpp
PromptEnhancerA local LLM prompt enhancer tried to import llama_cpp
LLM or VLM custom node import failedThe node's Python package dependency is missing
Red LLM/GGUF text nodesThe plugin did not register because import failed

Quick Diagnosis

CheckCommand
Which Python starts ComfyUIpython -c "import sys; print(sys.executable)"
Whether the package is installedpython -m pip show llama-cpp-python
Whether the import workspython -c "import llama_cpp; print('llama_cpp OK')"
Whether ComfyUI still opensLook 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

For the official Windows portable package:

.\python_embeded\python.exe -s -m pip install llama-cpp-python

For a manual venv:

python -m pip install llama-cpp-python

That 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/cpu

For a manual venv:

python -m pip install llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu

Use 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

ErrorLikely CauseSafer Fix
No module named 'llama_cpp' after installInstalled into the wrong PythonUse portable Python, the launch venv, or app-managed terminal
Build fails with CMake or compiler errorsSource build needs a compiler toolchainUse an official prebuilt wheel index when compatible
CUDA wheel install failsWheel does not match Python/CUDACheck Python version and CUDA version before choosing a wheel
Import works but nodes are still redPlugin did not register or another dependency failedCheck /v2/customnode/import_fail_info_bulk
A QwenVL GGUF node still fails at runtimeModel file or chat handler is missingRead the custom node's workflow requirements

What Not To Do

  • Do not search for a package literally named llama_cpp first; the common package name is llama-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'
  • ComfyUI No Module Named Error: When It Is Safe to Ignore

Source References

  • llama-cpp-python GitHub repository
  • llama-cpp-python PyPI package
  • ComfyUI issue with No module named 'llama_cpp'
  • ComfyUI Desktop issue with Qwen VL and llama-cpp-python wheel install

You can fix it manually, or download Wonderful Launcher for Windows to diagnose plugin errors, missing dependencies, and broken ComfyUI environments without reinstalling.

Download free for Windows

Did this fix your issue?

Your answer helps prioritize verified ComfyUI repairs.

Table of Contents

Symptoms
What llama_cpp Is
Quick Diagnosis
Step 1: Decide Whether It Is Blocking
Step 2: Install the Package in the Right Python
Step 3: Use CPU First Unless You Need GPU Acceleration
Step 4: Verify the Import
Common Failure Cases
What Not To Do
How Wonderful Launcher Helps
Related Guides
Source References