Introduction
Here is a fact that might surprise you: over 70% of AI researchers and robotics students run Windows as their primary operating system, yet almost every serious robotics simulation framework ships with Linux-first documentation and Linux-only installation scripts. If you have ever stared at a GitHub README full of apt-get commands and wondered whether your Windows 11 machine was simply out of luck, you are not alone.
OpenClaw is an open-source robotic manipulation framework designed for AI research. It provides a rich set of simulated environments for dexterous manipulation tasks — think robotic hands grasping objects, assembling parts, and performing precise movements that push the boundaries of reinforcement learning. Built on top of MuJoCo (now free and open-source) and compatible with popular RL libraries like Stable Baselines3, OpenClaw has quickly become a go-to toolkit for researchers working on manipulation policies.
The problem? Like most robotics frameworks, OpenClaw was built with Linux in mind. The official documentation assumes you are running Ubuntu, the CI pipelines test on Linux, and many of the convenience scripts use bash. For the Windows 11 user, getting OpenClaw running can feel like solving a puzzle with missing pieces.
This guide changes that. Over the next several thousand words, I will walk you through three complete installation methods — WSL2, native Windows with Conda, and Docker — each with full command-by-command instructions. By the end, you will have OpenClaw running on your Windows 11 machine, training your first manipulation policy, and visualizing robotic simulations with full GPU acceleration. No Linux dual-boot required.
System Requirements
Before we dive into installation, let us make sure your machine is up to the task. OpenClaw runs physics simulations and neural network training simultaneously, which means it needs real computational muscle. Here is what you need:
Hardware Requirements
| Component | Minimum | Recommended |
|---|---|---|
| OS | Windows 11 21H2 | Windows 11 22H2 or later |
| GPU | NVIDIA GTX 1070 (8GB VRAM) | NVIDIA RTX 3060 12GB or better |
| RAM | 16 GB | 32 GB or more |
| Storage | 50 GB free (SSD) | 100 GB+ free (NVMe SSD) |
| CPU | Intel i5 / AMD Ryzen 5 | Intel i7/i9 or AMD Ryzen 7/9 |
| Python | 3.9 | 3.10 or 3.11 |
Software Prerequisites
Regardless of which installation method you choose, you will need a few things ready:
- NVIDIA GPU drivers: Version 525.0 or later (download from nvidia.com/drivers)
- Windows Terminal: Pre-installed on Windows 11, but grab it from the Microsoft Store if missing
- Git for Windows: Download from git-scm.com
- A text editor or IDE: VS Code is strongly recommended
To check your current NVIDIA driver version, open PowerShell and run:
nvidia-smi
You should see output showing your driver version and CUDA version. If this command fails, install or update your NVIDIA drivers before proceeding.
Method 1: WSL2 (Recommended Approach)
WSL2 (Windows Subsystem for Linux 2) is the gold standard for running Linux-native tools on Windows. It provides a real Linux kernel, full system call compatibility, and — critically for us — native GPU passthrough. This means your NVIDIA GPU works inside WSL2 at near-native performance. For OpenClaw, this is the recommended path because you get full Linux compatibility without any of the headaches of dual-booting.
Step 1: Enable and Install WSL2
Open PowerShell as Administrator and run:
# Install WSL2 with Ubuntu 22.04 (default)
wsl --install -d Ubuntu-22.04
# If WSL is already installed, make sure it's version 2
wsl --set-default-version 2
# Verify installation
wsl --list --verbose
After installation completes, restart your computer. When you open Ubuntu from the Start menu for the first time, it will ask you to create a username and password. Choose something simple — you will be typing it frequently for sudo commands.
# Verify WSL2 is running correctly
wsl --list --verbose
# Expected output:
# NAME STATE VERSION
# * Ubuntu-22.04 Running 2
Step 2: Update the System and Install Base Dependencies
Open your Ubuntu terminal (either from the Start menu or by typing wsl in PowerShell) and run:
# Update package lists and upgrade existing packages
sudo apt update && sudo apt upgrade -y
# Install essential build tools and libraries
sudo apt install -y \
build-essential \
cmake \
git \
wget \
curl \
unzip \
pkg-config \
libgl1-mesa-dev \
libglu1-mesa-dev \
libglew-dev \
libosmesa6-dev \
libglfw3-dev \
libxrandr-dev \
libxinerama-dev \
libxcursor-dev \
libxi-dev \
patchelf \
python3-dev \
python3-pip \
python3-venv \
software-properties-common
Step 3: Install NVIDIA CUDA Toolkit in WSL2
This is the part that trips up most people. Here is the key insight: you do not install NVIDIA drivers inside WSL2. The Windows host drivers handle GPU communication. You only need the CUDA toolkit inside WSL2.
# Add the CUDA repository key and repo
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda-repo-wsl-ubuntu-12-4-local_12.4.0-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-12-4-local_12.4.0-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt update
sudo apt install -y cuda-toolkit-12-4
# Add CUDA to your PATH
echo 'export PATH=/usr/local/cuda-12.4/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
# Verify CUDA installation
nvcc --version
nvidia-smi
Both commands should succeed. nvidia-smi shows your GPU information (pulled from the Windows host driver), and nvcc --version confirms the CUDA compiler is installed.
Step 4: Install MuJoCo
OpenClaw uses MuJoCo as its physics simulation backend. Since DeepMind made MuJoCo free and open-source, installation has become much simpler:
# Download and extract MuJoCo
mkdir -p ~/.mujoco
wget https://github.com/google-deepmind/mujoco/releases/download/3.1.3/mujoco-3.1.3-linux-x86_64.tar.gz
tar -xzf mujoco-3.1.3-linux-x86_64.tar.gz -C ~/.mujoco/
mv ~/.mujoco/mujoco-3.1.3 ~/.mujoco/mujoco313
# Set environment variables
echo 'export MUJOCO_PATH=$HOME/.mujoco/mujoco313' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=$MUJOCO_PATH/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
# Test MuJoCo binary
$MUJOCO_PATH/bin/simulate $MUJOCO_PATH/model/humanoid/humanoid.xml &
Step 5: Clone and Install OpenClaw
Now for the main event. We will create a dedicated Python virtual environment and install OpenClaw from source:
# Create a workspace directory
mkdir -p ~/robotics && cd ~/robotics
# Clone the OpenClaw repository
git clone https://github.com/openclaw-project/openclaw.git
cd openclaw
# Create and activate a Python virtual environment
python3 -m venv venv
source venv/bin/activate
# Upgrade pip and install build tools
pip install --upgrade pip setuptools wheel
# Install PyTorch with CUDA support
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
# Install MuJoCo Python bindings
pip install mujoco==3.1.3
# Install OpenClaw and all dependencies
pip install -e ".[all]"
# Alternatively, install from requirements if available
# pip install -r requirements.txt
# pip install -e .
Verify everything installed correctly:
# Verify PyTorch CUDA support
python -c "import torch; print(f'PyTorch: {torch.__version__}'); print(f'CUDA available: {torch.cuda.is_available()}'); print(f'GPU: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"N/A\"}')"
# Verify MuJoCo
python -c "import mujoco; print(f'MuJoCo version: {mujoco.__version__}')"
# Verify OpenClaw
python -c "import openclaw; print(f'OpenClaw loaded successfully')"
Step 6: Set Up GUI Forwarding for Visualization
Windows 11 ships with WSLg (Windows Subsystem for Linux GUI), which means graphical applications just work — most of the time. If you are running Windows 11 22H2 or later, GUI forwarding should be automatic. Let us verify:
# Test GUI display — this should open a small window
sudo apt install -y x11-apps
xclock &
# If xclock shows a clock window, WSLg is working.
# If not, make sure WSL is up to date:
# (Run this in PowerShell, not WSL)
# wsl --update
If WSLg is not working, you can fall back to an X server:
# Fallback: Set DISPLAY for manual X server (VcXsrv or X410)
# Only needed if WSLg is not working
echo 'export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk "{print \$2}"):0' >> ~/.bashrc
echo 'export LIBGL_ALWAYS_INDIRECT=0' >> ~/.bashrc
source ~/.bashrc
Step 7: Run Your First OpenClaw Environment
# Make sure you're in the OpenClaw directory with venv activated
cd ~/robotics/openclaw
source venv/bin/activate
# Run the demo script to verify everything works
python -m openclaw.demo --env GraspCube-v1 --render
# Or run a minimal test script
python -c "
import openclaw
import numpy as np
env = openclaw.make('GraspCube-v1', render_mode='human')
obs, info = env.reset()
print(f'Observation space: {env.observation_space.shape}')
print(f'Action space: {env.action_space.shape}')
for step in range(100):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
obs, info = env.reset()
env.close()
print('Environment test completed successfully!')
"
If you see a simulation window with a robotic hand attempting to grasp a cube (even if clumsily — it is taking random actions), everything is working. You have successfully installed OpenClaw on Windows 11 via WSL2.
Method 2: Native Windows with Conda
If you prefer to stay fully within the Windows ecosystem without WSL2, you can install OpenClaw natively using Conda. This approach works but comes with some caveats: certain features may require additional configuration, and you might encounter Windows-specific path issues. That said, for many use cases it works perfectly well.
Step 1: Install Miniconda
Download and install Miniconda from docs.conda.io. Choose the Windows 64-bit installer. During installation:
- Install for “Just Me” (recommended)
- Check “Add Miniconda to my PATH” (despite the warning — it makes life easier)
- Check “Register Miniconda as the default Python”
Open a new Anaconda Prompt (or PowerShell) and verify:
conda --version
# Should output: conda 24.x.x or later
Step 2: Create the Conda Environment
# Create a new environment with Python 3.10
conda create -n openclaw python=3.10 -y
conda activate openclaw
# Install PyTorch with CUDA support via conda
conda install pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia -y
# Verify CUDA is available
python -c "import torch; print(torch.cuda.is_available())"
Step 3: Install MuJoCo for Windows
# Install MuJoCo Python package
pip install mujoco==3.1.3
# Download the MuJoCo binary release for Windows
# Create directory: C:\Users\YourName\.mujoco\
# Download from: https://github.com/google-deepmind/mujoco/releases
# Extract mujoco-3.1.3-windows-x86_64.zip to C:\Users\YourName\.mujoco\mujoco313
# Set environment variables (PowerShell)
[Environment]::SetEnvironmentVariable("MUJOCO_PATH", "$env:USERPROFILE\.mujoco\mujoco313", "User")
[Environment]::SetEnvironmentVariable("PATH", "$env:PATH;$env:USERPROFILE\.mujoco\mujoco313\bin", "User")
# Verify
python -c "import mujoco; print(mujoco.__version__)"
Step 4: Install OpenClaw
# Clone the repository
cd %USERPROFILE%\Documents
git clone https://github.com/openclaw-project/openclaw.git
cd openclaw
# Install OpenClaw
pip install -e ".[all]"
# If you encounter build errors, try installing dependencies separately:
pip install numpy scipy gymnasium stable-baselines3 tensorboard
pip install -e .
Step 5: Handle Windows-Specific Issues
Windows paths use backslashes, which can cause problems with Linux-oriented Python packages. Here are the common fixes:
# Fix 1: If OpenClaw has hardcoded Linux paths, set this environment variable
set OPENCLAW_ASSET_DIR=%cd%\assets
# Fix 2: For path separator issues in config files, use raw strings in Python
# Instead of: path = "C:\Users\name\data"
# Use: path = r"C:\Users\name\data"
# Or: path = "C:/Users/name/data" (forward slashes work in Python)
# Fix 3: Long path support (PowerShell as Admin)
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
# Fix 4: If you get DLL errors, install Visual C++ Redistributable
# Download from: https://aka.ms/vs/17/release/vc_redist.x64.exe
FileNotFoundError related to asset files, check whether the framework uses os.path.join() correctly. Some robotics frameworks assume a forward-slash path separator. Setting the OPENCLAW_ASSET_DIR environment variable with forward slashes often resolves these issues.
Step 6: Test the Installation
conda activate openclaw
python -c "
import openclaw
import torch
print(f'OpenClaw loaded')
print(f'PyTorch: {torch.__version__}')
print(f'CUDA: {torch.cuda.is_available()}')
if torch.cuda.is_available():
print(f'GPU: {torch.cuda.get_device_name(0)}')
env = openclaw.make('GraspCube-v1', render_mode='human')
obs, info = env.reset()
print(f'Environment created: obs shape = {obs.shape}')
env.close()
print('All good!')
"
Method 3: Docker on Windows
Docker provides the cleanest, most reproducible installation. Everything runs in an isolated container, so you cannot accidentally pollute your system Python or mess up CUDA versions. The trade-off is a slightly more complex setup for GPU passthrough and GUI forwarding.
Step 1: Install Docker Desktop
Download Docker Desktop from docker.com. During installation, ensure you select “Use WSL 2 instead of Hyper-V” as the backend. After installation:
# Verify Docker is working (PowerShell)
docker --version
docker run hello-world
# Enable GPU support — install NVIDIA Container Toolkit
# In your WSL2 Ubuntu terminal:
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt update
sudo apt install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
Verify GPU access from Docker:
docker run --rm --gpus all nvidia/cuda:12.4.0-base-ubuntu22.04 nvidia-smi
If you see your GPU listed in the output, Docker GPU passthrough is working.
Step 2: Create the OpenClaw Dockerfile
Create a file named Dockerfile.openclaw in your working directory:
# Dockerfile.openclaw
FROM nvidia/cuda:12.4.0-devel-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential cmake git wget curl unzip \
python3.10 python3.10-venv python3.10-dev python3-pip \
libgl1-mesa-dev libglu1-mesa-dev libglew-dev \
libosmesa6-dev libglfw3-dev patchelf \
xvfb x11-utils \
&& rm -rf /var/lib/apt/lists/*
# Set Python 3.10 as default
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
# Install MuJoCo
RUN mkdir -p /root/.mujoco && \
wget -q https://github.com/google-deepmind/mujoco/releases/download/3.1.3/mujoco-3.1.3-linux-x86_64.tar.gz && \
tar -xzf mujoco-3.1.3-linux-x86_64.tar.gz -C /root/.mujoco/ && \
mv /root/.mujoco/mujoco-3.1.3 /root/.mujoco/mujoco313 && \
rm mujoco-3.1.3-linux-x86_64.tar.gz
ENV MUJOCO_PATH=/root/.mujoco/mujoco313
ENV LD_LIBRARY_PATH=$MUJOCO_PATH/lib:$LD_LIBRARY_PATH
# Create workspace
WORKDIR /workspace
# Install Python packages
RUN pip install --upgrade pip setuptools wheel && \
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 && \
pip install mujoco==3.1.3
# Clone and install OpenClaw
RUN git clone https://github.com/openclaw-project/openclaw.git && \
cd openclaw && \
pip install -e ".[all]"
# Default command
CMD ["/bin/bash"]
Step 3: Build and Run the Container
# Build the Docker image (this takes 10-20 minutes)
docker build -f Dockerfile.openclaw -t openclaw:latest .
# Run with GPU support and volume mount for saving experiments
docker run -it --gpus all \
-v ${PWD}/experiments:/workspace/experiments \
-v ${PWD}/configs:/workspace/configs \
--name openclaw-dev \
openclaw:latest
# For GUI support (renders to a virtual display, saves videos)
docker run -it --gpus all \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v ${PWD}/experiments:/workspace/experiments \
--name openclaw-gui \
openclaw:latest
If you need headless rendering (no display), use Xvfb:
# Inside the container
Xvfb :1 -screen 0 1024x768x24 &
export DISPLAY=:1
# Now rendering commands will work headlessly
python -m openclaw.demo --env GraspCube-v1 --record-video output.mp4
Step 4: Daily Workflow with Docker
# Start an existing stopped container
docker start -ai openclaw-dev
# Run a training job in the background
docker exec -d openclaw-dev python -m openclaw.train \
--config configs/grasp_cube.yaml \
--output experiments/run_001
# Check training logs
docker exec openclaw-dev tail -f experiments/run_001/train.log
# Copy results out of the container
docker cp openclaw-dev:/workspace/experiments/run_001 ./local_results/
Running Your First Experiments
With OpenClaw installed (via any method), let us explore what it can do. OpenClaw ships with several pre-built environments covering a range of manipulation tasks.
Exploring Available Environments
import openclaw
# List all registered environments
envs = openclaw.list_environments()
for env_name in envs:
print(env_name)
Typical environments include tasks like:
| Environment | Task Description | Difficulty |
|---|---|---|
GraspCube-v1 |
Pick up a cube with a dexterous hand | Beginner |
RotateBlock-v1 |
In-hand rotation of a block to target orientation | Intermediate |
StackBlocks-v1 |
Stack two blocks on top of each other | Advanced |
InsertPeg-v1 |
Insert a peg into a hole with tight tolerance | Advanced |
OpenDrawer-v1 |
Pull open a drawer using the handle | Intermediate |
Loading and Interacting with an Environment
import openclaw
import numpy as np
# Create the environment with visual rendering
env = openclaw.make('GraspCube-v1', render_mode='human')
# Reset and inspect the observation
obs, info = env.reset(seed=42)
print(f"Observation shape: {obs.shape}")
print(f"Observation range: [{obs.min():.3f}, {obs.max():.3f}]")
print(f"Action space: {env.action_space}")
print(f"Action range: [{env.action_space.low.min():.1f}, {env.action_space.high.max():.1f}]")
# Run random actions for 500 steps
total_reward = 0
for step in range(500):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
total_reward += reward
if terminated or truncated:
print(f"Episode ended at step {step}, total reward: {total_reward:.2f}")
obs, info = env.reset()
total_reward = 0
env.close()
Recording Simulation Videos
For sharing results or debugging policies, recording videos is essential:
import openclaw
from gymnasium.wrappers import RecordVideo
# Wrap the environment with video recording
env = openclaw.make('GraspCube-v1', render_mode='rgb_array')
env = RecordVideo(env, video_folder='./videos', episode_trigger=lambda e: True)
obs, info = env.reset()
for step in range(1000):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
obs, info = env.reset()
env.close()
print("Video saved to ./videos/")
Evaluating a Pre-trained Model
OpenClaw typically includes pre-trained checkpoints for benchmarking:
from stable_baselines3 import PPO
import openclaw
# Load a pre-trained model (if available in the repo)
model = PPO.load("pretrained/grasp_cube_ppo.zip")
env = openclaw.make('GraspCube-v1', render_mode='human')
obs, info = env.reset()
total_reward = 0
episode_count = 0
for step in range(5000):
action, _states = model.predict(obs, deterministic=True)
obs, reward, terminated, truncated, info = env.step(action)
total_reward += reward
if terminated or truncated:
episode_count += 1
print(f"Episode {episode_count}: reward = {total_reward:.2f}")
total_reward = 0
obs, info = env.reset()
env.close()
print(f"Evaluated {episode_count} episodes")
Understanding the Config System
OpenClaw uses YAML configuration files to define environments, training hyperparameters, and experiment settings. This makes it easy to reproduce results and tweak parameters without changing code:
# Example: configs/grasp_cube.yaml
environment:
name: GraspCube-v1
max_episode_steps: 200
reward_type: dense # 'dense' or 'sparse'
obs_type: state # 'state', 'pixels', or 'state+pixels'
robot:
hand_type: shadow_hand
control_mode: position # 'position', 'velocity', or 'torque'
action_scale: 0.05
object:
type: cube
size: [0.04, 0.04, 0.04]
mass: 0.1
friction: [1.0, 0.005, 0.0001]
simulation:
physics_timestep: 0.002
control_timestep: 0.02 # 50 Hz control
num_substeps: 10
gravity: [0, 0, -9.81]
Training Your First Policy
Now for the exciting part — training a neural network to control a robotic hand. We will use Stable Baselines3’s PPO (Proximal Policy Optimization) algorithm, which is widely used in robotic manipulation research.
Setting Up the Training Script
Create a file called train_grasp.py:
"""
Train a PPO agent to grasp a cube using OpenClaw.
"""
import os
import argparse
from datetime import datetime
import openclaw
from stable_baselines3 import PPO
from stable_baselines3.common.vec_env import SubprocVecEnv, VecMonitor
from stable_baselines3.common.callbacks import (
EvalCallback,
CheckpointCallback,
CallbackList,
)
def make_env(env_id, rank, seed=0):
"""Create a wrapped environment for vectorized training."""
def _init():
env = openclaw.make(env_id)
env.reset(seed=seed + rank)
return env
return _init
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--env', default='GraspCube-v1', help='Environment ID')
parser.add_argument('--num-envs', type=int, default=8, help='Parallel envs')
parser.add_argument('--total-timesteps', type=int, default=2_000_000)
parser.add_argument('--output-dir', default='./experiments')
parser.add_argument('--seed', type=int, default=42)
args = parser.parse_args()
# Create experiment directory
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
exp_dir = os.path.join(args.output_dir, f'{args.env}_{timestamp}')
os.makedirs(exp_dir, exist_ok=True)
# Create vectorized training environments
train_envs = SubprocVecEnv([
make_env(args.env, i, args.seed) for i in range(args.num_envs)
])
train_envs = VecMonitor(train_envs, os.path.join(exp_dir, 'monitor'))
# Create evaluation environment
eval_env = SubprocVecEnv([make_env(args.env, 0, args.seed + 1000)])
eval_env = VecMonitor(eval_env)
# Configure PPO
model = PPO(
policy='MlpPolicy',
env=train_envs,
learning_rate=3e-4,
n_steps=2048,
batch_size=256,
n_epochs=10,
gamma=0.99,
gae_lambda=0.95,
clip_range=0.2,
ent_coef=0.01,
vf_coef=0.5,
max_grad_norm=0.5,
verbose=1,
seed=args.seed,
tensorboard_log=os.path.join(exp_dir, 'tensorboard'),
device='cuda',
)
# Set up callbacks
eval_callback = EvalCallback(
eval_env,
best_model_save_path=os.path.join(exp_dir, 'best_model'),
log_path=os.path.join(exp_dir, 'eval_logs'),
eval_freq=10_000,
n_eval_episodes=10,
deterministic=True,
)
checkpoint_callback = CheckpointCallback(
save_freq=50_000,
save_path=os.path.join(exp_dir, 'checkpoints'),
name_prefix='ppo_grasp',
)
callbacks = CallbackList([eval_callback, checkpoint_callback])
# Train!
print(f"Starting training: {args.total_timesteps} timesteps")
print(f"Experiment directory: {exp_dir}")
model.learn(
total_timesteps=args.total_timesteps,
callback=callbacks,
progress_bar=True,
)
# Save final model
model.save(os.path.join(exp_dir, 'final_model'))
print(f"Training complete! Model saved to {exp_dir}")
# Cleanup
train_envs.close()
eval_env.close()
if __name__ == '__main__':
main()
Launch Training
# Basic training run
python train_grasp.py --env GraspCube-v1 --total-timesteps 2000000
# With more parallel environments (faster on multi-core CPUs)
python train_grasp.py --env GraspCube-v1 --num-envs 16 --total-timesteps 5000000
# For a quick test run
python train_grasp.py --env GraspCube-v1 --num-envs 4 --total-timesteps 50000
Monitor Training with TensorBoard
Open a separate terminal while training runs:
# Install TensorBoard if not already installed
pip install tensorboard
# Launch TensorBoard
tensorboard --logdir ./experiments --port 6006
# Open in your browser: http://localhost:6006
Key metrics to watch during training:
- ep_rew_mean: Average episode reward — this should generally trend upward
- ep_len_mean: Average episode length — shorter can mean the agent achieves the goal faster
- loss/policy_loss: Should decrease and stabilize
- loss/value_loss: Should decrease over time
- explained_variance: Should approach 1.0 as training progresses
Evaluate Your Trained Agent
from stable_baselines3 import PPO
import openclaw
import numpy as np
# Load the best model from training
model = PPO.load("experiments/GraspCube-v1_YYYYMMDD_HHMMSS/best_model/best_model")
env = openclaw.make('GraspCube-v1', render_mode='human')
rewards = []
for episode in range(20):
obs, info = env.reset()
episode_reward = 0
done = False
while not done:
action, _ = model.predict(obs, deterministic=True)
obs, reward, terminated, truncated, info = env.step(action)
episode_reward += reward
done = terminated or truncated
rewards.append(episode_reward)
print(f"Episode {episode + 1}: reward = {episode_reward:.2f}")
env.close()
print(f"\nMean reward: {np.mean(rewards):.2f} +/- {np.std(rewards):.2f}")
GPU Acceleration and Performance Tips
Getting the most out of your GPU can dramatically speed up training. Here is how to verify, optimize, and benchmark your setup.
CUDA Setup Verification
# Comprehensive CUDA check script
python -c "
import torch
import subprocess
print('=== CUDA Diagnostics ===')
print(f'PyTorch version: {torch.__version__}')
print(f'CUDA available: {torch.cuda.is_available()}')
print(f'CUDA version (PyTorch): {torch.version.cuda}')
print(f'cuDNN version: {torch.backends.cudnn.version()}')
print(f'cuDNN enabled: {torch.backends.cudnn.enabled}')
if torch.cuda.is_available():
print(f'GPU count: {torch.cuda.device_count()}')
for i in range(torch.cuda.device_count()):
props = torch.cuda.get_device_properties(i)
print(f' GPU {i}: {props.name}')
print(f' Memory: {props.total_mem / 1024**3:.1f} GB')
print(f' Compute capability: {props.major}.{props.minor}')
print(f' Multi-processors: {props.multi_processor_count}')
# Quick benchmark
print('\n=== Quick Benchmark ===')
x = torch.randn(10000, 10000, device='cuda')
import time
start = time.time()
for _ in range(100):
y = torch.mm(x, x)
torch.cuda.synchronize()
elapsed = time.time() - start
print(f'100x matrix multiply (10000x10000): {elapsed:.2f}s')
print(f'TFLOPS estimate: {100 * 2 * 10000**3 / elapsed / 1e12:.1f}')
"
Optimizing Batch Sizes
The right batch size depends on your GPU’s VRAM. Here is a general guideline:
| GPU VRAM | Recommended Batch Size | Parallel Envs | Expected Throughput |
|---|---|---|---|
| 6 GB (RTX 3060) | 128 | 4-8 | ~2,000 steps/sec |
| 8 GB (RTX 3070/4060) | 256 | 8-12 | ~3,500 steps/sec |
| 12 GB (RTX 3060 12GB/4070) | 512 | 12-16 | ~5,000 steps/sec |
| 16 GB+ (RTX 4080/4090) | 1024 | 16-32 | ~10,000+ steps/sec |
WSL2 vs Native Performance Comparison
Based on typical benchmarks, here is how the three installation methods compare:
| Metric | WSL2 | Native Windows | Docker (WSL2 backend) |
|---|---|---|---|
| GPU compute | 98-100% of native Linux | 95-100% | 97-100% |
| Disk I/O | 60-70% (cross-filesystem) | 100% (native NTFS) | 50-65% (overlay) |
| Linux compatibility | Excellent | Partial | Full |
| Setup complexity | Medium | Low | Medium-High |
| GUI rendering | WSLg (built-in) | Native | Requires forwarding |
| Reproducibility | Good | Fair | Excellent |
~/) rather than on /mnt/c/ to avoid the disk I/O penalty.
Memory Management Tips
# Monitor GPU memory during training
watch -n 1 nvidia-smi
# In Python, check memory usage:
import torch
print(f"Allocated: {torch.cuda.memory_allocated() / 1024**3:.2f} GB")
print(f"Cached: {torch.cuda.memory_reserved() / 1024**3:.2f} GB")
# Free GPU cache if needed
torch.cuda.empty_cache()
# Limit WSL2 memory usage by creating .wslconfig
# Create/edit: C:\Users\YourName\.wslconfig
Create or edit C:\Users\YourName\.wslconfig to control WSL2’s resource usage:
[wsl2]
memory=16GB # Limit WSL2 RAM (default: 50% of system RAM)
processors=8 # Limit CPU cores
swap=8GB # Swap file size
localhostForwarding=true
Multi-GPU Training Setup
If you are fortunate enough to have multiple GPUs, OpenClaw combined with Stable Baselines3 can leverage them:
# Check available GPUs
python -c "
import torch
for i in range(torch.cuda.device_count()):
print(f'GPU {i}: {torch.cuda.get_device_name(i)}')
"
# To use a specific GPU
CUDA_VISIBLE_DEVICES=1 python train_grasp.py
# For multi-GPU with data parallelism, modify the training script:
# model = PPO(..., device='cuda:0')
# Or use torch.nn.DataParallel for custom architectures
Troubleshooting Common Windows Issues
If you have made it this far, you probably have OpenClaw running. But robotics simulation frameworks are complex beasts, and things do go wrong. Here are the most common issues and their solutions:
| Error | Cause | Solution |
|---|---|---|
CUDA not found in WSL2 |
Windows NVIDIA driver too old or CUDA toolkit not installed in WSL2 | Update Windows NVIDIA driver to 525+, install cuda-toolkit-12-4 in WSL2 (not the full driver) |
GLFWError: API unavailable |
MuJoCo cannot create an OpenGL context | Install libosmesa6-dev, set MUJOCO_GL=osmesa for headless, or fix WSLg |
EGL error / rendering fails |
Missing EGL/Mesa libraries | Run: sudo apt install -y libegl1-mesa-dev libgles2-mesa-dev |
Permission denied errors |
File permissions mismatch between Windows and WSL2 | Work in ~/ not /mnt/c/; run chmod +x on scripts |
DLL load failed (native Windows) |
Missing Visual C++ Redistributable or wrong CUDA DLLs | Install VC++ Redist; verify CUDA PATH order |
| WSLg display not working | WSL not updated or Wayland issue | Run wsl --update in PowerShell; try export DISPLAY=:0 |
CUDA out of memory |
Batch size too large or memory leak | Reduce batch size, reduce num_envs, call torch.cuda.empty_cache() |
| Python version conflicts | System Python interfering with venv/conda | Always activate your venv/conda env; use which python to verify |
ModuleNotFoundError: mujoco |
MuJoCo not installed in the active environment | Activate your venv/conda, then pip install mujoco==3.1.3 |
subprocess-exited-with-error during pip install |
Missing build dependencies | Install build-essential cmake (WSL2) or Visual Studio Build Tools (Windows) |
Detailed Fix: MuJoCo Rendering in WSL2
Rendering is the number one source of headaches. Here is a systematic approach to fixing it:
# Step 1: Check if WSLg is running
ls /tmp/.X11-unix/
# Should list at least X0 or X1
# Step 2: Check DISPLAY variable
echo $DISPLAY
# Should be something like :0 or :1
# Step 3: Test with a simple OpenGL app
sudo apt install -y mesa-utils
glxinfo | head -20
# Should show "direct rendering: Yes" for GPU acceleration
# Step 4: If rendering still fails, try different backends
export MUJOCO_GL=egl # Hardware EGL (preferred)
# or
export MUJOCO_GL=osmesa # Software rendering (slower but always works)
# or
export MUJOCO_GL=glfw # GLFW (requires display)
# Step 5: Test MuJoCo rendering
python -c "
import mujoco
import numpy as np
model = mujoco.MjModel.from_xml_string(' ')
data = mujoco.MjData(model)
renderer = mujoco.Renderer(model, height=480, width=640)
mujoco.mj_step(model, data)
renderer.update_scene(data)
pixels = renderer.render()
print(f'Rendered frame: {pixels.shape}') # Should be (480, 640, 3)
print('Rendering works!')
"
MUJOCO_GL backends, restart your Python session completely. MuJoCo initializes the rendering backend on first import and caches it.
Integration with VS Code
VS Code is the ideal editor for OpenClaw development, especially when using WSL2. Microsoft’s WSL extension makes it feel like you are working natively on Linux while your editor runs on Windows.
Setting Up VS Code with WSL2
# Install the WSL extension in VS Code (from Windows)
# 1. Open VS Code
# 2. Go to Extensions (Ctrl+Shift+X)
# 3. Search for "WSL" by Microsoft
# 4. Click Install
# Open your OpenClaw project from WSL2
cd ~/robotics/openclaw
code .
This command opens VS Code on Windows but connects it to your WSL2 filesystem. The terminal inside VS Code will be your WSL2 bash shell, and all file operations happen on the Linux filesystem — giving you the best of both worlds.
Setting Up Debugging
Create a launch configuration at .vscode/launch.json in your project:
{
"version": "0.2.0",
"configurations": [
{
"name": "Train GraspCube",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/train_grasp.py",
"args": ["--env", "GraspCube-v1", "--total-timesteps", "10000"],
"console": "integratedTerminal",
"env": {
"CUDA_VISIBLE_DEVICES": "0",
"MUJOCO_GL": "egl"
},
"python": "${workspaceFolder}/venv/bin/python"
},
{
"name": "Debug Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"python": "${workspaceFolder}/venv/bin/python"
},
{
"name": "Evaluate Model",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/evaluate.py",
"args": ["--model", "experiments/best_model/best_model.zip"],
"console": "integratedTerminal",
"python": "${workspaceFolder}/venv/bin/python"
}
]
}
Recommended Extensions for Robotics Development
- Python (Microsoft): Core Python support with IntelliSense, linting, and debugging
- Pylance: Fast, feature-rich Python language server
- WSL (Microsoft): Seamless WSL2 integration
- Jupyter: For interactive experimentation and visualization
- GitLens: Enhanced Git integration for tracking changes
- YAML: Syntax highlighting for OpenClaw config files
- Docker (Microsoft): If using the Docker installation method
- Remote – SSH: For connecting to remote training servers
- Error Lens: Inline error display — catches issues before running
Workspace Settings
Create .vscode/settings.json for project-specific configuration:
{
"python.defaultInterpreterPath": "${workspaceFolder}/venv/bin/python",
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.formatting.provider": "black",
"python.formatting.blackArgs": ["--line-length", "100"],
"editor.formatOnSave": true,
"editor.rulers": [100],
"files.exclude": {
"**/__pycache__": true,
"**/*.pyc": true,
"**/experiments/*/checkpoints": true
},
"terminal.integrated.env.linux": {
"MUJOCO_GL": "egl",
"CUDA_VISIBLE_DEVICES": "0"
}
}
Next Steps and Resources
You now have a fully functional OpenClaw installation on Windows 11. Here are the paths you can explore next.
Building Custom Environments
OpenClaw’s environment API follows the Gymnasium standard, making it straightforward to create your own tasks:
import openclaw
from openclaw.envs import BaseManipulationEnv
class MyCustomTask(BaseManipulationEnv):
"""Custom manipulation task with your own reward function."""
def __init__(self, **kwargs):
super().__init__(
model_path="path/to/your/model.xml",
**kwargs
)
def _get_obs(self):
# Define your observation space
return {
'robot_state': self._get_robot_state(),
'object_state': self._get_object_state(),
'goal': self._get_goal(),
}
def _compute_reward(self, achieved_goal, desired_goal, info):
# Define your reward function
distance = np.linalg.norm(achieved_goal - desired_goal)
return -distance # Dense reward: minimize distance
def _check_success(self, achieved_goal, desired_goal):
distance = np.linalg.norm(achieved_goal - desired_goal)
return distance < 0.05 # 5cm threshold
# Register the environment
openclaw.register(
id='MyCustomTask-v1',
entry_point='my_envs:MyCustomTask',
max_episode_steps=200,
)
Sim-to-Real Transfer Basics
The ultimate goal of simulation training is deploying policies on real robots. Key techniques include:
- Domain randomization: Vary physics parameters (friction, mass, damping) during training so the policy generalizes
- System identification: Measure your real robot's parameters and match them in simulation
- Asymmetric actor-critic: Give the critic access to privileged simulation information while the actor only uses real-world-available observations
- Progressive transfer: Start with simple tasks and gradually increase complexity
Contributing to OpenClaw
Open-source robotics thrives on community contributions. Here is how to get involved:
- Report bugs through GitHub Issues with detailed reproduction steps
- Contribute new environments for different manipulation tasks
- Improve Windows compatibility (your experience setting this up is valuable)
- Write documentation and tutorials
- Share trained models and benchmarks
Community and Learning Resources
- OpenClaw GitHub: Source code, issues, and discussions
- MuJoCo Documentation: mujoco.readthedocs.io — essential for understanding the physics engine
- Stable Baselines3 Docs: stable-baselines3.readthedocs.io — RL algorithm reference
- Gymnasium API: gymnasium.farama.org — environment interface standard
- Robotic Manipulation Course (MIT 6.881): Excellent free lectures on manipulation theory
- DeepMind Control Suite: Related environment suite for continuous control
- Papers: Search for "dexterous manipulation reinforcement learning" on arXiv for the latest research
Conclusion
Setting up a robotics AI framework on Windows 11 used to require either a dual-boot Linux partition or hours of wrestling with incompatible dependencies. That era is over. With WSL2 providing near-native Linux performance, Conda offering cross-platform package management, and Docker delivering reproducible containers, Windows 11 is now a first-class platform for robotics simulation research.
In this guide, we covered three complete installation paths for OpenClaw. The WSL2 method offers the best balance of compatibility and performance — it is what I recommend for most users. The native Conda approach works for simpler use cases when you want to avoid WSL2 entirely. And Docker is the right choice when reproducibility matters most, especially in team environments.
We went beyond basic installation to cover the full workflow: running environments, training reinforcement learning policies with PPO, monitoring with TensorBoard, optimizing GPU performance, and debugging the most common Windows-specific issues. We also set up VS Code for a professional development experience.
The field of robotic manipulation is advancing rapidly. Frameworks like OpenClaw make it possible to experiment with cutting-edge algorithms without access to physical robots. Your Windows 11 machine, equipped with a decent NVIDIA GPU, is all you need to start training policies that could one day run on real robotic hands.
The gap between simulation and reality is narrowing every year. Start experimenting, break things, train agents that fail spectacularly at first and then gradually succeed — that is the process. Your Windows 11 setup is ready. The only thing left is to start building.
References
- MuJoCo Documentation — mujoco.readthedocs.io
- Stable Baselines3 Documentation — stable-baselines3.readthedocs.io
- Microsoft WSL2 Documentation — learn.microsoft.com/en-us/windows/wsl/
- NVIDIA CUDA on WSL — docs.nvidia.com/cuda/wsl-user-guide/
- NVIDIA Container Toolkit — docs.nvidia.com/datacenter/cloud-native/container-toolkit/
- Docker Desktop for Windows — docs.docker.com/desktop/install/windows-install/
- Gymnasium API Reference — gymnasium.farama.org
- Schulman, J., et al. "Proximal Policy Optimization Algorithms." arXiv:1707.06347 (2017)
- OpenAI. "Learning Dexterous In-Hand Manipulation." arXiv:1808.00177 (2018)
- Todorov, E., Erez, T., Tassa, Y. "MuJoCo: A physics engine for model-based control." IROS 2012
Leave a Reply