From 77bf3525f894e89e8f3d812319e822e44419f5ea Mon Sep 17 00:00:00 2001 From: Cassy-Lee <104408348+Cassy-Lee@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:31:39 +0800 Subject: Update launch.py Allow change set --index-url for pip. --- launch.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index a7c5807b..b753efc1 100644 --- a/launch.py +++ b/launch.py @@ -89,6 +89,7 @@ def prepare_enviroment(): torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") commandline_args = os.environ.get('COMMANDLINE_ARGS', "") + index_url = os.environ.get('INDEX_URL',"") gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379") clip_package = os.environ.get('CLIP_PACKAGE', "git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1") @@ -121,22 +122,22 @@ def prepare_enviroment(): run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'") if not is_installed("gfpgan"): - run_pip(f"install {gfpgan_package}", "gfpgan") + run_pip(f"install {gfpgan_package}{f' --index-url {index_url}' if index_url!='' else ''}", "gfpgan") if not is_installed("clip"): - run_pip(f"install {clip_package}", "clip") + run_pip(f"install {clip_package}{f' --index-url {index_url}' if index_url!='' else ''}", "clip") if not is_installed("xformers") and xformers and platform.python_version().startswith("3.10"): if platform.system() == "Windows": run_pip("install https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/c/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl", "xformers") elif platform.system() == "Linux": - run_pip("install xformers", "xformers") + run_pip("install xformers{f' --index-url {index_url}' if index_url!='' else ''}", "xformers") if not is_installed("deepdanbooru") and deepdanbooru: run_pip("install git+https://github.com/KichangKim/DeepDanbooru.git@edf73df4cdaeea2cf00e9ac08bd8a9026b7a7b26#egg=deepdanbooru[tensorflow] tensorflow==2.10.0 tensorflow-io==0.27.0", "deepdanbooru") if not is_installed("pyngrok") and ngrok: - run_pip("install pyngrok", "ngrok") + run_pip("install pyngrok{f' --index-url {index_url}' if index_url!='' else ''}", "ngrok") os.makedirs(dir_repos, exist_ok=True) @@ -147,9 +148,9 @@ def prepare_enviroment(): git_clone("https://github.com/salesforce/BLIP.git", repo_dir('BLIP'), "BLIP", blip_commit_hash) if not is_installed("lpips"): - run_pip(f"install -r {os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}", "requirements for CodeFormer") + run_pip(f"install -r {os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}{f' --index-url {index_url}' if index_url!='' else ''}", "requirements for CodeFormer") - run_pip(f"install -r {requirements_file}", "requirements for Web UI") + run_pip(f"install -r {requirements_file}{f' --index-url {index_url}' if index_url!='' else ''}", "requirements for Web UI") sys.argv += args -- cgit v1.2.3 From 7855993bef0a16c235649027527b0f3ad7cca757 Mon Sep 17 00:00:00 2001 From: Cassy-Lee <104408348+Cassy-Lee@users.noreply.github.com> Date: Sat, 15 Oct 2022 10:02:18 +0800 Subject: Move index_url args into run_pip. --- launch.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index b753efc1..42072f33 100644 --- a/launch.py +++ b/launch.py @@ -9,6 +9,7 @@ import platform dir_repos = "repositories" python = sys.executable git = os.environ.get('GIT', "git") +index_url = os.environ.get('INDEX_URL',"") def extract_arg(args, name): @@ -57,7 +58,7 @@ def run_python(code, desc=None, errdesc=None): def run_pip(args, desc=None): - return run(f'"{python}" -m pip {args} --prefer-binary', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}") + return run(f'"{python}" -m pip {args} --prefer-binary{f' --index-url {index_url}' if index_url!='' else ''}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}") def check_run_python(code): @@ -89,7 +90,6 @@ def prepare_enviroment(): torch_command = os.environ.get('TORCH_COMMAND', "pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113") requirements_file = os.environ.get('REQS_FILE', "requirements_versions.txt") commandline_args = os.environ.get('COMMANDLINE_ARGS', "") - index_url = os.environ.get('INDEX_URL',"") gfpgan_package = os.environ.get('GFPGAN_PACKAGE', "git+https://github.com/TencentARC/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379") clip_package = os.environ.get('CLIP_PACKAGE', "git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1") @@ -122,22 +122,22 @@ def prepare_enviroment(): run_python("import torch; assert torch.cuda.is_available(), 'Torch is not able to use GPU; add --skip-torch-cuda-test to COMMANDLINE_ARGS variable to disable this check'") if not is_installed("gfpgan"): - run_pip(f"install {gfpgan_package}{f' --index-url {index_url}' if index_url!='' else ''}", "gfpgan") + run_pip(f"install {gfpgan_package}", "gfpgan") if not is_installed("clip"): - run_pip(f"install {clip_package}{f' --index-url {index_url}' if index_url!='' else ''}", "clip") + run_pip(f"install {clip_package}", "clip") if not is_installed("xformers") and xformers and platform.python_version().startswith("3.10"): if platform.system() == "Windows": run_pip("install https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/c/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl", "xformers") elif platform.system() == "Linux": - run_pip("install xformers{f' --index-url {index_url}' if index_url!='' else ''}", "xformers") + run_pip("install xformers", "xformers") if not is_installed("deepdanbooru") and deepdanbooru: run_pip("install git+https://github.com/KichangKim/DeepDanbooru.git@edf73df4cdaeea2cf00e9ac08bd8a9026b7a7b26#egg=deepdanbooru[tensorflow] tensorflow==2.10.0 tensorflow-io==0.27.0", "deepdanbooru") if not is_installed("pyngrok") and ngrok: - run_pip("install pyngrok{f' --index-url {index_url}' if index_url!='' else ''}", "ngrok") + run_pip("install pyngrok", "ngrok") os.makedirs(dir_repos, exist_ok=True) @@ -148,9 +148,9 @@ def prepare_enviroment(): git_clone("https://github.com/salesforce/BLIP.git", repo_dir('BLIP'), "BLIP", blip_commit_hash) if not is_installed("lpips"): - run_pip(f"install -r {os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}{f' --index-url {index_url}' if index_url!='' else ''}", "requirements for CodeFormer") + run_pip(f"install -r {os.path.join(repo_dir('CodeFormer'), 'requirements.txt')}", "requirements for CodeFormer") - run_pip(f"install -r {requirements_file}{f' --index-url {index_url}' if index_url!='' else ''}", "requirements for Web UI") + run_pip(f"install -r {requirements_file}", "requirements for Web UI") sys.argv += args -- cgit v1.2.3 From f756bc540a849039d88c19378419838fe87f15b0 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 15 Oct 2022 10:28:20 +0300 Subject: fix #2588 breaking launch.py (. . .) --- launch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 42072f33..537670a3 100644 --- a/launch.py +++ b/launch.py @@ -9,7 +9,7 @@ import platform dir_repos = "repositories" python = sys.executable git = os.environ.get('GIT', "git") -index_url = os.environ.get('INDEX_URL',"") +index_url = os.environ.get('INDEX_URL', "") def extract_arg(args, name): @@ -58,7 +58,8 @@ def run_python(code, desc=None, errdesc=None): def run_pip(args, desc=None): - return run(f'"{python}" -m pip {args} --prefer-binary{f' --index-url {index_url}' if index_url!='' else ''}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}") + index_url_line = f' --index-url {index_url}' if index_url != '' else '' + return run(f'"{python}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}") def check_run_python(code): -- cgit v1.2.3 From 09814e3cf384bf4189d57d1573483f72b38fb99f Mon Sep 17 00:00:00 2001 From: C43H66N12O12S2 <36072735+C43H66N12O12S2@users.noreply.github.com> Date: Sat, 15 Oct 2022 19:06:34 +0300 Subject: Update launch.py --- launch.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 537670a3..e3208553 100644 --- a/launch.py +++ b/launch.py @@ -107,6 +107,7 @@ def prepare_enviroment(): xformers = '--xformers' in args deepdanbooru = '--deepdanbooru' in args ngrok = '--ngrok' in args + reinstall_xformers = '--reinstall-xformers' in args try: commit = run(f"{git} rev-parse HEAD").strip() @@ -128,9 +129,9 @@ def prepare_enviroment(): if not is_installed("clip"): run_pip(f"install {clip_package}", "clip") - if not is_installed("xformers") and xformers and platform.python_version().startswith("3.10"): + if (not is_installed("xformers") or reinstall_xformers) and xformers and platform.python_version().startswith("3.10"): if platform.system() == "Windows": - run_pip("install https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/c/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl", "xformers") + run_pip("install -U -I --no-deps https://github.com/C43H66N12O12S2/stable-diffusion-webui/releases/download/f/xformers-0.0.14.dev0-cp310-cp310-win_amd64.whl", "xformers") elif platform.system() == "Linux": run_pip("install xformers", "xformers") -- cgit v1.2.3 From 8fb0b991522658d938ae43de77f708555aa1902b Mon Sep 17 00:00:00 2001 From: C43H66N12O12S2 <36072735+C43H66N12O12S2@users.noreply.github.com> Date: Sat, 15 Oct 2022 20:17:51 +0300 Subject: Update launch.py --- launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index e3208553..5ec2b926 100644 --- a/launch.py +++ b/launch.py @@ -104,10 +104,10 @@ def prepare_enviroment(): args = shlex.split(commandline_args) args, skip_torch_cuda_test = extract_arg(args, '--skip-torch-cuda-test') + args, reinstall_xformers = extract_argg(args, '--reinstall-xformers') xformers = '--xformers' in args deepdanbooru = '--deepdanbooru' in args ngrok = '--ngrok' in args - reinstall_xformers = '--reinstall-xformers' in args try: commit = run(f"{git} rev-parse HEAD").strip() -- cgit v1.2.3 From be1596ce30b1ead6998da0c62003003dcce5eb2c Mon Sep 17 00:00:00 2001 From: C43H66N12O12S2 <36072735+C43H66N12O12S2@users.noreply.github.com> Date: Sat, 15 Oct 2022 20:19:16 +0300 Subject: fix typo --- launch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'launch.py') diff --git a/launch.py b/launch.py index 5ec2b926..2e6b3369 100644 --- a/launch.py +++ b/launch.py @@ -104,7 +104,7 @@ def prepare_enviroment(): args = shlex.split(commandline_args) args, skip_torch_cuda_test = extract_arg(args, '--skip-torch-cuda-test') - args, reinstall_xformers = extract_argg(args, '--reinstall-xformers') + args, reinstall_xformers = extract_arg(args, '--reinstall-xformers') xformers = '--xformers' in args deepdanbooru = '--deepdanbooru' in args ngrok = '--ngrok' in args -- cgit v1.2.3