Home AI/ML How to Install and Use OpenClaw on Windows 11: A Complete Setup Guide

How to Install and Use OpenClaw on Windows 11: A Complete Setup Guide

Last updated: May 27, 2026
k
Published April 4, 2026 · Updated May 27, 2026 · 31 min read

Summary

What this post covers: Three end-to-end installation paths — WSL2, native Windows + Conda, and Docker — for running the OpenClaw robotic-manipulation framework on Windows 11, including GPU acceleration, your first training run, and Windows-specific troubleshooting.

Key insights:

  • WSL2 with Ubuntu 22.04 is the recommended approach for most Windows 11 users — it delivers near-native Linux performance, supports the full CUDA toolkit, and avoids the dependency rot that plagues native Conda installs of MuJoCo on Windows.
  • Native Windows + Conda works but requires specific pinned versions of MuJoCo bindings and Visual C++ build tools; expect to spend extra time on environment debugging compared to WSL2.
  • Docker offers the most reproducible setup but adds GPU passthrough complexity (NVIDIA Container Toolkit on WSL2 backend) and slower disk I/O for large training checkpoints.
  • GPU acceleration through CUDA delivers roughly 10–50x training-throughput speedups over CPU-only runs; verifying nvidia-smi visibility inside WSL2 before installing PyTorch saves hours of confused debugging.
  • The most common Windows-specific failures are X11/display issues for the MuJoCo viewer (fixable via WSLg or VcXsrv), path conflicts between Windows and WSL2 home directories, and DLL load errors from mismatched CUDA versions.

Main topics: Introduction, System Requirements, Method 1: WSL2 (Recommended Approach), Method 2: Native Windows with Conda, Method 3: Docker on Windows, Running Your First Experiments, Training Your First Policy, GPU Acceleration and Performance Tips, Troubleshooting Common Windows Issues, Integration with VS Code, Next Steps and Resources, Final Thoughts, References.

Introduction

An often-overlooked fact: more than 70 percent of AI researchers and robotics students operate Windows as their primary operating system, yet almost every serious robotics simulation framework ships with Linux-first documentation and Linux-only installation scripts. Anyone who has examined a GitHub README full of apt-get commands and wondered whether a Windows 11 machine could participate is familiar with the difficulty.

OpenClaw is an open-source robotic manipulation framework designed for AI research. It provides a rich set of simulated environments for dexterous manipulation tasks, including robotic hands grasping objects, assembling parts and performing precise movements that test the limits of reinforcement learning. Built on top of MuJoCo, which is now free and open source, and compatible with widely used RL libraries such as Stable Baselines3, OpenClaw has rapidly become a preferred toolkit for researchers working on manipulation policies.

The complication is that, like most robotics frameworks, OpenClaw was developed with Linux in mind. The official documentation assumes Ubuntu, the CI pipelines test on Linux, and many convenience scripts are written in bash. For the Windows 11 user, getting OpenClaw running can feel like assembling a puzzle with several missing pieces.

This guide addresses that gap. The following sections present three complete installation methods, WSL2, native Windows with Conda, and Docker, each with full command-by-command instructions. By the end, the reader will have OpenClaw running on a Windows 11 machine, will have trained an initial manipulation policy, and will be able to visualise robotic simulations with full GPU acceleration. A Linux dual-boot is not required.

Windows 11 OpenClaw Software Stack Windows 11 WSL2 (Windows Subsystem for Linux) Ubuntu 22.04 + CUDA Toolkit MuJoCo Physics Engine OpenClaw

Key Takeaway: Working with current robotics AI frameworks does not require abandoning Windows 11. With WSL2, Conda or Docker, OpenClaw can be run with full GPU acceleration directly from a Windows desktop.

System Requirements

Before proceeding to installation, the machine should be verified as adequate to the task. OpenClaw runs physics simulations and neural network training simultaneously, which requires substantial computational capacity. The required specifications are summarised below.

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 is selected, the following items should be prepared in advance.

  • 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 the current NVIDIA driver version, open PowerShell and run the following.

nvidia-smi

The output should display the driver version and CUDA version. If the command fails, NVIDIA drivers should be installed or updated before proceeding.

Caution: AMD GPUs are not supported for CUDA-accelerated training. Users with AMD GPUs may follow this guide for CPU-only training, but performance will be substantially slower. ROCm support on Windows remains limited for most ML frameworks.

Method 1: WSL2 (Recommended Approach)

WSL2 (Windows Subsystem for Linux 2) is the preferred mechanism for running Linux-native tools on Windows. It provides a real Linux kernel, full system call compatibility and, critically for this purpose, native GPU passthrough. NVIDIA GPUs therefore operate inside WSL2 at near-native performance. For OpenClaw, this is the recommended path because it offers complete Linux compatibility without the operational difficulties of dual-booting.

WSL2 Installation Workflow Prerequisites GPU Driver, Git WSL2 + Ubuntu wsl –install CUDA + MuJoCo Toolkit & Physics OpenClaw Install pip install -e. Verify & Run python -c import Step 1 Step 2 Steps 3–4 Step 5 Steps 6–7

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 the computer. When Ubuntu is opened from the Start menu for the first time, the user is prompted to create a username and password. A simple credential should be chosen, since it will be entered 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 the Ubuntu terminal (either from the Start menu or by typing wsl in PowerShell) and run the following commands.

# 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 step that most often causes difficulty. The key point is that NVIDIA drivers must not be installed inside WSL2. The Windows host drivers handle GPU communication. Only the CUDA toolkit is required inside WSL2.

Caution: The nvidia-driver package should NOT be installed inside WSL2. The Windows host driver is shared with WSL2 automatically. Installing a Linux driver inside WSL2 will disable GPU support.
# 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 displays GPU information drawn from the Windows host driver, and nvcc --version confirms that the CUDA compiler is installed.

Step 4: Install MuJoCo

OpenClaw uses MuJoCo as its physics simulation backend. Since DeepMind released MuJoCo as free and open-source software, installation has become substantially 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 &
Tip: If the MuJoCo viewer opens and displays an animated humanoid, GPU passthrough and graphics rendering are functioning correctly inside WSL2.

Step 5: Clone and Install OpenClaw

The next step is to 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 that the installation completed successfully.

# 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 causes graphical applications to operate transparently in most cases. On Windows 11 22H2 or later, GUI forwarding should be automatic. The setup can be verified as follows.

# 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 functioning, an X server can be used as a fallback.

# 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 a simulation window appears in which a robotic hand attempts to grasp a cube, even clumsily, the installation is functioning correctly. OpenClaw is now installed on Windows 11 via WSL2.

Method 2: Native Windows with Conda

Users who prefer to remain entirely within the Windows ecosystem without WSL2 may install OpenClaw natively using Conda. The approach functions but carries certain caveats: some features may require additional configuration, and Windows-specific path issues may arise. For many use cases, however, it works reliably.

Step 1: Install Miniconda

Download and install Miniconda from docs.conda.io. Select the Windows 64-bit installer. During installation:

  • install for “Just Me” (recommended);
  • check “Add Miniconda to my PATH” (despite the warning, this simplifies subsequent steps);
  • check “Register Miniconda as the default Python”.

Open a new Anaconda Prompt or PowerShell session and verify the installation.

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 create problems with Linux-oriented Python packages. The common fixes are as follows.

# 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
Tip: If a FileNotFoundError related to asset files arises, 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 and most reproducible installation. All components run in an isolated container, which prevents accidental pollution of the system Python environment or CUDA versions. The trade-off is somewhat more involved setup for GPU passthrough and GUI forwarding.

Step 1: Install Docker Desktop

Download Docker Desktop from docker.com. During installation, ensure that “Use WSL 2 instead of Hyper-V” is selected 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 the GPU is listed in the output, Docker GPU passthrough is functioning.

Step 2: Create the OpenClaw Dockerfile

Create a file named Dockerfile.openclaw in the 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

For headless rendering (no display), Xvfb may be used.

# 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/
Key Takeaway: Docker is well suited to reproducibility. Once the image builds successfully, it can be shared with collaborators and guarantees identical environments. The overhead is minimal: GPU performance in Docker matches native performance within 1 to 2 percent.

Running Your First Experiments

With OpenClaw installed via any of the methods above, the framework’s capabilities can now be explored. 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 the following tasks.

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 simplifies reproduction of results and adjustment of parameters without modifying 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

The next step is training a neural network to control a robotic hand. The following example uses Stable Baselines3’s PPO (Proximal Policy Optimisation) 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 is running.

# 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 monitor during training are as follows.

  • 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
Tip: For the GraspCube-v1 task, meaningful improvement should appear within 500,000 to 1 million timesteps. If the reward curve remains completely flat after one million steps, the environment configuration and reward function should be checked. Dense rewards converge substantially faster than sparse rewards for beginners.

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

Maximising GPU utilisation can substantially accelerate training. The following sections describe verification, optimisation and benchmarking procedures.

System Architecture: Windows ↔ WSL2 ↔ MuJoCo ↔ OpenClaw Windows 11 Host NVIDIA GPU (CUDA) Display / WSLg GPU Driver v525+ WSL2 / Ubuntu Linux Kernel 5.15+ CUDA Toolkit 12.4 Python 3.10 venv MuJoCo 3.x Physics Simulation OpenGL Rendering Contact Dynamics OpenClaw Gym Environments RL Training (PPO) Policy Evaluation GPU Hardware Linux Layer Sim Engine AI Framework

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 appropriate batch size depends on the available GPU VRAM. The following table provides 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, the three installation methods compare as follows.

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

 

Key Takeaway: For most users, WSL2 offers the best balance of performance, compatibility and ease of use. Project files should be kept on the Linux filesystem (inside ~/) rather than on /mnt/c/ in order 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

For systems with multiple GPUs, OpenClaw combined with Stable Baselines3 can use them as follows.

# 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 the preceding steps have been completed, OpenClaw is most likely running. Robotics simulation frameworks are complex systems, however, and failures do occur. The most common issues and their solutions are summarised below.

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 most frequent source of difficulty. A systematic approach to resolving it is presented below.

# 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!')
"
Caution: When switching between MUJOCO_GL backends, the Python session should be restarted completely. MuJoCo initialises the rendering backend on first import and caches it.

Integration with VS Code

VS Code is well suited to OpenClaw development, particularly when using WSL2. Microsoft’s WSL extension provides a native-Linux working experience while the editor itself 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 the WSL2 filesystem. The terminal inside VS Code uses the WSL2 bash shell, and all file operations occur on the Linux filesystem, combining the advantages of both environments.

Setting Up Debugging

Create a launch configuration at .vscode/launch.json in the 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

A fully functional OpenClaw installation on Windows 11 is now in place. The following directions may be explored next.

Building Custom Environments

OpenClaw’s environment API follows the Gymnasium standard, which makes the creation of custom tasks straightforward.

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 the deployment of policies on real robots. Key techniques include the following.

  • Domain randomisation: vary physics parameters (friction, mass, damping) during training so that the policy generalises.
  • System identification: measure the real robot's parameters and match them in simulation.
  • Asymmetric actor-critic: grant the critic access to privileged simulation information while the actor uses only observations available in the real world.
  • Progressive transfer: begin with simple tasks and increase complexity incrementally.

Contributing to OpenClaw

Open-source robotics depends on community contributions. The following avenues for involvement are particularly useful.

  • Report bugs through GitHub Issues with detailed reproduction steps.
  • Contribute new environments for additional manipulation tasks.
  • Improve Windows compatibility, given that the experience of completing this setup is itself valuable.
  • Write documentation and tutorials.
  • Share trained models and benchmark results.

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

Final Thoughts

Setting up a robotics AI framework on Windows 11 once required either a dual-boot Linux partition or hours of work resolving incompatible dependencies. That period has ended. 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.

This guide has covered three complete installation paths for OpenClaw. The WSL2 method offers the best balance of compatibility and performance and is recommended for most users. The native Conda approach is appropriate for simpler use cases in which WSL2 should be avoided entirely. Docker is the appropriate choice when reproducibility is paramount, particularly in team environments.

The discussion has extended beyond basic installation to cover the complete workflow: running environments, training reinforcement learning policies with PPO, monitoring with TensorBoard, optimising GPU performance, and resolving the most common Windows-specific issues. VS Code has also been configured for a professional development experience.

The field of robotic manipulation is advancing rapidly. Frameworks such as OpenClaw permit experimentation with recent algorithms without access to physical robots. A Windows 11 machine equipped with a reasonable NVIDIA GPU is sufficient to begin training policies that may eventually run on real robotic hands.

The gap between simulation and reality continues to narrow each year. The path forward involves experimenting, accepting initial failures, and training agents that progress from clumsy attempts to reliable performance. The Windows 11 setup is now prepared, and only the work itself remains.

Key Takeaway: Windows 11 with WSL2 provides a near-seamless experience for running Linux-native robotics frameworks. With the installation steps in this guide, the path from a fresh Windows machine to training robotic manipulation policies can be completed in under an hour.

References

  1. MuJoCo Documentation—mujoco.readthedocs.io
  2. Stable Baselines3 Documentation—stable-baselines3.readthedocs.io
  3. Microsoft WSL2 Documentation,learn.microsoft.com/en-us/windows/wsl/
  4. NVIDIA CUDA on WSL—docs.nvidia.com/cuda/wsl-user-guide/
  5. NVIDIA Container Toolkit—docs.nvidia.com/datacenter/cloud-native/container-toolkit/
  6. Docker Desktop for Windows,docs.docker.com/desktop/install/windows-install/
  7. Gymnasium API Reference—gymnasium.farama.org
  8. Schulman, J., et al. "Proximal Policy Optimization Algorithms." arXiv:1707.06347 (2017)
  9. OpenAI. "Learning Dexterous In-Hand Manipulation." arXiv:1808.00177 (2018)
  10. Todorov, E., Erez, T., Tassa, Y. "MuJoCo: A physics engine for model-based control." IROS 2012

You Might Also Like

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *