Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continue on update node cache error when installing ComfyUI-Manager #208

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions comfy_cli/command/custom_nodes/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion comfy_cli/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
40 changes: 22 additions & 18 deletions comfy_cli/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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):
Expand Down
Loading