Training My First Neural Network on Windows with WSL 2 and PyTorch A physics undergraduate documented a step-by-step workflow for training a first neural network on Windows using WSL 2, Ubuntu, a Python virtual environment, and PyTorch. The guide walks through installing Ubuntu via `wsl --install -d Ubuntu`, setting up the project in the Linux home directory, and building a small network for the XOR problem that ends with a saved model file. The author notes a GPU is unnecessary for the four-example experiment and that the focus is on getting the workflow running rather than the underlying mathematics. As a physics undergraduate beginning to explore AI research, I wanted to understand the practical workflow behind a neural network experiment: where the code lives, how the environment works, how to run training, and what gets saved afterward. This tutorial brings together my setup notes and first PyTorch experiment. We will build a small network for XOR, starting from a Windows computer and ending with a saved model file. The focus is on getting the workflow running; the mathematics can come later. You need a supported Windows 10 or Windows 11 installation, permission to install WSL, and an internet connection. A GPU is unnecessary for this four-example experiment. The workflow is Windows terminal → WSL 2 → Ubuntu → project folder → Python virtual environment → PyTorch → training results . | Tool | Role in this experiment | |---|---| | CMD / PowerShell | Launches WSL from Windows | | WSL 2 | Runs a Linux kernel using lightweight virtualization | | Ubuntu | Provides the Linux operating environment | | APT | Installs Ubuntu system packages | | Python | Executes our training script | | venv | Isolates the project's Python dependencies | | pip | Installs packages inside that environment | | PyTorch | Provides tensors, neural network layers, and automatic differentiation | Docker is an optional next step for packaging environments. Ordinary Ubuntu and PyTorch development works without Docker Desktop running. Run these commands in Windows CMD or PowerShell : wsl -l -v On my machine, the only listed distribution was initially docker-desktop . That did not mean I already had an Ubuntu development environment. To install Ubuntu, open PowerShell as administrator and run: wsl --install -d Ubuntu Restart Windows if prompted. On Ubuntu's first launch, create a Linux username and password. The password input displays no characters or asterisks. Check the installation from Windows: wsl -l -v Confirm that Ubuntu is listed with VERSION 2 . If it uses version 1, run: wsl --set-version Ubuntu 2 Optionally make Ubuntu the default, then launch it: wsl --set-default Ubuntu wsl -d Ubuntu For installation requirements and troubleshooting, see Microsoft's WSL installation guide https://learn.microsoft.com/en-us/windows/wsl/install . From this point onward, commands run inside Ubuntu , unless explicitly labeled otherwise. A terminal prompt might look like: lawson@computer:~$ lawson is the Linux username, computer is the hostname, and ~ means the user's home directory. Do not copy the prompt itself when running commands. Your Linux home directory is typically /home/