diff --git a/comfy_cli/command/custom_nodes/command.py b/comfy_cli/command/custom_nodes/command.py index 50b4ef62..5972aa25 100644 --- a/comfy_cli/command/custom_nodes/command.py +++ b/comfy_cli/command/custom_nodes/command.py @@ -491,13 +491,7 @@ def update_node_id_cache(): new_env = os.environ.copy() new_env["COMFYUI_PATH"] = workspace_path - res = subprocess.run(cmd, env=new_env, check=True) - if res.returncode != 0: - typer.echo( - "Failed to update node id cache.", - err=True, - ) - raise typer.Exit(code=1) + subprocess.run(cmd, env=new_env, check=True) # `update, disable, enable, fix` allows `all` param diff --git a/comfy_cli/command/install.py b/comfy_cli/command/install.py index b80cba2b..88923938 100644 --- a/comfy_cli/command/install.py +++ b/comfy_cli/command/install.py @@ -244,7 +244,10 @@ def execute( depComp.install_deps() if not skip_manager: - update_node_id_cache() + try: + update_node_id_cache() + except subprocess.CalledProcessError as e: + rprint(f"Failed to update node id cache: {e}") os.chdir(repo_dir) diff --git a/comfy_cli/uv.py b/comfy_cli/uv.py index 8bfcd85b..2a89b3e4 100644 --- a/comfy_cli/uv.py +++ b/comfy_cli/uv.py @@ -7,9 +7,8 @@ from typing import Any, Optional, Union, cast from comfy_cli import ui -from comfy_cli.constants import GPU_OPTION, OS +from comfy_cli.constants import GPU_OPTION from comfy_cli.typing import PathLike -from comfy_cli.utils import get_os def _run(cmd: list[str], cwd: PathLike, check: bool = True) -> subprocess.CompletedProcess[Any]: @@ -79,21 +78,28 @@ class DependencyCompiler: """ ).strip() - reqNames = { + reqNames = ( "requirements.txt", "pyproject.toml", "setup.cfg", "setup.py", - } + ) @staticmethod def Find_Req_Files(*ders: PathLike) -> list[Path]: - return [ - file # fmt: skip - for der in ders - for file in Path(der).absolute().iterdir() - if file.name in DependencyCompiler.reqNames - ] + reqFiles = [] + for der in ders: + reqFound = False + for reqName in DependencyCompiler.reqNames: + for file in Path(der).absolute().iterdir(): + if file.name == reqName: + reqFiles.append(file) + reqFound = True + break + if reqFound: + break + + return reqFiles @staticmethod def Install_Build_Deps(executable: PathLike = sys.executable): @@ -184,7 +190,7 @@ def Install( override: Optional[PathLike] = None, reqs: Optional[list[str]] = None, reqFile: Optional[list[PathLike]] = None, - ) -> subprocess.CompletedProcess[Any]: + ) -> None: cmd = [ str(executable), "-m", @@ -232,7 +238,7 @@ def Sync( executable: PathLike = sys.executable, extraUrl: Optional[str] = None, index_strategy: str = "unsafe-best-match", - ) -> subprocess.CompletedProcess[Any]: + ) -> None: cmd = [ str(executable), "-m", @@ -262,7 +268,7 @@ def Download( out: Optional[PathLike] = None, reqs: Optional[list[str]] = None, reqFile: Optional[list[PathLike]] = None, - ) -> subprocess.CompletedProcess[Any]: + ) -> None: """For now, the `download` cmd has no uv support, so use pip""" cmd = [ str(executable), @@ -298,7 +304,7 @@ def Wheel( out: Optional[PathLike] = None, reqs: Optional[list[str]] = None, reqFile: Optional[list[PathLike]] = None, - ) -> subprocess.CompletedProcess[Any]: + ) -> None: """For now, the `wheel` cmd has no uv support, so use pip""" cmd = [ str(executable), @@ -399,8 +405,6 @@ def make_override(self): f.write(DependencyCompiler.overrideGpu.format(gpu=self.gpu, gpuUrl=self.gpuUrl)) f.write("\n\n") - # TODO: remove numpy<2 override once torch is compatible with numpy>=2 - if get_os() == OS.WINDOWS: f.write("numpy<2\n") f.write("\n\n") @@ -480,20 +484,20 @@ def compile_deps(self): def install_deps(self): DependencyCompiler.Install( cwd=self.cwd, - reqFile=[self.out], executable=self.executable, extra_index_url=self.gpuUrl, override=self.override, + reqFile=[self.out], ) def install_dists(self): DependencyCompiler.Install( cwd=self.cwd, - reqFile=[self.out], executable=self.executable, find_links=[self.outDir / "dists"], no_deps=True, no_index=True, + reqFile=[self.out], ) def install_wheels(self):