Repair ComfyUI Portable Dependencies One Missing Module At A Time
A tested Windows portable ComfyUI repair transcript for missing SQLAlchemy, torch, frontend package, kornia, PyOpenGL, and other startup dependencies.
If a Windows portable ComfyUI environment starts failing with missing core packages, do not begin with a broad reinstall.
The safer repair loop is:
- start ComfyUI
- read the first new blocker in the log
- install only that package in
python_embeded - start again
- repeat until the server,
/system_stats,/object_info, andpip checkare healthy
This page is based on a real broken portable environment repaired on May 18, 2026. The lab started with ModuleNotFoundError: No module named 'sqlalchemy' and eventually recovered on an RTX 4070 Ti SUPER with CUDA PyTorch.
Practical rule
Run one install, then restart and read the new log. A copied error search should lead to the exact package that changed the next startup attempt, not to a giant command that hides what actually fixed the environment.
When To Use This Runbook
Use this page when:
- ComfyUI portable starts with
python_embeded\python.exe - startup stops before
Starting server - you see copied errors such as
ModuleNotFoundError: No module named 'sqlalchemy',No module named 'torch', orcomfyui-frontend-package is not installed - your models, workflows, and custom nodes are worth preserving
- you want to know which package changed the next failure, instead of reinstalling everything
Do not use this as a universal upgrade command. If only one custom node is missing one package, fix that custom node first.
The Tested Repair Chain
This was the actual one-package-at-a-time sequence from the repaired lab.
| Attempt | First new signal in the startup log | One package action | What changed after restart |
|---|---|---|---|
| 1 | ModuleNotFoundError: No module named 'sqlalchemy' | pip install "SQLAlchemy>=2.0" | exposed filelock |
| 2 | ModuleNotFoundError: No module named 'filelock' | pip install filelock | exposed alembic and yaml |
| 3 | Error importing dependencies: No module named 'alembic' | pip install alembic | database setup moved forward |
| 4 | ModuleNotFoundError: No module named 'yaml' | pip install PyYAML | exposed PIL |
| 5 | ModuleNotFoundError: No module named 'PIL' | pip install Pillow | exposed tqdm |
| 6 | ModuleNotFoundError: No module named 'tqdm' | pip install tqdm | exposed comfy_aimdo |
| 7 | ModuleNotFoundError: No module named 'comfy_aimdo' | pip install comfy-aimdo | exposed torch |
| 8 | ModuleNotFoundError: No module named 'torch' | installed torch, then replaced CPU Torch with torch==2.12.0+cu130 from the PyTorch CUDA index | CUDA became available |
| 9 | ModuleNotFoundError: No module named 'safetensors' | pip install safetensors | exposed packaging |
| 10 | ModuleNotFoundError: No module named 'packaging' | pip install packaging | exposed numpy |
| 11 | ModuleNotFoundError: No module named 'numpy' | pip install "numpy>=1.25.0" | exposed einops |
| 12 | ModuleNotFoundError: No module named 'einops' | pip install einops | exposed psutil |
| 13 | ModuleNotFoundError: No module named 'psutil' | pip install psutil | ComfyUI reached VRAM detection, then exposed torchvision |
| 14 | ModuleNotFoundError: No module named 'torchvision' | installed torchvision from the same CUDA wheel index | exposed torchaudio |
| 15 | ModuleNotFoundError: No module named 'torchaudio' | installed torchaudio from the same CUDA wheel index | exposed scipy |
| 16 | ModuleNotFoundError: No module named 'scipy' | pip install scipy | exposed transformers |
| 17 | ModuleNotFoundError: No module named 'transformers' | pip install transformers | exposed torchsde |
| 18 | ModuleNotFoundError: No module named 'torchsde' | pip install torchsde | exposed av |
| 19 | ModuleNotFoundError: No module named 'av' | pip install av | exposed aiohttp |
| 20 | ModuleNotFoundError: No module named 'aiohttp' | pip install aiohttp | exposed requests |
| 21 | ModuleNotFoundError: No module named 'requests' | pip install requests | exposed pydantic |
| 22 | ModuleNotFoundError: No module named 'pydantic' | pip install pydantic | exposed comfyui-frontend-package |
| 23 | comfyui-frontend-package is not installed | pip install comfyui-frontend-package | server started, but some built-in extra nodes failed to import |
At that point ComfyUI was alive, but the log still showed missing optional or built-in-extra dependencies. The cleanup pass continued in the same style:
| Cleanup signal | One package action | Result |
|---|---|---|
No module named 'kornia' in post-processing, canny, and morphology nodes | pip install kornia | node count rose from 657 to 685 |
No module named 'spandrel' in nodes_upscale_model.py | pip install spandrel | node count rose to 687 |
repeated No module named 'pydantic_settings' while parsing pyproject.toml | pip install pydantic-settings | the startup log shrank from noisy repeats to a short warning set |
OpenGL dependencies not available | pip install PyOpenGL, restart, then pip install glfw | GLSL/OpenGL node imported |
No module named 'simpleeval' in nodes_math.py | pip install simpleeval | no IMPORT FAILED lines remained |
comfyui-workflow-templates is not installed | pip install comfyui-workflow-templates | workflow template warning disappeared |
comfyui-embedded-docs package not found | pip install "comfyui-embedded-docs==0.4.4" | embedded docs warning disappeared |
WARNING: blake3 package not installed | pip install blake3 | blake3 warning disappeared |
Failed to import comfy_kitchen | pip install "comfy-kitchen>=0.2.8" | CUDA and eager comfy_kitchen backends loaded |
The final log still said the comfy_kitchen Triton backend was unavailable because triton was not installed. That was not a startup blocker: the CUDA and eager backends were available and the server opened normally.
Step 0: Start From The Portable Root
Open PowerShell in the folder that contains:
run_nvidia_gpu.bat
run_cpu.bat
python_embeded
ComfyUIConfirm the Python executable:
.\python_embeded\python.exe -s -c "import sys; print(sys.executable); print(sys.version)"If this path is not the Python that starts ComfyUI, stop and switch to the right environment.
Step 1: Capture Each Attempt
For a one-by-one repair, save logs for each start:
$ts = Get-Date -Format 'yyyyMMdd_HHmmss'
New-Item -ItemType Directory -Force .\repair_logs | Out-Null
$out = ".\repair_logs\attempt_${ts}_stdout.log"
$err = ".\repair_logs\attempt_${ts}_stderr.log"
Start-Process -FilePath ".\python_embeded\python.exe" `
-ArgumentList @("-s", "ComfyUI\main.py", "--windows-standalone-build") `
-WorkingDirectory (Get-Location) `
-RedirectStandardOutput $out `
-RedirectStandardError $err `
-PassThruThen read the bottom of the stderr log:
Get-Content $err -Tail 200Install only the package named by the first real blocker. Then start again and save a new log.
Step 2: Do Not Trust Port 8188 Until You Check Ownership
In the lab, http://127.0.0.1:8188/ returned 200, but it was another ComfyUI process from C:\Users\huhaibin\Documents\ComfyUI, not the broken lab.
Check the owner before declaring success:
Get-NetTCPConnection -LocalPort 8188 -ErrorAction SilentlyContinue |
Select-Object LocalAddress,LocalPort,State,OwningProcess
Get-CimInstance Win32_Process |
Where-Object { $_.CommandLine -like "*ComfyUI*main.py*" } |
Select-Object ProcessId,CommandLineIf 8188 is already occupied, start the broken environment on a clean port while repairing:
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --port 8191Only the process from the same portable root counts as proof.
Step 3: Verify Torch Before And After Installing It
If the log says No module named 'torch', installing torch from the default index may satisfy the import while giving you a CPU-only build.
That happened in the lab:
2.12.0+cpu None FalseFor the tested Nvidia repair, Torch had to be replaced from the CUDA wheel index:
.\python_embeded\python.exe -s -m pip install `
--index-url https://download.pytorch.org/whl/cu130 `
--extra-index-url https://pypi.tuna.tsinghua.edu.cn/simple `
"torch==2.12.0+cu130"Then verify in the same embedded Python:
.\python_embeded\python.exe -s -c "import torch; print(torch.__version__, torch.version.cuda, torch.cuda.is_available()); print(torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'no cuda')"The lab recovered this result:
2.12.0+cu130 13.0 True
NVIDIA GeForce RTX 4070 Ti SUPERUse the CUDA wheel that matches your environment. Do not assume the default pip install torch is GPU-enabled.
Step 4: Treat Frontend And Template Packages As ComfyUI Versioned Packages
When the log says:
comfyui-frontend-package is not installed.look at your own ComfyUI\requirements.txt before choosing versions.
In the lab, installing the frontend package unpinned gave:
ComfyUI frontend version: 1.43.18
required_frontend_version: 1.42.15It worked, but the safer public instruction is: copy the versions required by your local ComfyUI code when they are pinned.
The same applies to:
comfyui-frontend-packagecomfyui-workflow-templatescomfyui-embedded-docs
Step 5: Verify Recovery With More Than The Browser
The final lab start used:
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build --port 8191Healthy signals:
ComfyUI version: 0.20.1
pytorch version: 2.12.0+cu130
Device: cuda:0 NVIDIA GeForce RTX 4070 Ti SUPER : cudaMallocAsync
ComfyUI frontend version: 1.43.18
comfy-kitchen version: 0.2.8
Starting server
To see the GUI go to: http://127.0.0.1:8191Then verify endpoints:
Invoke-RestMethod http://127.0.0.1:8191/system_stats
Invoke-RestMethod http://127.0.0.1:8191/object_info
.\python_embeded\python.exe -s -m pip checkThe repaired lab returned:
ComfyUI 0.20.1
PyTorch 2.12.0+cu130
GPU: NVIDIA GeForce RTX 4070 Ti SUPER
object_info node count: 689
CheckpointLoaderSimple: present
KSampler: present
ComfyMathExpression: present
pip check: No broken requirements found.What Is A Blocker And What Is Only A Warning?
| Log line | Blocker? | What to do |
|---|---|---|
ModuleNotFoundError: No module named 'sqlalchemy' before server start | Yes | Install SQLAlchemy in ComfyUI's embedded Python, then restart |
ModuleNotFoundError: No module named 'torch' | Yes | Install Torch, then verify CUDA, not just import success |
comfyui-frontend-package is not installed | Yes | Install the frontend package required by local ComfyUI |
IMPORT FAILED: nodes_math.py | Partial | Server can start, but that node is missing; install simpleeval |
Starting server appears | No | Server has started; continue with endpoint verification |
Found comfy_kitchen backend triton: {'available': False, ...} | Usually no | Ignore unless a workflow actually requires Triton |
/system_stats returns the expected GPU | No | Good sign that runtime is alive |
One Package At A Time Or Requirements All At Once?
Use this decision:
| Situation | Better move |
|---|---|
| You are diagnosing an unknown broken portable environment | One package, restart, read the next log |
| The first error is a custom node missing one package | Install that node's package or requirements |
| Torch imports but CUDA is false | Fix the CUDA Torch wheel first |
| Torch/CUDA is healthy | Avoid broad commands that may replace it |
| You are creating a fresh clean environment | pip install -r ComfyUI\requirements.txt can be normal |
A blind pip install -r ComfyUI\requirements.txt can be acceptable for a clean manual install, but it is not the best forensic repair loop when you need to understand what broke.
What Not To Do
- do not use system
pipwhen ComfyUI usespython_embeded - do not assume a browser page on 8188 belongs to the environment you are repairing
- do not treat CPU Torch import success as CUDA success
- do not paste a long package list when you are trying to learn the next log change
- do not treat every warning after
Starting serveras fatal - do not delete the environment before preserving workflows, models, and custom nodes
How Wonderful Launcher Helps
The hard part of this repair is not memorizing package names. It is the loop:
- start
- capture the first real error
- repair the right Python
- start again
- distinguish blockers from warnings
- verify the app is really alive
Wonderful Launcher is built around that recovery loop. It makes environment boundaries and startup logs easier to reason about, especially when a portable ComfyUI install has been modified by plugins over time.
Related Guides
- ModuleNotFoundError: No module named 'sqlalchemy' in ComfyUI
- comfyui-frontend-package is not installed in ComfyUI
- ModuleNotFoundError: No module named 'torch' in ComfyUI
- ModuleNotFoundError: No module named 'transformers' in ComfyUI
- ModuleNotFoundError: No module named 'kornia' in ComfyUI
- OpenGL dependencies not available in ComfyUI
- ComfyUI Startup Failed
- ComfyUI Dependency Conflicts
- ModuleNotFoundError: No module named 'triton' in ComfyUI
- Torch Not Compiled With CUDA Enabled
Source References
- Windows portable repair lab, May 18, 2026:
E:\ComfyUI_portable\ComfyUI_SEO_Lab - First fatal log:
ModuleNotFoundError: No module named 'sqlalchemy' - Important pitfall: 8188 belonged to another ComfyUI process, so the lab was verified on port 8191
- Final lab launch: ComfyUI
0.20.1, frontend1.43.18, PyTorch2.12.0+cu130, GPUNVIDIA GeForce RTX 4070 Ti SUPER - Final endpoint check:
/object_inforeported 689 nodes andpip checkreturnedNo broken requirements found
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 WindowsDid this fix your issue?
Your answer helps prioritize verified ComfyUI repairs.