From 26ca0ebd3d11d3fba9637ef0e0a0039390aa958c Mon Sep 17 00:00:00 2001 From: SunKSugaR Date: Tue, 3 Dec 2024 00:38:11 +0800 Subject: [PATCH] bugfix: env won't reinstall if it doesn't exist. --- start_cli.py | 1 + start_webui.py | 1 + utils/install_utils.py | 18 +++++++++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/start_cli.py b/start_cli.py index b8ca7668..1c066523 100644 --- a/start_cli.py +++ b/start_cli.py @@ -23,6 +23,7 @@ def main(): install_mgr.setup() # Activate environment and run main.py + install_mgr.check_environment() if platform.system().lower() == "windows": activate_cmd = f"call {install_mgr.activate_script} {install_mgr.env_name}" else: diff --git a/start_webui.py b/start_webui.py index 2174cee0..cddb69a3 100644 --- a/start_webui.py +++ b/start_webui.py @@ -23,6 +23,7 @@ def main(): install_mgr.setup() # Activate environment and run server + install_mgr.check_environment() if platform.system().lower() == "windows": activate_cmd = f"call {install_mgr.activate_script} {install_mgr.env_name}" else: diff --git a/utils/install_utils.py b/utils/install_utils.py index 36a6a450..ba0d0179 100644 --- a/utils/install_utils.py +++ b/utils/install_utils.py @@ -115,13 +115,8 @@ def install_pip_dependencies(self): else: subprocess.run(["bash", "-c", pip_install_cmd], check=True) - def setup(self): - """Run complete setup process""" - if not self.conda_dir.exists(): - installer = self.download_miniconda() - self.install_miniconda(installer) - - # Create environment if it doesn't exist + def check_environment(self): + """Check if 'open-llm-vtuber' environment exists and install if not""" result = subprocess.run( [str(self.conda_executable), "env", "list"], capture_output=True, @@ -132,3 +127,12 @@ def setup(self): self.create_environment() self.install_conda_dependencies() self.install_pip_dependencies() + + def setup(self): + """Run complete setup process""" + if not self.conda_dir.exists(): + installer = self.download_miniconda() + self.install_miniconda(installer) + + # Create environment if it doesn't exist + self.check_environment() \ No newline at end of file