From dda94d0f2dc957f5df408406d8d68ac0b870d057 Mon Sep 17 00:00:00 2001 From: huchukato Date: Fri, 25 Sep 2026 10:36:15 +0200 Subject: [PATCH] Read env vars via os.getenv instead of os.environ --- __init__.py | 16 ++++++++-------- install.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/__init__.py b/__init__.py index 9e3744d..9f90f8e 100644 --- a/__init__.py +++ b/__init__.py @@ -21,7 +21,7 @@ def detect_cloud_environment(): # Check environment variables for indicator in cloud_indicators: - if indicator in os.environ: + if os.getenv(indicator) is not None: print(f"🌩️ Detected cloud environment: {indicator}") # Check CUDA version - only disable CUDA graph for CUDA 12 @@ -86,7 +86,7 @@ def _auto_install_tensorrt(): This function installs only the TensorRT packages via pip. A marker file prevents repeated install attempts on every ComfyUI startup. """ - disable_auto_install = os.environ.get("DISABLE_TENSORRT_AUTO_INSTALL", "false").lower() == "true" + disable_auto_install = os.getenv("DISABLE_TENSORRT_AUTO_INSTALL", "false").lower() == "true" if disable_auto_install: print("[ComfyUI-RIFE-TensorRT] Auto-installation disabled via DISABLE_TENSORRT_AUTO_INSTALL") return True @@ -153,8 +153,8 @@ def _auto_install_tensorrt(): pass # Try CUDA_PATH - if not cuda_version and os.environ.get("CUDA_PATH"): - nvcc_path = os.path.join(os.environ["CUDA_PATH"], "bin", "nvcc") + if not cuda_version and os.getenv("CUDA_PATH"): + nvcc_path = os.path.join(os.getenv("CUDA_PATH"), "bin", "nvcc") if os.path.exists(nvcc_path): try: stdout = subprocess.check_output([nvcc_path, "--version"], text=True) @@ -166,8 +166,8 @@ def _auto_install_tensorrt(): pass # Try CUDA_HOME - if not cuda_version and os.environ.get("CUDA_HOME"): - nvcc_path = os.path.join(os.environ["CUDA_HOME"], "bin", "nvcc") + if not cuda_version and os.getenv("CUDA_HOME"): + nvcc_path = os.path.join(os.getenv("CUDA_HOME"), "bin", "nvcc") if os.path.exists(nvcc_path): try: stdout = subprocess.check_output([nvcc_path, "--version"], text=True) @@ -250,11 +250,11 @@ def _setup_cuda_dll_path(): cuda_root = None # Check for CUDA_PATH or CUDA_HOME environment variables - cuda_root = os.environ.get("CUDA_PATH") or os.environ.get("CUDA_HOME") + cuda_root = os.getenv("CUDA_PATH") or os.getenv("CUDA_HOME") if not cuda_root: # Try default Windows install location - program_files = os.environ.get("PROGRAMFILES") + program_files = os.getenv("PROGRAMFILES") if program_files: cuda_base = Path(program_files) / "NVIDIA GPU Computing Toolkit" / "CUDA" if cuda_base.exists(): diff --git a/install.py b/install.py index c812c38..eb30f78 100755 --- a/install.py +++ b/install.py @@ -38,7 +38,7 @@ def detect_cuda_version(): return version # Try CUDA_PATH - cuda_path = os.environ.get("CUDA_PATH") + cuda_path = os.getenv("CUDA_PATH") if cuda_path: nvcc_path = os.path.join(cuda_path, "bin", "nvcc") if os.path.exists(nvcc_path): @@ -51,7 +51,7 @@ def detect_cuda_version(): return version # Try CUDA_HOME - cuda_home = os.environ.get("CUDA_HOME") + cuda_home = os.getenv("CUDA_HOME") if cuda_home: nvcc_path = os.path.join(cuda_home, "bin", "nvcc") if os.path.exists(nvcc_path):