LogoWonderful Launcher
  • Home
  • Pricing
  • Docs
  • Download

ComfyUI "main.py makes it difficult to embed" Fix

Partially verifiedLast verified 2026-06-29

Fix ComfyUI main.py makes it difficult to embed and python_embeded confusion by using the Python environment that actually starts ComfyUI.

Community Knowledge

This page is based on common ComfyUI troubleshooting patterns and has not been fully tested across all environments. Back up your environment before changing packages.

If you searched for main.py makes it difficult to embed ComfyUI, ComfyUI python_embeded, or ComfyUI python_embeded vs python_embedded, the root issue is usually the same: ComfyUI is being launched from one Python/runtime while your repair command targets another.

If you use the Windows portable version of ComfyUI, all Python packages must be installed into the python_embeded folder — not your system Python, not a separate virtual environment.

Many ComfyUI troubleshooting problems trace back to installing packages into the wrong Python. Understanding how python_embeded works saves hours of debugging.

Fast answer

For Windows portable ComfyUI, use .\python_embeded\python.exe -s -m pip ... from the portable folder. Do not use plain pip, a Microsoft Store Python, Conda, or a random venv unless that is the environment that starts ComfyUI.

Quick Diagnosis

What you searched or sawWhat it usually meansFirst move
python_embeded vs python_embeddedThe portable folder name is intentionally python_embeded in ComfyUI packagesUse the folder that exists in your portable root
main.py makes it difficult to embed ComfyUIYou may be trying to run main.py outside the expected ComfyUI root/runtimeRun from the portable root or use a manual venv install
Package installed but ComfyUI still says No module named ...Installed into the wrong PythonRun .\python_embeded\python.exe -s -m pip show <package>
Torch/CUDA works in system Python but not ComfyUIWrong environment was testedTest the Python that launches ComfyUI
You want a venvThat is the manual install path, not portable repairUse Manual Install

What python_embeded is

The official ComfyUI portable package for Windows ships with its own self-contained Python installation inside a folder called python_embeded. The official portable guide describes it as the independent Python required for ComfyUI to run. This folder contains:

  • A standalone Python interpreter (e.g., Python 3.12)
  • Pre-installed packages including PyTorch with CUDA support
  • The pip package manager
  • All dependencies needed to run ComfyUI

This embedded Python is completely separate from any Python you may have installed on your system through the Microsoft Store, python.org, Anaconda, or other means.

Why it exists

  • Isolation: Prevents conflicts with system Python or other Python projects
  • Reproducibility: Everyone using the portable package starts with the same environment
  • CUDA compatibility: The portable package bundles a specific PyTorch version matched to a specific CUDA build
  • Simplicity: Users do not need to manage virtual environments manually

The most common mistake

When you run pip install somepackage in a terminal, it installs into whatever Python pip belongs to — usually your system Python, not ComfyUI's embedded Python.

Wrong (installs into system Python):

pip install insightface
python -m pip install insightface

Correct (installs into ComfyUI's embedded Python):

.\python_embeded\python.exe -s -m pip install insightface

The -s flag tells Python to skip the user site-packages directory, ensuring packages only go into the embedded environment.

How to verify which Python ComfyUI uses

Check the batch file

Open run_nvidia_gpu.bat in a text editor. You will see something like:

.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build

This confirms ComfyUI uses the embedded Python.

Check what is installed

.\python_embeded\python.exe -s -m pip list

This shows all packages visible to ComfyUI. If a package is not in this list, ComfyUI cannot use it, even if it is installed in your system Python.

Check the Python version

.\python_embeded\python.exe --version

Common problems and fixes

"I installed the package but ComfyUI still says it's missing"

You probably installed it into the wrong Python. Verify:

.\python_embeded\python.exe -s -m pip show somepackage

If it shows nothing, install it again with the full path:

.\python_embeded\python.exe -s -m pip install somepackage

"pip is not recognized"

You are running pip from a terminal that does not have Python in its PATH. Use the full path instead:

.\python_embeded\python.exe -s -m pip install somepackage

"I accidentally installed packages into system Python"

This is harmless to ComfyUI — it simply did not get the package. Install again using the embedded Python path.

"Can I use a virtual environment instead?"

Yes, but then you are using the manual install method, not the portable package. The portable python_embeded already acts as an isolated environment. Creating a venv inside it would add unnecessary complexity.

"Can I update the embedded Python version?"

Do not replace the Python interpreter inside python_embeded manually. If you need a newer Python version, download a newer ComfyUI portable package or switch to a manual install with your own Python and venv.

How the folder structure works

ComfyUI_windows_portable/
├── python_embeded/           ← The embedded Python installation
│   ├── python.exe            ← The interpreter ComfyUI uses
│   ├── Lib/
│   │   └── site-packages/    ← Where pip installs packages
│   └── Scripts/
├── ComfyUI/                  ← The ComfyUI source code
│   ├── main.py
│   ├── requirements.txt
│   ├── custom_nodes/
│   └── models/
├── run_nvidia_gpu.bat         ← Launches ComfyUI with GPU
└── run_cpu.bat                ← Launches ComfyUI on CPU only

How Wonderful Launcher can help

Wonderful Launcher helps eliminate the embedded Python confusion. It helps manage the Python environment, guides you to install packages into the correct location, and helps prevent the "wrong Python" problem that causes most dependency errors.

Download Wonderful Launcher — it's free and helps simplify environment management.

Related guides

  • Install ComfyUI Portable
  • Install ComfyUI Manual
  • Fix No module named errors in ComfyUI
  • Torch Not Compiled With CUDA Enabled
  • ComfyUI Dependency Conflicts
  • ComfyUI Repair Broken Portable Dependencies
  • ComfyUI Startup Failed

Source References

  • ComfyUI GitHub
  • Official ComfyUI portable Windows guide
  • Official ComfyUI manual installation guide
  • Python Embedded Distribution Docs
  • pip Documentation

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 packages

Did this fix your issue?

Your answer helps prioritize verified ComfyUI repairs.

Table of Contents

Quick Diagnosis
What python_embeded is
Why it exists
The most common mistake
How to verify which Python ComfyUI uses
Check the batch file
Check what is installed
Check the Python version
Common problems and fixes
"I installed the package but ComfyUI still says it's missing"
"pip is not recognized"
"I accidentally installed packages into system Python"
"Can I use a virtual environment instead?"
"Can I update the embedded Python version?"
How the folder structure works
How Wonderful Launcher can help
Related guides
Source References