diff --git a/modules/launch_utils.py b/modules/launch_utils.py index f749bd0a..a548ca12 100644 --- a/modules/launch_utils.py +++ b/modules/launch_utils.py @@ -91,11 +91,10 @@ def run(command, desc=None, errdesc=None, custom_env=None, live: bool = default_ def _torch_version() -> tuple[str, str]: """Given `2.10.0.dev20251111+cu130` ; Return `("2.10.0", "cu130")`""" - stdout: str = run("pip show torch") - for line in stdout.split("\n"): - if line.startswith("Version"): - m = re.search(r"(\d+\.\d+\.\d+)(?:[^+]+)?\+(.+)", line) - break + import importlib.metadata + + ver = importlib.metadata.version("torch") + m = re.search(r"(\d+\.\d+\.\d+)(?:[^+]+)?\+(.+)", ver) return m.group(1), m.group(2) diff --git a/modules_forge/uv_hook.py b/modules_forge/uv_hook.py index e3698435..1a6b65cf 100644 --- a/modules_forge/uv_hook.py +++ b/modules_forge/uv_hook.py @@ -28,7 +28,7 @@ def patch(symlink: bool): assert isinstance(command, list) - if "pip" not in command or "install" not in command: + if "pip" not in command: return subprocess.__original_run(*_original_args, **_original_kwargs) cmd = command[command.index("pip") + 1 :]