diff --git a/comfyui_env.toml b/comfyui_env.toml new file mode 100644 index 00000000..6abc53e9 --- /dev/null +++ b/comfyui_env.toml @@ -0,0 +1,15 @@ +# ComfyUI-GeometryPack environment configuration +# Uses comfyui-envmanager for CUDA wheel resolution + +[env] +name = "geometrypack" +cuda = "auto" # Auto-detect from PyTorch + +[packages] +# CUDA packages installed via wheel resolution (no compilation needed) +no_deps = [ + "cumesh==0.0.1", +] + +# Regular pip packages (already handled by install_scripts/python_deps.py) +# requirements = [] diff --git a/install.py b/install.py index 64423659..cf82ad42 100644 --- a/install.py +++ b/install.py @@ -6,18 +6,71 @@ GeometryPack Installer Orchestrates modular install scripts for ComfyUI-GeometryPack. +Uses comfyui-envmanager for CUDA wheel resolution. Blender is optional - run 'python blender_install.py' separately if needed. """ import sys +import subprocess from install_scripts import ( install_system_dependencies, install_python_dependencies, - install_cumesh, ) +def ensure_comfyui_envmanager(): + """Install comfyui-envmanager if not present.""" + try: + import comfyui_envmanager + return True + except ImportError: + print("[GeomPack] Installing comfyui-envmanager...") + try: + subprocess.check_call([ + sys.executable, "-m", "pip", "install", "comfyui-envmanager>=0.0.11" + ]) + return True + except subprocess.CalledProcessError as e: + print(f"[GeomPack] Failed to install comfyui-envmanager: {e}") + return False + + +def install_cuda_packages(): + """Install CUDA packages using comfyui-envmanager.""" + print("\n" + "="*60) + print("ComfyUI-GeometryPack: CUDA Packages (via comfyui-envmanager)") + print("="*60 + "\n") + + if not ensure_comfyui_envmanager(): + print("[GeomPack] Cannot install CUDA packages without comfyui-envmanager") + return False + + try: + from comfyui_envmanager import install, verify_installation + from pathlib import Path + + # Install from comfyui_env.toml in this directory + node_root = Path(__file__).parent.absolute() + print(f"[GeomPack] Installing CUDA packages from {node_root}/comfyui_env.toml") + + install(config=node_root / "comfyui_env.toml") + + # Verify cumesh is importable + try: + import cumesh + print("[GeomPack] CuMesh installed and verified!") + return True + except ImportError: + print("[GeomPack] CuMesh installation completed but import failed") + return False + + except Exception as e: + print(f"[GeomPack] CUDA package installation failed: {e}") + print("[GeomPack] CuMesh will not be available, but other features will work.") + return False + + def main(): """Entry point.""" print("\n" + "="*60) @@ -26,7 +79,7 @@ def main(): print("This installer will set up:") print(" 1. System dependencies (OpenGL libraries on Linux)") print(" 2. Python dependencies (trimesh, pymeshlab, etc.)") - print(" 3. CuMesh (optional, GPU-accelerated mesh processing)") + print(" 3. CUDA packages via comfyui-envmanager (cumesh)") print("") print("Note: Blender is optional. If you need Blender nodes") print("(UV Unwrap, Remesh, etc.), run: python blender_install.py") @@ -35,13 +88,13 @@ def main(): results = { 'system_deps': False, 'python_deps': False, - 'cumesh': False, + 'cuda_packages': False, } # Install in order results['system_deps'] = install_system_dependencies() results['python_deps'] = install_python_dependencies() - results['cumesh'] = install_cumesh() + results['cuda_packages'] = install_cuda_packages() # Print summary print("\n" + "="*60) @@ -49,7 +102,7 @@ def main(): print("="*60) print(f" System Dependencies: {'+ Success' if results['system_deps'] else 'x Failed'}") print(f" Python Dependencies: {'+ Success' if results['python_deps'] else 'x Failed'}") - print(f" CuMesh (GPU): {'+ Success' if results['cumesh'] else '~ Skipped'}") + print(f" CUDA Packages: {'+ Success' if results['cuda_packages'] else '~ Skipped'}") print("="*60 + "\n") if results['python_deps']: diff --git a/install_scripts/cumesh.py b/install_scripts/cumesh.py index e37b36d3..9743fe0f 100644 --- a/install_scripts/cumesh.py +++ b/install_scripts/cumesh.py @@ -55,17 +55,20 @@ def _verify_cumesh_import(): def _install_wheel(cuda_version, torch_version, python_version): """Try to install cumesh from pre-built wheel.""" # Format versions for wheel URL - # CUDA: "12.8" -> "128", Torch: "2.8.0" -> "280" + # CUDA: "12.8" -> "128", Torch: "2.8.0+cu128" -> "280", "28" (major.minor) cuda_short = cuda_version.replace(".", "")[:3] if cuda_version else None - torch_short = torch_version.split("+")[0].replace(".", "")[:3] if torch_version else None + torch_clean = torch_version.split("+")[0] if torch_version else None + torch_short = torch_clean.replace(".", "")[:3] if torch_clean else None + torch_mm = "".join(torch_clean.split(".")[:2]) if torch_clean else None # "2.8.0" -> "28" if not cuda_short or not torch_short: print("[CuMesh] Cannot determine CUDA/PyTorch versions for wheel selection") return False - # Construct wheel URL + # Construct wheel URL - filename includes build tag like +cu128torch28 wheel_tag = f"cu{cuda_short}-torch{torch_short}" - wheel_name = f"cumesh-0.0.1-cp{python_version}-cp{python_version}-linux_x86_64.whl" + build_tag = f"cu{cuda_short}torch{torch_mm}" # cu128torch28 + wheel_name = f"cumesh-0.0.1%2B{build_tag}-cp{python_version}-cp{python_version}-linux_x86_64.whl" wheel_url = f"{WHEEL_REPO_BASE}/{wheel_tag}/{wheel_name}" print(f"[CuMesh] Trying wheel: {wheel_tag}/{wheel_name}")