Linux vs Windows for AI, Scripts, and Automation
Practical tradeoffs between native Linux and Windows+WSL2 for AI/ML development, scripting, and automation: GPU support, filesystem performance, and packaging.
Linux and Windows with WSL2 are now close for AI/ML and scripting work. In 2026 the right choice depends on the workload, not on a general claim that Linux is better.
Decision flow
Steps
- Assess GPU and workload requirements. Multi-GPU training, AMD GPUs, or 24/7 bare-metal inference favor native Linux. A single NVIDIA GPU on Windows works under WSL2. Use the WSL3 preview if you need near-native GPU numbers.
- Check Windows application dependencies. If you need Windows-only tools (Office, Hyper-V, a corporate VPN client), start with WSL2 on Windows instead of bare Linux.
- Choose your WSL tier. Use WSL2 stable for development and containers. WSL3 (preview as of August 2026) gets CUDA/PyTorch within ~3-5% of bare metal. Do not use it in production yet.
- Set up the package ecosystem in the right place.
apt/conda/pipinside WSL (or native Linux), not on Windows itself. On native Windows, winget/Scoop cover CLI tools only. - Keep the project filesystem inside WSL’s ext4, not under
/mnt/c/Users/.... Crossing that boundary costs 7-60x on I/O and metadata operations. - Install GPU drivers once, correctly. On WSL2, install the NVIDIA Windows driver. It exposes CUDA to WSL automatically. On native Linux: install the driver per distro/GPU. Verify either way with
nvidia-smi. - Set up containers and confirm GPU passthrough. Docker Desktop with the WSL2 backend needs Windows 10 build 19045+ or Windows 11 23H2+ and WSL 2.1.5+. Confirm
nvidia-smiand CUDA libraries are visible inside the container, not just on the host. - Pick your scripting shell deliberately. Bash on WSL2/Linux for portable automation; PowerShell 7+ only when you’re specifically automating Windows infrastructure.
Tips
- Clone all repos into the WSL filesystem. Cloning onto the Windows side is the most common WSL2 performance mistake.
- Use VS Code Remote-SSH into WSL2: edit on Windows, run/compile on Linux, no path-translation overhead.
- Create conda environments only inside WSL. A Windows-created environment and a WSL-created one are separate ecosystems, even though they share NTFS.
- Winget ships with Windows 11, so you rarely need Chocolatey or Scoop for basic CLI tools.
- Use NixOS if you control the infrastructure and want declarative, reproducible builds. Otherwise, plain apt/dnf is simpler.
Common pitfalls
- Windows paths baked into
.bashrc/.gitconfig(e.g.USERPROFILE=/mnt/c/Users/...) quietly keeps even pure-Linux operations on slow Windows filesystem performance. inotify-based file watching from/mnt/c(nodemon,pytest --watch, webpack,cargo watch) is unreliable. Keep watched files on the WSL filesystem.- GPU driver version mismatch: WSL2 CUDA support uses the Windows NVIDIA driver, not a Linux one. A mismatched driver version breaks GPU access completely.
- Assuming WSL3 is generally available: as of August 2026, it is preview only. Use WSL2 for production.
- Docker Desktop WSL2 integration failing silently on WSL below 2.1.5 with a cryptic “distro not registered” error: run
wsl --updatefirst. - Switching between WSL2 and native Linux mid-project causes git config confusion (
/mnt/cpaths vs/homepaths). Commit to one platform per project.
Related
Sources
- WSL 3: GPU and NPU Passthrough for Windows AI Dev (Build 2026)
- CUDA on Windows Subsystem for Linux (WSL) - NVIDIA Developer
- Docker Desktop on Windows Installation and Setup
- Managing Native Linux vs WSL 1 & 2: Technical Comparison for Windows Admins
- WSL2 Filesystem Speed Optimization
- The Linux-Windows Bridge: Practical WSL2 Usage - Medium
- NixOS: Declarative Linux Distribution
- Is NixOS the Most Powerful Linux Distro in 2026?