From 76759a185362c1dcaed4fc90303d4cfbaa2d1f02 Mon Sep 17 00:00:00 2001 From: WhizZest <130823924+WhizZest@users.noreply.github.com> Date: Sat, 28 Feb 2026 08:52:10 +0800 Subject: [PATCH] Fix CLIP installation failures(issue#17201, #17284, #17287, Discussion #17283,#17275) (#17293) --- modules/launch_utils.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/launch_utils.py b/modules/launch_utils.py index cc97a67b0..e1afeb3ec 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -422,8 +422,24 @@ def prepare_environment(): ) startup_timer.record("torch GPU test") + # Ensure build dependencies are installed before any package that might need them + def ensure_build_dependencies(): + """Ensure essential build tools are available""" + if not is_installed("wheel"): + run_pip("install wheel", "wheel") + # Check setuptools version compatibility + try: + setuptools_version = run(f'"{python}" -c "import setuptools; print(setuptools.__version__)"', None, None).strip() + if setuptools_version >= "70": + run_pip("install 'setuptools<70'", "setuptools") + except Exception: + # If setuptools check fails, install compatible version + run_pip("install 'setuptools<70'", "setuptools") + # Install build dependencies early + ensure_build_dependencies() + if not is_installed("clip"): - run_pip(f"install {clip_package}", "clip") + run_pip(f"install --no-build-isolation {clip_package}", "clip") startup_timer.record("install clip") if not is_installed("open_clip"):