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.
# 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")
if initial_installation and not install_extensions:
print_big_message("Will not install extensions due to INSTALL_EXTENSIONS environment variable.")
elif initial_installation or install_extensions:
print("Installing extensions requirements.")
install = initial_installation
if "INSTALL_EXTENSIONS" in os.environ:
install = os.environ["INSTALL_EXTENSIONS"].lower() in ("yes", "y", "true", "1", "t", "on")
if install:
print_big_message("Installing extensions requirements.")
extensions = next(os.walk("extensions"))[1]
for extension in extensions:
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")
if os.path.exists(extension_req_path):
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
torver = torch_version()
@ -233,7 +236,7 @@ def update_requirements(initial_installation=False):
else:
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()