Skip to content

Commit

Permalink
fix: 🚀 try to support remote install too
Browse files Browse the repository at this point in the history
  • Loading branch information
melMass committed Jul 22, 2023
1 parent ee17d57 commit 02c9249
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
36 changes: 25 additions & 11 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


here = Path(__file__).parent
wheels_directory = here / "wheels"
executable = sys.executable

# - detect mode
Expand Down Expand Up @@ -184,8 +183,8 @@ def download_file(url, file_name):
progress_bar.update(len(chunk))


def get_requirements(path):
with open(path, "r") as requirements_file:
def get_requirements(path: Path):
with open(path.resolve(), "r") as requirements_file:
requirements_txt = requirements_file.read()

try:
Expand Down Expand Up @@ -218,6 +217,7 @@ def import_or_install(requirement, dry=False):
color="green",
)
except ImportError:
print_formatted(f"Installing package {pip_name}...", "italic", color="yellow")
if dry:
print_formatted(
f"Dry-run: Package {pip_name} would be installed (import name: '{import_name}').",
Expand Down Expand Up @@ -262,9 +262,20 @@ def install_dependencies(dry=False):


if __name__ == "__main__":
full = False
if is_pipe():
print("Pipe detected, full install...")
sys.exit()
print_formatted("Pipe detected, full install...", color="green")
# we clone our repo
url = "https://github.com/melmass/comfy_mtb.git"
clone_dir = here / "custom_nodes" / "comfy_mtb"
if not clone_dir.exists():
clone_dir.parent.mkdir(parents=True, exist_ok=True)
print_formatted(f"Cloning {url} to {clone_dir}", "italic", color="yellow")
subprocess.check_call(["git", "clone", "--recursive", url, clone_dir])

# os.chdir(clone_dir)
here = clone_dir
full = True

# Parse command-line arguments
parser = argparse.ArgumentParser()
Expand All @@ -280,19 +291,21 @@ def install_dependencies(dry=False):
help="Print what will happen without doing it (still making requests to the GH Api)",
)

parser.add_argument(
"--version",
default=get_local_version(),
help="Version to check against the GitHub API",
)
# parser.add_argument(
# "--version",
# default=get_local_version(),
# help="Version to check against the GitHub API",
# )

args = parser.parse_args()
wheels_directory = here / "wheels"
print(f"Detected environment: {apply_color(mode,'cyan')}")

# Install dependencies from requirements.txt
# if args.requirements or mode == "venv":
install_dependencies(dry=args.dry)

if not args.wheels and mode not in ["colab", "embeded"]:
if (not args.wheels and mode not in ["colab", "embeded"]) or not full:
print_formatted(
"Skipping wheel installation. Use --wheels to install wheel dependencies. (only needed for Comfy embed)",
"italic",
Expand All @@ -304,6 +317,7 @@ def install_dependencies(dry=False):
print(
f"Downloading and installing release wheels since we are in a Comfy {apply_color(mode,'cyan')} environment",
)

# Fetch the JSON data from the GitHub API URL
owner = "melmass"
repo = "comfy_mtb"
Expand Down
4 changes: 3 additions & 1 deletion requirements-wheels.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
insightface==0.7.3
mmcv==2.0.0
mmdet==3.0.0
mmdet==3.0.0
facexlib==0.3.0
basicsr==1.4.2
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ imageio===2.28.1
qrcode[pil]
numpy==1.23.5
rembg==2.0.37
facexlib==0.3.0
basicsr==1.4.2
# on windows non WSL 2.10 is the last version with GPU support
tensorflow<2.11.0; platform_system == "Windows"
tb-nightly==2.12.0a20230126; platform_system == "Windows"
Expand Down

0 comments on commit 02c9249

Please sign in to comment.