Skip to content

Globally installed comfy-cli does not respect activated venv #272

@zdaar

Description

@zdaar

Describe the bug
I installed comfy-cli globally (outside any venv) and activated a local conda venv

conda activate .\venv\

comfy cli does not work when called.

examples :

comfy node save-snapshot
Execute from: D:\AI\ComfyUI

Execution error: ['C:\\AI\\python.exe',
'D:\\AI\\ComfyUI\\custom_nodes\\ComfyUI-Manager\\cm-cli.py', 'save-snapshot']
python D:\AI\ComfyUI\custom_nodes\ComfyUI-Manager\cm-cli.py save-snapshot

WARN: The `COMFYUI_PATH` environment variable is not set. Assuming `custom_nodes/ComfyUI-Manager/../../` as the ComfyUI
path.
[ComfyUI-Manager] The ComfyRegistry cache update is still in progress, so an outdated cache is being used.
FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json [DONE]
Current snapshot is saved as `2025-05-17_13-05-33_snapshot.json`
comfy launch

Launching ComfyUI from: D:\AI\ComfyUI

Adding extra search path checkpoints stuff here

Failed to execute startup-script: D:\AI\ComfyUI\custom_nodes\ComfyUI-Manager\prestartup_script.py / No module named 'huggingface_hub'

Prestartup times for custom nodes:
   0.0 seconds: D:\AI\ComfyUI\custom_nodes\rgthree-comfy
   0.0 seconds: D:\AI\ComfyUI\custom_nodes\comfyui-easy-use
   1.4 seconds (PRESTARTUP FAILED): D:\AI\ComfyUI\custom_nodes\ComfyUI-Manager

Traceback (most recent call last):
  File "D:\AI\ComfyUI\main.py", line 128, in <module>
    import comfy.utils
  File "D:\AI\ComfyUI\comfy\utils.py", line 20, in <module>
    import torch
ModuleNotFoundError: No module named 'torch'

To Reproduce
Create a local conda env

conda create -p ./venv python=3.11

Install comfy-cli globally (outside the env)

pip install comfy-cli

Activate the local conda env

conda activate ./venv

Run any comfy-cli command that wraps internal scripts:

comfy node save-snapshot

It fails silently or errors out.
The subprocess is spawned with the global Python (not the active conda env), so we get dependencies failure
Running the same commands directly through python inside the env works as expected:

python custom_nodes/ComfyUI-Manager/cm-cli.py save-snapshot

Expected behavior
The comfy CLI does not detect or honor the active conda environment, it should

Additional context
Should have been fixed in #75 but its not for me

Installing it inside the conda venv works straight out of the box

pip uninstall comfy-cli
...
Successfully uninstalled comfy-cli-1.3.9

conda activate .\venv\

pip install comfy-cli
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting comfy-cli
  Downloading comfy_cli-1.3.9-py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: charset-normalizer>=3.0.0 in e:\ai\_comfyui\311\comfyui\venv\lib\site-packages (from comfy-cli) (3.4.1)
...

comfy node save-snapshot
Execute from: D:\AI\ComfyUI
[ComfyUI-Manager] The ComfyRegistry cache update is still in progress, so an outdated cache is being used.
FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json [DONE]
Current snapshot is saved as `2025-05-17_13-19-08_snapshot.json

I am using Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions