Improve pip module verification

pull/2068/head
bmaltais 2024-03-11 20:29:16 -04:00
parent 3be05253bb
commit 3595f3711c
4 changed files with 10 additions and 4 deletions

View File

@ -435,6 +435,13 @@ def installed(package, friendly: str = None):
try:
if friendly:
pkgs = friendly.split()
# Exclude command-line options and URLs like "--index-url https://download.pytorch.org/whl/cu118"
pkgs = [
p
for p in package.split()
if not p.startswith('--') and "://" not in p # Exclude command-line options and URLs
]
else:
pkgs = [
p
@ -503,7 +510,6 @@ def install(
pip(f'install --upgrade {package}', ignore=ignore, show_stdout=show_stdout)
def process_requirements_line(line, show_stdout: bool = False):
# Remove brackets and their contents from the line using regular expressions
# e.g., diffusers[torch]==0.10.2 becomes diffusers==0.10.2

View File

@ -18,7 +18,7 @@ def main_menu(platform_requirements_file, show_stdout: bool = False, no_run_acce
setup_common.check_python()
# Upgrade pip if needed
setup_common.install('--upgrade pip')
setup_common.install('pip')
setup_common.install_requirements(platform_requirements_file, check_no_verify_flag=False, show_stdout=show_stdout)
if not no_run_accelerate:
setup_common.configure_accelerate(run_accelerate=False)

View File

@ -53,7 +53,7 @@ def main_menu(platform_requirements_file):
setup_common.check_python()
# Upgrade pip if needed
setup_common.install('--upgrade pip')
setup_common.install('pip')
setup_common.install_requirements(platform_requirements_file, check_no_verify_flag=False, show_stdout=True)
configure_accelerate()

View File

@ -112,7 +112,7 @@ def install_kohya_ss_torch2():
setup_common.update_submodule()
# Upgrade pip if needed
setup_common.install("--upgrade pip")
setup_common.install("pip")
setup_common.install_requirements(
"requirements_windows_torch2.txt", check_no_verify_flag=False