-
Notifications
You must be signed in to change notification settings - Fork 146
/
windows_setup.ps1
74 lines (61 loc) · 2.31 KB
/
windows_setup.ps1
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# AnarchyAI setup script
Write-Host -ForegroundColor Green "AnarchyAI setup script"
# Step 1: Check winget version
Write-Host "Checking winget version..."
winget --version
if ($LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "Error: Please update your Windows and then re-run the setup."
exit
}
# Wait for a moment before proceeding
Start-Sleep -Seconds 1
# Step 2: Check Python version and install if not found
Write-Host "Checking Python version..."
python --version
if ($LASTEXITCODE -ne 0) {
Write-Host "Python not found. Installing Python 3.11..."
winget install Python.Python.3.11
if ($LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "Error: Installing Python failed. Setup aborted."
exit
}
# Wait for a moment before proceeding
Start-Sleep -Seconds 3
# Open a new PowerShell window in the same path
Start-Process powershell -ArgumentList "-NoExit -Command Set-Location '$PWD'; Start-Sleep -Seconds 3; .\windows_setup.ps1"
# Close the current PowerShell window
exit
}
# Step 3: Create a virtual environment
Write-Host "Creating a virtual environment..."
python -m venv anarchyai
if ($LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "Error: Creating the virtual environment failed. Setup aborted."
exit
}
# Wait for a moment before proceeding
Start-Sleep -Seconds 2
# Step 4: Activate the virtual environment
Write-Host "Activating the virtual environment..."
& .\anarchyai\Scripts\Activate
if ($LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "Error: Activating the virtual environment failed. Setup aborted."
exit
}
# Wait for a moment before proceeding
Start-Sleep -Seconds 2
# Step 5: Install or upgrade pip
Write-Host "Installing or upgrading pip..."
python -m pip install --upgrade pip
if ($LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "Error: Installing or upgrading pip failed. Setup aborted."
exit
}
# Step 6: Install dependencies in development mode
Write-Host "Installing dependencies in development mode..."
python -m pip install -e .
if ($LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "Error: Installing dependencies failed. Setup aborted."
exit
}
Write-Host -ForegroundColor Green "Setup completed successfully."