Fix extensions install (2nd attempt)

This commit is contained in:
oobabooga 2023-09-28 14:27:25 -07:00
parent 4e56ad55e1
commit 771e936769

View File

@ -191,11 +191,12 @@ def update_requirements(initial_installation=False):
# Extensions requirements are installed only during the initial install by default. # Extensions requirements are installed only during the initial install by default.
# That can be changed with the INSTALL_EXTENSIONS environment variable. # That can be changed with the INSTALL_EXTENSIONS environment variable.
install_extensions = os.environ.get("INSTALL_EXTENSIONS", "false").lower() in ("yes", "y", "true", "1", "t", "on") install = initial_installation
if initial_installation and not install_extensions: if "INSTALL_EXTENSIONS" in os.environ:
print_big_message("Will not install extensions due to INSTALL_EXTENSIONS environment variable.") install = os.environ["INSTALL_EXTENSIONS"].lower() in ("yes", "y", "true", "1", "t", "on")
elif initial_installation or install_extensions:
print("Installing extensions requirements.") if install:
print_big_message("Installing extensions requirements.")
extensions = next(os.walk("extensions"))[1] extensions = next(os.walk("extensions"))[1]
for extension in extensions: for extension in extensions:
if extension in ['superbooga', 'superboogav2']: # No wheels available for requirements if extension in ['superbooga', 'superboogav2']: # No wheels available for requirements
@ -204,6 +205,8 @@ def update_requirements(initial_installation=False):
extension_req_path = os.path.join("extensions", extension, "requirements.txt") extension_req_path = os.path.join("extensions", extension, "requirements.txt")
if os.path.exists(extension_req_path): if os.path.exists(extension_req_path):
run_cmd("python -m pip install -r " + extension_req_path + " --upgrade", assert_success=True, environment=True) run_cmd("python -m pip install -r " + extension_req_path + " --upgrade", assert_success=True, environment=True)
elif initial_installation:
print_big_message("Will not install extensions due to INSTALL_EXTENSIONS environment variable.")
# Detect the PyTorch version # Detect the PyTorch version
torver = torch_version() torver = torch_version()
@ -233,7 +236,7 @@ def update_requirements(initial_installation=False):
else: else:
requirements_file = "requirements_noavx2.txt" requirements_file = "requirements_noavx2.txt"
print(f"Using the following requirements file: {requirements_file}") print_big_message(f"Installing webui requirements from file: {requirements_file}")
textgen_requirements = open(requirements_file).read().splitlines() textgen_requirements = open(requirements_file).read().splitlines()