You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Comfy self-start: embed Python at env root not detected; falls back to system python
#1546
Today I wanted to give SwarmUI a try because it is often recommended and easier to handle than plain ComfyUI. I tried to add a new self-start backend using comfyui-rocm.
I run Swarm on AMD with two Comfy self-start backends: the normal dlbackend/comfy/ install and a second one pointed at comfyui-rocm under dlbackend/comfy-2/. I'm not asking anyone to bundle that repo — I just want the second backend to use that tree's Python (newer ROCm/torch than Comfy's portable bundle). StartScript is configurable, but as far as I can tell there's no real way to attach your own env unless it happens to match one of two hardcoded layouts.
What I see: backend enabled, StartScript = dlbackend/comfy-2/main.py (flat main.py). Swarm doesn't pick up the embed next to the install from comfyui-rocm's own installer (python_env). It launches bare python from PATH — in my case Windows Store Python 3.14 — and Comfy dies with wrong torch (Torch not compiled with CUDA enabled, Manager complaining PyTorch isn't installed). Logs showed the interpreter under AppData\Local\Python\pythoncore-3.14-64\..., not dlbackend\comfy-2\python_env\.... Pip/lib stuff during init also didn't match the process that actually ran main.py.
I read NetworkBackendUtils.ConfigurePythonExeFor on Windows. It only checks {main.py folder}/venv/Scripts/python.exe, then {parent}/python_embeded/python.exe (official portable: comfy/ComfyUI/main.py + comfy/python_embeded/python.exe). Otherwise it uses python from PATH. Official portable doesn't use Scripts/python.exe either — embed exe is at the env root; the bat does python_embeded\python.exe -s ComfyUI\main.py. comfyui-rocm is the same embed idea with python_env/python.exe at the env root and a flat layout (main.py at repo root). Renaming/junctioning venv → python_env didn't help because Swarm never looks for {env}/python.exe, only those two patterns. I don't want Swarm to hardcode python_env and every other fork name — that's the same problem with extra steps.
What got me working (fragile): mirror portable (ComfyUI/ subfolder, python_embeded → python_env), then fix the install's python312._pth so it has ../ComfyUI like official portable — otherwise No module named 'comfy' after nesting. Works, but I wouldn't wish it on anyone.
What I'd like to see: the default behaviour for your shipped install; discovery from StartScript (venv + embed-with-exe-at-root, not a growing list of folder names); optional explicit python path override (1277-style) for edge cases; no silent fallback to system python — fail with a clear message. If policy is really "self-start only for Swarm-installed layouts," say that in docs.
I didn't open a PR because 1277 was closed fast and I'd rather hear if this direction is acceptable first.
(Wording edited for clarity; paths and logs are from my Windows/AMD setup.)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Today I wanted to give SwarmUI a try because it is often recommended and easier to handle than plain ComfyUI. I tried to add a new self-start backend using comfyui-rocm.
I run Swarm on AMD with two Comfy self-start backends: the normal
dlbackend/comfy/install and a second one pointed at comfyui-rocm underdlbackend/comfy-2/. I'm not asking anyone to bundle that repo — I just want the second backend to use that tree's Python (newer ROCm/torch than Comfy's portable bundle).StartScriptis configurable, but as far as I can tell there's no real way to attach your own env unless it happens to match one of two hardcoded layouts.What I see: backend enabled,
StartScript=dlbackend/comfy-2/main.py(flatmain.py). Swarm doesn't pick up the embed next to the install from comfyui-rocm's own installer (python_env). It launches barepythonfrom PATH — in my case Windows Store Python 3.14 — and Comfy dies with wrong torch (Torch not compiled with CUDA enabled, Manager complaining PyTorch isn't installed). Logs showed the interpreter underAppData\Local\Python\pythoncore-3.14-64\..., notdlbackend\comfy-2\python_env\.... Pip/lib stuff during init also didn't match the process that actually ranmain.py.I read
NetworkBackendUtils.ConfigurePythonExeForon Windows. It only checks{main.py folder}/venv/Scripts/python.exe, then{parent}/python_embeded/python.exe(official portable:comfy/ComfyUI/main.py+comfy/python_embeded/python.exe). Otherwise it usespythonfrom PATH. Official portable doesn't useScripts/python.exeeither — embed exe is at the env root; the bat doespython_embeded\python.exe -s ComfyUI\main.py. comfyui-rocm is the same embed idea withpython_env/python.exeat the env root and a flat layout (main.pyat repo root). Renaming/junctioningvenv→python_envdidn't help because Swarm never looks for{env}/python.exe, only those two patterns. I don't want Swarm to hardcodepython_envand every other fork name — that's the same problem with extra steps.What got me working (fragile): mirror portable (
ComfyUI/subfolder,python_embeded→python_env), then fix the install'spython312._pthso it has../ComfyUIlike official portable — otherwiseNo module named 'comfy'after nesting. Works, but I wouldn't wish it on anyone.What I'd like to see: the default behaviour for your shipped install; discovery from
StartScript(venv + embed-with-exe-at-root, not a growing list of folder names); optional explicit python path override (1277-style) for edge cases; no silent fallback to system python — fail with a clear message. If policy is really "self-start only for Swarm-installed layouts," say that in docs.I didn't open a PR because 1277 was closed fast and I'd rather hear if this direction is acceptable first.
(Wording edited for clarity; paths and logs are from my Windows/AMD setup.)
All reactions