Skip to main content

WSL2 + NVIDIA Setup

This guide covers setting up WSL2 with NVIDIA GPU acceleration for running local AI models.

Prerequisites

  • Windows 10 version 2004+ or Windows 11
  • 16GB+ RAM recommended
  • 20GB+ free disk space
  • NVIDIA GPU (RTX series recommended)

Step 1: Enable WSL2

Run PowerShell as Administrator:

wsl --install

Restart your computer when prompted.

Step 2: Verify WSL2

Open PowerShell or Command Prompt:

wsl --status
wsl -l -v

You should see Ubuntu installed with version 2.

Step 3: Install NVIDIA Drivers

  1. Download and install GeForce Experience
  2. Update to the latest drivers

Step 4: Install CUDA for WSL2

Follow the NVIDIA CUDA WSL2 guide:

# Add CUDA repository
wsl -d ubuntu
wsl sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/wsl2/ubuntu22.04/x86_64/nvidia-cuda-repo-wsl2-ubuntu22.04-*.deb
wsl sudo dpkg -i nvidia-cuda-repo-wsl2-ubuntu22.04-*.deb
wsl sudo apt update
wsl sudo apt install cuda-toolkit-12-*

Or follow the instructions at the link above for the latest approach.

Step 5: Verify GPU Access

nvidia-smi

You should see your GPU listed with driver version and memory info.

Windows Settings

Enable GPU integration in WSL2:

# Check current settings
wsl --status

# Ensure version 2
wsl -l -v

For best performance, ensure you're using WSL2 (not WSL1).