diff --git a/modules/launch_utils.py b/modules/launch_utils.py index 4fc526a5..6bdeed63 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -336,9 +336,21 @@ def requirements_met(requirements_file): with open(requirements_file, "r", encoding="utf8") as file: for line in file: - if line.strip() == "": + line = line.strip() + if line == "": continue + # Handle git+https URLs (e.g., git+https://github.com/huggingface/diffusers) + # Extract package name from URL and check if already installed + if line.startswith("git+"): + # Extract package name from URL (last part of path, without .git) + url_path = line.split("/")[-1] + package_name = url_path.replace(".git", "") + if is_installed(package_name): + continue + else: + return False + m = re.match(re_requirement, line) if m is None: return False @@ -447,6 +459,19 @@ def prepare_environment(): run_pip(f"install {openclip_package}", "open_clip") startup_timer.record("install open_clip") + # Check if diffusers is installed with version >= 0.36.0.dev0 + diffusers_installed = False + try: + import packaging.version + diffusers_version = importlib.metadata.version("diffusers") + if packaging.version.parse(diffusers_version) >= packaging.version.parse("0.36.0.dev0"): + diffusers_installed = True + except Exception: + pass + if not diffusers_installed: + run_pip("install git+https://github.com/huggingface/diffusers", "diffusers") + startup_timer.record("install diffusers") + if (not is_installed("xformers") or args.reinstall_xformers) and args.xformers: run_pip(f"install -U -I --no-deps {xformers_package}", "xformers") startup_timer.record("install xformers") diff --git a/requirements_versions.txt b/requirements_versions.txt index 20d4593e..e17ef00d 100644 --- a/requirements_versions.txt +++ b/requirements_versions.txt @@ -1,4 +1,3 @@ -git+https://github.com/huggingface/diffusers setuptools==69.5.1 # temp fix for compatibility with some old packages GitPython==3.1.32 Pillow==9.5.0