comfy-env

raw JSON →
0.3.47 verified Fri May 01 auth: no python

Environment management for ComfyUI custom nodes - CUDA wheel resolution and process isolation. Current version 0.3.47, released irregularly.

pip install comfy-env
error ModuleNotFoundError: No module named 'comfy_env'
cause Package not installed or installed in wrong environment.
fix
Run 'pip install comfy-env' in the correct Python environment.
error ImportError: cannot import name 'EnvManager' from 'comfy_env'
cause Using an outdated import path after v0.3.0 rename.
fix
Use 'from comfy_env import ComfyEnvManager'.
error RuntimeError: CUDA not available. Please install torch with CUDA support.
cause torch not installed or installed without CUDA support.
fix
Install torch with CUDA: 'pip install torch --index-url https://download.pytorch.org/whl/cu118' (adjust version).
breaking In v0.3.0, the main class was renamed from EnvManager to ComfyEnvManager. Old imports will break.
fix Use 'from comfy_env import ComfyEnvManager' instead of 'from comfy_env import EnvManager'.
breaking In v0.2.0, the isolation function was renamed from process_isolation to isolation_context.
fix Use 'from comfy_env import isolation_context' instead of 'from comfy_env import process_isolation'.
gotcha The CUDA wheel resolution requires torch to be installed in the environment; otherwise it will raise an error.
fix Ensure torch is installed before calling resolve_cuda_wheel().

Basic usage: resolve CUDA wheel and use process isolation.

from comfy_env import ComfyEnvManager, isolation_context

# Resolve CUDA wheel for current environment
manager = ComfyEnvManager()
wheel_path = manager.resolve_cuda_wheel()
print(f"Resolved wheel: {wheel_path}")

# Run code in isolated subprocess
with isolation_context():
    # Your isolated code here
    pass