Skip to content

Conversation

@Interpause
Copy link

Fixes #263, #272.

As comfy-cli might be installed globally via pipx or uv, as per linked issue, it ends up installing the comfyui dependencies into the managed environment. Especially since comfy-cli can manage several comfyui installs, it should install into environments per each install. Hence the below logic:

  1. If .venv/venv is present in comfyui folder, use that.
  2. If a Conda environment is currently active, use that.
  3. Create .venv using the currently active Python in --copies mode to prevent broken symlinks if user were to later delete that Python version.

I have thus far tested only on Linux, but I assume it should work for MacOS and Windows too. That said, I only tested if comfy install and comfy launch work as expected.

I tried to selectively change sys.executable to use the venv where appropriate. However, as I am new to this codebase, I might have missed out some places or changed some places I should not, so I need help to check that. The riskiest part, comfy standalone seems to be broken for me before I made my changes, so I can't tell if I may have broke that.

Also, while this approach works perfectly fine for venvs, it is limited for Conda environments. Since it doesn't properly activate Conda, tools installed in the Conda environment like nvcc aren't available as expected. I think this can be solved as a separate issue.

should also fix Comfy-Org#263
tried to ensure python was only replaced where relevant, so no edits to uv.py or standalone.py, or the huggingface downloader
@Interpause Interpause marked this pull request as ready for review November 10, 2025 16:56
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Nov 10, 2025
@Interpause
Copy link
Author

Fixed the merge conflicts; Haven't tested if the PR still works on any of Linux, Mac or Windows though cause its been a while since I last used comfyui. Change from draft to open to hopefully increase visibility. Am open to fixing any new bugs since June.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dependencies Installed in Wrong Environment When comfy-cli is Installed with Python Application Managers

1 participant