LogoWonderful Launcher
  • Home
  • Pricing
  • Docs
  • Download

Repair ComfyUI Portable Dependencies One Module at a Time

Partially verifiedHigh riskLast verified 2026-07-08

A tested Windows portable ComfyUI repair transcript for missing SQLAlchemy, torch, frontend package, kornia, PyOpenGL, and other startup dependencies.

When a Windows portable ComfyUI environment starts failing with missing core packages, do not begin with a broad reinstall. The safer loop:

  1. start ComfyUI
  2. read the first new blocker in the log
  3. install only that package in python_embeded
  4. start again
  5. repeat until the server, /system_stats, /object_info, and pip check are healthy

Practical rule

Run one install, then restart and read the new log. A copied error 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 it when the environment itself is missing core startup dependencies in sequence:

Current evidenceBetter path
Startup stops before Starting server and each restart exposes a new core missing packageUse this one-package-at-a-time loop
Only one custom node shows IMPORT FAILEDUse Plugin Import Failed first
The workflow has red nodes but ComfyUI starts cleanlyUse Missing Nodes, then verify plugin registration
Torch imports but CUDA is unavailableUse Torch Not Compiled With CUDA Enabled before adding more packages
Nodes are registered but model files are missingUse Where to Put Safetensors or Cannot Find Model File

Verification rule: offline import success, an open browser tab, or a "package installed" message is not enough. The repaired environment must be the process that started ComfyUI, own the expected port, expose /system_stats and /object_info, and pass runtime checks.

A documented repair chain

This is a real one-package-at-a-time sequence from a repaired portable environment (started at ModuleNotFoundError: No module named 'sqlalchemy', recovered on an RTX 4070 Ti SUPER with CUDA PyTorch). Your exact chain will differ.

AttemptFirst new signal in the logOne package actionWhat changed after restart
1ModuleNotFoundError: No module named 'sqlalchemy'pip install "SQLAlchemy>=2.0"exposed filelock
2ModuleNotFoundError: No module named 'filelock'pip install filelockexposed alembic and yaml
3Error importing dependencies: No module named 'alembic'pip install alembicdatabase setup moved forward
4ModuleNotFoundError: No module named 'yaml'pip install PyYAMLexposed PIL
5ModuleNotFoundError: No module named 'PIL'pip install Pillowexposed tqdm
6ModuleNotFoundError: No module named 'tqdm'pip install tqdmexposed comfy_aimdo
7ModuleNotFoundError for an unfamiliar internal-looking moduleCheck the matching local requirement or official ComfyUI package metadata before installing anythingAvoids guessing a package name from an import name
8ModuleNotFoundError: No module named 'torch'Follow ComfyUI Torch Missing to select a matching CUDA wheel in the embedded PythonCUDA is verified before the next repair
9ModuleNotFoundError: No module named 'safetensors'pip install safetensorsexposed packaging
10ModuleNotFoundError: No module named 'packaging'pip install packagingexposed numpy
11ModuleNotFoundError: No module named 'numpy'pip install "numpy>=1.25.0"exposed einops
12ModuleNotFoundError: No module named 'einops'pip install einopsexposed psutil
13ModuleNotFoundError: No module named 'psutil'pip install psutilreached VRAM detection, then exposed torchvision
14ModuleNotFoundError: No module named 'torchvision'installed torchvision from the same CUDA wheel indexexposed torchaudio
15ModuleNotFoundError: No module named 'torchaudio'installed torchaudio from the same CUDA wheel indexexposed scipy
16ModuleNotFoundError: No module named 'scipy'pip install scipyexposed transformers
17ModuleNotFoundError: No module named 'transformers'pip install transformersexposed torchsde
18ModuleNotFoundError: No module named 'torchsde'pip install torchsdeexposed av
19ModuleNotFoundError: No module named 'av'pip install avexposed aiohttp
20ModuleNotFoundError: No module named 'aiohttp'pip install aiohttpexposed requests
21ModuleNotFoundError: No module named 'requests'pip install requestsexposed pydantic
22ModuleNotFoundError: No module named 'pydantic'pip install pydanticexposed comfyui-frontend-package
23comfyui-frontend-package is not installedpip install comfyui-frontend-packageserver started, but some built-in extra nodes failed to import

Once the server was alive, the cleanup pass continued in the same style:

Cleanup signalOne package actionResult
No module named 'kornia' in post-processing/canny/morphology nodespip install kornianode count rose from 657 to 685
No module named 'spandrel' in nodes_upscale_model.pypip install spandrelnode count rose to 687
repeated No module named 'pydantic_settings' while parsing pyproject.tomlpip install pydantic-settingsstartup log shrank to a short warning set
OpenGL dependencies not availablepip install PyOpenGL, restart, then pip install glfwGLSL/OpenGL node imported
No module named 'simpleeval' in nodes_math.pypip install simpleevalno IMPORT FAILED lines remained
comfyui-workflow-templates is not installedpip install comfyui-workflow-templatestemplate warning disappeared
comfyui-embedded-docs package not foundpip install "comfyui-embedded-docs==0.4.4"embedded docs warning disappeared
WARNING: blake3 package not installedpip install blake3blake3 warning disappeared
An unfamiliar ComfyUI-internal package fails to importCheck the local ComfyUI requirements and official release metadata before installingAvoids pulling an unrelated PyPI package by name

The final log still reported the comfy_kitchen Triton backend as 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, and ComfyUI. Confirm 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, switch to the right environment.

Step 1: Capture each attempt

$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 `
  -PassThru

Then read the bottom of the stderr log (Get-Content $err -Tail 200), install only the package named by the first real blocker, and start again with a new log.

Step 2: Do not trust port 8188 until you check ownership

http://127.0.0.1:8188/ can return 200 from another ComfyUI process in a different folder. Check ownership 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,CommandLine

If 8188 is occupied, start the broken environment on a clean port while repairing:

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

Only 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', a default-index install can satisfy the import while giving you a CPU-only build. Select the matching CUDA wheel from the official PyTorch selector and run it through the embedded Python:

.\python_embeded\python.exe -s -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cuXXX

Replace cuXXX with the CUDA wheel tag for your supported PyTorch build. Do not add a third-party package mirror to this primary command. Then verify:

.\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')"

Continue only when this shows a non-None CUDA version and True for CUDA availability.

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. Installing the frontend package unpinned may give a newer frontend than required_frontend_version; it can work, but the safer instruction is to copy the versions your local ComfyUI code pins. The same applies to comfyui-frontend-package, comfyui-workflow-templates, and comfyui-embedded-docs.

Step 5: Verify recovery with more than the browser

Final start on a clean port:

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

Healthy signals include Starting server, a Device: cuda:0 line with your GPU, and the frontend version. Then 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 check

A healthy result reports the expected CUDA/Torch runtime, /object_info node count, present core nodes (CheckpointLoaderSimple, KSampler), and pip check: No broken requirements found.

Blocker or warning?

Log lineBlocker?What to do
ModuleNotFoundError: No module named 'sqlalchemy' before server startYesInstall SQLAlchemy in the embedded Python, then restart
ModuleNotFoundError: No module named 'torch'YesInstall Torch, then verify CUDA, not just import success
comfyui-frontend-package is not installedYesInstall the frontend package required by local ComfyUI
IMPORT FAILED: nodes_math.pyPartialServer can start, but that node is missing; install simpleeval
Starting server appearsNoContinue with endpoint verification
Found comfy_kitchen backend triton: {'available': False, ...}Usually noIgnore unless a workflow requires Triton
/system_stats returns the expected GPUNoGood sign the runtime is alive

One package at a time or requirements all at once?

SituationBetter move
Diagnosing an unknown broken portable environmentOne package, restart, read the next log
The first error is a custom node missing one packageInstall that node's package or requirements
Torch imports but CUDA is falseFix the CUDA Torch wheel first
Torch/CUDA is healthyAvoid broad commands that may replace it
Creating a fresh clean environmentpip 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 pip when ComfyUI uses python_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 server as fatal
  • do not delete the environment before preserving workflows, models, and custom nodes

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
  • ModuleNotFoundError: No module named 'spandrel' in ComfyUI
  • ModuleNotFoundError: No module named 'pydantic_settings' in ComfyUI
  • ModuleNotFoundError: No module named 'simpleeval' 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

  • PyTorch Start Locally installer
  • ComfyUI troubleshooting overview

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

When to use this runbook
A documented repair chain
Step 0: Start from the portable root
Step 1: Capture each attempt
Step 2: Do not trust port 8188 until you check ownership
Step 3: Verify Torch before and after installing it
Step 4: Treat frontend and template packages as ComfyUI versioned packages
Step 5: Verify recovery with more than the browser
Blocker or warning?
One package at a time or requirements all at once?
What not to do
Related Guides
Source References