Skip to content

Add a all-in-one Windows setup script #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,29 @@ The `mila` command is meant to be used on your local machine. Trying to run it o
---


## All-in-one setup for a Windows machine:

1. Open PowerShell as an administrator (Right click --> Run as administrator).
Enter the following command:

```powershell
powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/mila-iqia/milatools/refs/heads/windows-setup-script/scripts/windows_setup.ps1 | iex"
```

2. Reboot your machine

3. After the reboot is complete, open a WSL shell (enter Ubuntu in the search bar, then press enter)

Run the following commands:

```console
curl -LsSf https://astral.sh/uv/install.sh | sh
uv tool install milatools
mila init
```



## Install

Requires Python >= 3.8
Expand Down
49 changes: 49 additions & 0 deletions scripts/windows_setup.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Ensure script is run as Administrator
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Error "This script must be run as an administrator."; exit 1
}

# Install Visual Studio Code if not already installed
if (-not (Get-Command code -ErrorAction SilentlyContinue)) {
Write-Host "Visual Studio Code not found. Installing..."
$installerUrl = "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-user"
$installerPath = "$env:TEMP\VSCodeSetup.exe"

Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath -UseBasicParsing
Start-Process -FilePath $installerPath -ArgumentList "/silent" -Wait
Remove-Item $installerPath
Write-Host "Visual Studio Code installed successfully."
} else {
Write-Host "Visual Studio Code is already installed."
}

# TODO: Check if it's already installed.
# Good tutorial:
# https://eecs280staff.github.io/tutorials/setup_wsl.html

# Enable and install Windows Subsystem for Linux (WSL)
Write-Host "Setting up Windows Subsystem for Linux (WSL)..."
wsl --install
Write-Host "WSL setup complete."

# TODO: We want to (only?) install `uv` within WSL, not Windows!
# Install UV package manager from Astral.sh
# Install Visual Studio Code if not already installed
# if (-not (Get-Command uv -ErrorAction SilentlyContinue)) {
# Write-Host "Installing UV package manager from Astral.sh..."
# irm https://astral.sh/uv/install.ps1 | iex
# } else {
# Write-Host "UV package manager is already installed."
# }


# Install Git if not already installed
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Write-Host "Git not found. Installing..."
winget install --id Git.Git -e --source winget
Write-Host "Git installed successfully."
} else {
Write-Host "Git is already installed."
}

Write-Host "Setup complete!"
Loading