-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathws_install_venv.ps1
More file actions
37 lines (28 loc) · 984 Bytes
/
Copy pathws_install_venv.ps1
File metadata and controls
37 lines (28 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# run it:
# .\ws_install_venv.ps1 -envName mle_test
# Get the environment name from the command line
param (
[string]$envName
)
# Check if environment name is provided
if (-not $envName) {
Write-Output "Please provide an environment name using --env <name>"
exit
}
# Get the current username
$username = $env:USERNAME
# Define the path to the virtual environment based on the current user
$envPath = "C:/Users/$username/envs/$envName"
# Check if the virtual environment folder exists
if (Test-Path $envPath) {
Write-Output "Virtual environment already exists. Skipping creation."
} else {
# Create a virtual environment with uv
uv venv $envPath
}
# Activate the virtual environment
& "$envPath/Scripts/Activate.ps1"
# Install dependencies using uv
# uv pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
uv pip install -r requirements.txt
Write-Output "Virtual environment '$envName' has been set up with uv."