🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
skip env creation if exists in terminal toolkit (#3704)
JINO ROHITa8085d9e5146
diff --git a/camel/toolkits/terminal_toolkit/utils.py b/camel/toolkits/terminal_toolkit/utils.pyindex 8814a2afc..d20b9c67e 100644--- a/camel/toolkits/terminal_toolkit/utils.py+++ b/camel/toolkits/terminal_toolkit/utils.py@@ -297,6 +297,17 @@ def setup_initial_env_with_uv() -> bool:r"""Set up initial environment using uv."""try:+ if platform.system() == 'Windows':+ python_path = os.path.join(env_path, "Scripts", "python.exe")+ else:+ python_path = os.path.join(env_path, "bin", "python")++ if os.path.exists(python_path):+ if update_callback:+ update_callback(+ "[UV] Environment already exists, skipping creation\n"+ )+ return True# Create virtual environment with Python 3.10 using uvsubprocess.run([uv_path, "venv", "--python", "3.10", env_path],@@ -306,12 +317,6 @@ def setup_initial_env_with_uv(timeout=300,)- # Get the python path from the new environment- if platform.system() == 'Windows':- python_path = os.path.join(env_path, "Scripts", "python.exe")- else:- python_path = os.path.join(env_path, "bin", "python")-# Install essential packages using uvessential_packages = ["pip",@@ -356,6 +361,20 @@ def setup_initial_env_with_venv() -> bool:r"""Set up initial environment using standard venv."""try:+ # Get pip path+ if platform.system() == 'Windows':+ pip_path = os.path.join(env_path, "Scripts", "pip.exe")+ else:+ pip_path = os.path.join(env_path, "bin", "pip")++ # Check if environment already exists+ if os.path.exists(pip_path):+ if update_callback:+ update_callback(+ "Environment already exists, skipping creation\n"+ )+ return True+# Create virtual environment with system Pythontry:venv.create(@@ -374,12 +393,6 @@ def setup_initial_env_with_venv(symlinks=False,)- # Get pip path- if platform.system() == 'Windows':- pip_path = os.path.join(env_path, "Scripts", "pip.exe")- else:- pip_path = os.path.join(env_path, "bin", "pip")-# Upgrade pip and install essential packagesessential_packages = ["pip",