fix: Fix for the issue of pip version not upgrading

https://github.com/ltdrdata/ComfyUI-Manager/issues/772
This commit is contained in:
Dr.Lt.Data 2024-06-18 21:08:03 +09:00
parent 974d7a158c
commit e4ba360f34

View File

@ -429,7 +429,20 @@ def is_installed(name):
print(f"[ComfyUI-Manager] skip black listed pip installation: '{name}'") print(f"[ComfyUI-Manager] skip black listed pip installation: '{name}'")
return True return True
return name.lower() in get_installed_packages() pkg = get_installed_packages().get(name.lower())
if pkg is None:
return False # update if not installed
if match is None:
return True # don't update if version is not specified
if match.group(2) in ['>', '>=']:
if StrictVersion(pkg) < StrictVersion(match.group(3)):
return False
elif StrictVersion(pkg) > StrictVersion(match.group(3)):
print(f"[SKIP] Downgrading pip package isn't allowed: {name.lower()} (cur={pkg})")
return True # prevent downgrade
if os.path.exists(restore_snapshot_path): if os.path.exists(restore_snapshot_path):