Skip to content

Commit

Permalink
Merge pull request AUTOMATIC1111#14192 from illtellyoulater/patch-1
Browse files Browse the repository at this point in the history
Update launch_utils.py - fixes repetead package reinstalls
  • Loading branch information
AUTOMATIC1111 authored Dec 4, 2023
2 parents 334298d + 06725af commit 208760f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions modules/launch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import shutil
import sys
import importlib.util
import importlib.metadata
import platform
import json
from functools import lru_cache
Expand Down Expand Up @@ -119,11 +120,16 @@ def run(command, desc=None, errdesc=None, custom_env=None, live: bool = default_

def is_installed(package):
try:
spec = importlib.util.find_spec(package)
except ModuleNotFoundError:
return False
dist = importlib.metadata.distribution(package)
except importlib.metadata.PackageNotFoundError:
try:
spec = importlib.util.find_spec(package)
except ModuleNotFoundError:
return False

return spec is not None

return spec is not None
return dist is not None


def repo_dir(name):
Expand Down

0 comments on commit 208760f

Please sign in to comment.