For a long time, I tried to force all my tools into a single WSL Ubuntu environment.
Node, Python, .NET, Docker, PyTorch, CUDA, Jupyter, Transformers, all living together like one big chaotic family.
And like any chaotic family, they fought. A lot.
I kept running into:
- Conflicting Python versions
- Node tools breaking AI tools
- CUDA updates breaking everything
- Slow environments
- Dependency hell
Eventually, I realized something important:
I don't need one WSL. I need two.
One for development.
One for AI.
That simple shift changed my entire workflow.
After a lot of deep searching, testing, breaking, and rebuilding, I finally landed on a clean, scalable architecture that I'm now sharing publicly — because it solved problems I know many developers struggle with.
This is the setup I wish I had from day one.
🧠 Why Two WSL Distros Instead of One?
Dev tools and AI tools don't mix well.
- AI needs CUDA, PyTorch, GPU drivers, heavy Python packages
- Dev needs Node, .NET, Docker, databases, build tools
- Updating one often breaks the other
- Virtual environments help, but they don't isolate system-level dependencies
So I split them:
+------------------+ +------------------+
| Ubuntu-dev | | Ubuntu-ai |
|------------------| |------------------|
| Node.js (NVM) | | PyTorch (CUDA) |
| Python (dev) | | Transformers |
| .NET SDK | | JupyterLab |
| Docker client | | AI venv |
+------------------+ +------------------+
\ /
\________________________/
Shared:
- SSH keys
- Git identity
- Base packages
- Bootstrap folder
This keeps everything consistent while giving each environment its own purpose.
🏗 Step 1 — Export Your Existing Ubuntu
wsl --export Ubuntu ubuntu-base.tar
📁 Step 2 — Create Folders for the New Distros
mkdir C:\WSL\Ubuntu-dev
mkdir C:\WSL\Ubuntu-ai
📦 Step 3 — Import the New Distros
wsl --import Ubuntu-dev C:\WSL\Ubuntu-dev ubuntu-base.tar
wsl --import Ubuntu-ai C:\WSL\Ubuntu-ai ubuntu-base.tar
⚡ Step 4 — Add Quick Commands (dev and ai)
notepad $PROFILE
Add:
function dev { wsl -d Ubuntu-dev }
function ai { wsl -d Ubuntu-ai }
Restart PowerShell.
Now you can jump into each distro instantly:
dev
ai
📂 Step 5 — Create a Shared Bootstrap Folder
mkdir C:\Users\YourName\WSL-bootstrap
🔧 Step 6 — The Common Bootstrap Script
bootstrap-common.sh
#!/usr/bin/env bash
set -euo pipefail
sudo apt update
sudo apt install -y build-essential curl git ca-certificates software-properties-common unzip
if [ -d "/mnt/c/Users/YourName/.ssh" ]; then
rm -rf "$HOME/.ssh"
ln -s "/mnt/c/Users/YourName/.ssh" "$HOME/.ssh"
fi
git config --global user.name "YourName"
git config --global user.email "your.email@example.com"
echo "[common] Base packages and SSH/Git configured."
💻 Step 7 — Dev WSL Setup (Ubuntu-dev)
bootstrap-dev.sh
#!/usr/bin/env bash
set -euo pipefail
"$(dirname "$0")/bootstrap-common.sh"
if [ ! -d "$HOME/.nvm" ]; then
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
fi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm install --lts
nvm use --lts
npm install -g yarn pnpm
sudo apt install -y python3 python3-pip python3-venv
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update
sudo apt install -y dotnet-sdk-8.0
echo "[dev] Node, Python, .NET installed."
Run it:
dev
Inside WSL:
cd /mnt/c/Users/YourName/WSL-bootstrap
chmod +x *.sh
./bootstrap-dev.sh
🤖 Step 8 — AI WSL Setup (Ubuntu-ai)
bootstrap-ai.sh
#!/usr/bin/env bash
set -euo pipefail
"$(dirname "$0")/bootstrap-common.sh"
sudo apt install -y python3 python3-pip python3-venv
if [ ! -d "$HOME/venvs/ai" ]; then
mkdir -p "$HOME/venvs"
python3 -m venv "$HOME/venvs/ai"
fi
source "$HOME/venvs/ai/bin/activate"
pip install --upgrade pip
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install "transformers[torch]" datasets accelerate jupyterlab
echo "[ai] Base AI environment ready (PyTorch, Transformers, Jupyter)."
Run it:
ai
Inside WSL:
cd /mnt/c/Users/YourName/WSL-bootstrap
./bootstrap-ai.sh
🔍 Step 9 — Verify Everything
Git identity:
git config --global --list
SSH linking:
ls -l ~/.ssh
Node (dev):
node -v
npm -v
AI stack:
source ~/venvs/ai/bin/activate
pip list | grep torch
🎯 Final Thoughts
Splitting my workflow into two WSL distros was one of the best decisions I've made for my development setup. It keeps everything clean, organized, and conflict‑free.
- My Dev WSL stays fast and focused on coding.
- My AI WSL stays isolated and optimized for machine learning.
If you've been struggling with dependency conflicts, slow environments, or messy setups, this architecture might be exactly what you need.
Top comments (0)