Installing uv on Windows without administrator rights

Introduction to Python - Unit 1 companion guide

When to use this guide

The slides install uv with:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

On a managed computer (e.g. a work laptop) that command may be blocked, or you may not be allowed to change the execution policy. This guide installs uv for your Windows user only:

  • no administrator rights
  • no -ExecutionPolicy Bypass
  • nothing installed under Program Files

After that, everything works as in the slides.

Run the installation steps in PowerShell, opened normally (not Run as administrator). Afterwards, uv also works in Command Prompt, Windows Terminal and VS Code.

1. Create a folder for your tools

$bin = Join-Path $env:USERPROFILE 'bin'
New-Item -ItemType Directory -Force -Path $bin

This creates C:\Users\<your name>\bin. You can always write inside your own user folder.

2. Download uv

Download the official release from the uv GitHub releases page, unzip it, and copy the programs into your bin folder:

$zip = Join-Path $env:TEMP 'uv-windows.zip'
$extract = Join-Path $env:TEMP 'uv-windows'

curl.exe -L `
  'https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-pc-windows-msvc.zip' `
  -o $zip

Expand-Archive -Path $zip -DestinationPath $extract -Force
Copy-Item (Join-Path $extract '*.exe') $bin -Force

This copies uv.exe, uvx.exe and uvw.exe.

Note

On an ARM computer (e.g. some Surface laptops), replace x86_64 with aarch64 in the link. Not sure? Run $env:PROCESSOR_ARCHITECTURE: AMD64 means x86_64, ARM64 means aarch64.

3. Add the folder to your PATH

So that Windows finds uv when you type it. This changes the PATH for your user only:

$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')

if (($userPath -split ';') -notcontains $bin) {
    $newUserPath = (@($userPath.TrimEnd(';')) + $bin) -join ';'
    [Environment]::SetEnvironmentVariable('Path', $newUserPath, 'User')
}

Close and reopen the terminal (and restart VS Code if it is open), then check:

uv --version

To use it in the current window without restarting:

$env:Path = "$bin;$env:Path"
uv --version

Check that the file is there (should print True):

Test-Path (Join-Path $bin 'uv.exe')

4. Create the course project

From here on it’s the same as in the slides. Go to the folder where you keep your coursework, then:

mkdir aaiml-python
cd aaiml-python
uv init

uv init creates pyproject.toml, .python-version, main.py and README.md.

5. Install JupyterLab and start it

uv add jupyterlab
uv run jupyter lab

The first uv add also downloads Python (into your user folder, no admin needed) and creates the .venv folder. JupyterLab opens in your browser.

Add other packages the same way, e.g. uv add pandas openpyxl.

6. Run Python

uv run python            # interactive interpreter
uv run python main.py    # run a script

Activating the venv: use uv run instead

The slides show .venv\Scripts\activate. In PowerShell this runs a script, which the same policy that blocked the installer may also block (“running scripts is disabled on this system”).

You don’t need it: uv run uses the project’s environment without activating it. Just put uv run in front: uv run jupyter lab, uv run python.

If you really want an activated environment, use Command Prompt (cmd) instead of PowerShell:

.venv\Scripts\activate.bat

VS Code

From the project folder:

code .

If VS Code doesn’t pick the project’s Python automatically: Ctrl+Shift+P → Python: Select Interpreter → choose the one inside .venv.

Cheat sheet

Task Command
Create a project (in the current folder) uv init
Add a package uv add pandas
Start JupyterLab uv run jupyter lab
Run a Python file uv run python main.py
Start Python uv run python
Recreate the environment (e.g. on another computer) uv sync
Show installed packages uv tree

If something is blocked

Organisation policies (AppLocker, WDAC, antivirus) may still block the download or running uv.exe. This guide does not get around those controls. Don’t try to: ask your IT department for an approved way to install Python, or use Google Colab for the course in the meantime.