Skip to content

Instantly share code, notes, and snippets.

@donmorton
Created November 24, 2025 00:31
Show Gist options
  • Select an option

  • Save donmorton/84533fffe83cce0d2352fb9467716c76 to your computer and use it in GitHub Desktop.

Select an option

Save donmorton/84533fffe83cce0d2352fb9467716c76 to your computer and use it in GitHub Desktop.
test env1
#!/bin/bash
set -e # Exit on error
echo "πŸš€ Starting OpenPI Remote Server Setup..."
# 1. Install System Dependencies
echo "πŸ“¦ Installing system dependencies..."
sudo apt-get update
# libgl1-mesa-glx is deprecated in Ubuntu 22.04+, using libgl1 instead
sudo apt-get install -y git python3.10 python3.10-venv tmux libgl1 libglib2.0-0
# 2. Install uv (Python package manager)
if ! command -v uv &> /dev/null; then
echo "πŸ“¦ Installing uv..."
curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
else
echo "βœ… uv is already installed"
fi
# Ensure uv is in PATH for this session
export PATH="$HOME/.local/bin:$PATH"
# 3. Clone Repository
if [ ! -d "openpi" ]; then
echo "⬇️ Cloning openpi..."
git clone --recurse-submodules https://github.com/Physical-Intelligence/openpi.git
else
echo "βœ… openpi directory exists, pulling latest..."
cd openpi
git pull
git submodule update --init --recursive
cd ..
fi
cd openpi
# 4. Install Python Dependencies
echo "🐍 Installing Python dependencies..."
GIT_LFS_SKIP_SMUDGE=1 uv sync
GIT_LFS_SKIP_SMUDGE=1 uv pip install -e .
# 5. Configure Environment (Fix for /tmp issues)
echo "πŸ”§ Configuring environment..."
mkdir -p tmp
export TMPDIR=$(pwd)/tmp
echo " Using local temp directory: $TMPDIR"
# Optional: Clean cache if requested
if [ "$CLEAN_CACHE" == "1" ]; then
echo "🧹 CLEAN_CACHE=1 detected. Deleting checkpoint cache..."
rm -rf ~/.cache/openpi/openpi-assets/checkpoints/pi0_aloha_sim
echo " Cache cleared."
fi
# 6. Start Server
echo "πŸš€ Starting Policy Server (ALOHA_SIM)..."
echo " Listening on port 8000..."
# Check if port is in use
if lsof -ti:8000; then
echo "⚠️ Port 8000 is in use. Killing process..."
lsof -ti:8000 | xargs kill -9
fi
uv run scripts/serve_policy.py --env ALOHA_SIM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment