# Installation This guide covers installing GenesisLab and its dependencies. ## System Requirements ### Hardware - **GPU**: NVIDIA GPU with CUDA support (RTX 2070 or better recommended) - **RAM**: 16GB minimum, 32GB+ recommended for large-scale training - **Storage**: 10GB for software and assets ### Software - **OS**: Linux (Ubuntu 20.04+), macOS, or Windows - **Python**: 3.8 or higher - **CUDA**: 11.8 or higher (for GPU support) ## Installation Steps ### 1. Install PyTorch First, install PyTorch with CUDA support: ```bash # For CUDA 11.8 pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 # For CUDA 12.1 pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 ``` Verify installation: ```python import torch print(f"PyTorch version: {torch.__version__}") print(f"CUDA available: {torch.cuda.is_available()}") print(f"CUDA version: {torch.version.cuda}") ``` ### 2. Install Genesis Install the Genesis physics engine: ```bash pip install genesis-world ``` Verify installation: ```python import genesis as gs gs.init(backend=gs.gpu) print(f"Genesis version: {gs.__version__}") ``` ### 3. Install GenesisLab Clone the repository and install: ```bash # Clone repository git clone https://github.com/yourusername/genesislab.git cd genesislab # Install in editable mode cd source/genesislab pip install -e . ``` Verify installation: ```python import genesislab print(f"GenesisLab installed successfully!") ``` ### 4. Install RL Libraries (Optional) For training with reinforcement learning: **Stable Baselines3**: ```bash pip install stable-baselines3[extra] ``` **RSL RL**: ```bash pip install rsl-rl ``` **Other dependencies**: ```bash pip install gymnasium pip install tensorboard # For logging pip install wandb # For experiment tracking (optional) ``` ## Verification Run the verification script to ensure everything is installed correctly: ```python import torch import genesis as gs import gymnasium as gym import genesislab.envs # Check PyTorch assert torch.cuda.is_available(), "CUDA not available!" print(f"āœ“ PyTorch {torch.__version__} with CUDA {torch.version.cuda}") # Check Genesis gs.init(backend=gs.gpu) print(f"āœ“ Genesis {gs.__version__}") # Check GenesisLab env = gym.make("GenesisLab-Go2-Flat-v0", num_envs=4) obs, info = env.reset() print(f"āœ“ GenesisLab environment created successfully") print(f" Observation shape: {obs.shape}") env.close() print("\nāœ“ All checks passed! You're ready to go!") ``` ## Troubleshooting ### CUDA not available **Problem**: `torch.cuda.is_available()` returns `False` **Solutions**: 1. Check NVIDIA drivers are installed: `nvidia-smi` 2. Install correct PyTorch version for your CUDA version 3. Verify CUDA toolkit is installed: `nvcc --version` ### Genesis import error **Problem**: `ImportError: cannot import name 'gs'` **Solutions**: 1. Reinstall Genesis: `pip install --upgrade genesis-world` 2. Check Python version (requires 3.8+) 3. Try in a fresh virtual environment ### GenesisLab import error **Problem**: `ImportError: No module named 'genesislab'` **Solutions**: 1. Ensure you installed from correct directory: `source/genesislab` 2. Use editable install: `pip install -e .` 3. Check you're in the correct Python environment ### Memory errors **Problem**: `RuntimeError: CUDA out of memory` **Solutions**: 1. Reduce `num_envs` parameter 2. Reduce model size 3. Use lower-resolution sensors 4. Close other GPU applications ### Slow simulation **Problem**: Simulation runs slowly **Solutions**: 1. Ensure CUDA is being used (check `gs.init(backend=gs.gpu)`) 2. Increase `num_envs` for better GPU utilization 3. Use fake sensors instead of Genesis sensors 4. Check no other processes are using GPU ## Docker Installation (Optional) For a containerized setup: ```dockerfile FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime # Install Genesis RUN pip install genesis-world # Install GenesisLab COPY . /workspace/genesislab WORKDIR /workspace/genesislab/source/genesislab RUN pip install -e . # Install RL libraries RUN pip install stable-baselines3[extra] gymnasium CMD ["/bin/bash"] ``` Build and run: ```bash docker build -t genesislab . docker run --gpus all -it genesislab ``` ## Virtual Environment Setup We recommend using virtual environments: **Using venv**: ```bash python3 -m venv genesislab-env source genesislab-env/bin/activate # Linux/Mac # or genesislab-env\Scripts\activate # Windows ``` **Using conda**: ```bash conda create -n genesislab python=3.10 conda activate genesislab ``` ## Development Installation For development work on GenesisLab: ```bash # Clone repository git clone https://github.com/yourusername/genesislab.git cd genesislab # Install in editable mode with dev dependencies cd source/genesislab pip install -e ".[dev]" # Install pre-commit hooks pre-commit install ``` ## Updating GenesisLab To update to the latest version: ```bash cd genesislab git pull origin main cd source/genesislab pip install -e . --upgrade ``` ## Uninstallation To uninstall: ```bash pip uninstall genesislab pip uninstall genesis-world ``` ## Next Steps - Run your [first environment](first_environment.md) - Learn [basic concepts](basic_concepts.md) - Check out [tutorials](../tutorials/index.md)