Skip to content

Commit f9eb767

Browse files
authored
Update env_creator.py
1 parent 24fb765 commit f9eb767

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

env_creator.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,23 @@ def setup_virtualenv(self, env_name, custom_env_dir=None, mirror_url=None):
1616
env_dir.mkdir(parents=True, exist_ok=True)
1717
print(f"Creating virtual environment at {env_dir} for {env_name}...")
1818
subprocess.run(["python", "-m", "venv", str(env_dir)], check=True)
19-
subprocess.run(["python", "-m", "pip", "install", "--upgrade", "pip", "-i", mirror_url])
19+
20+
# Upgrade pip with or without mirror URL
21+
pip_upgrade_command = ["python", "-m", "pip", "install", "--upgrade", "pip"]
22+
if mirror_url:
23+
pip_upgrade_command += ["-i", mirror_url]
24+
subprocess.run(pip_upgrade_command, check=True)
25+
26+
print(requirements_path)
2027
if requirements_path.exists():
2128
print(f"Installing dependencies for {env_name} from {requirements_path}...")
2229
pip_command = env_dir / "bin" / "pip" if platform.system() != "Windows" else env_dir / "Scripts" / "pip"
2330
install_command = [str(pip_command), "install", "-r", str(requirements_path)]
31+
32+
# Add mirror URL if provided
2433
if mirror_url:
2534
install_command += ["-i", mirror_url]
35+
2636
subprocess.run(install_command, check=True)
2737
else:
2838
print(f"No requirements.txt found for {env_name}. Skipping dependencies installation.")

0 commit comments

Comments
 (0)