File size: 5,164 Bytes
8359472
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/env bash
# One-time setup: run INSIDE the robolab-isaacsim5.sqsh container on a cluster node.
# Installs miniconda3 + simfoundry env + ur5dp env into $ROOT (Lustre, persistent).
#
# Submit:
#   sbatch setup_envs_job.sh
set -uo pipefail

ROOT=/lustre/fsw/portfolios/nvr/users/jtremblay/yu
CONDA=$ROOT/miniconda3
SIMFOUNDRY=$ROOT/SimFoundry
B1K=$SIMFOUNDRY/deps/BEHAVIOR-1K
ENV_SRC=/lustre/fsw/portfolios/nvr/users/jtremblay/1027_sim_tasks_dl/1027_sim_tasks/env/yu_workstation_2026-10-27
LOG_DIR=$ROOT/1027_run/logs

mkdir -p $LOG_DIR
exec > >(tee -a $LOG_DIR/setup_envs.log) 2>&1

export PATH=$CONDA/bin:/usr/local/bin:/usr/bin:/bin
export HOME=/root

log() { echo "== $(date '+%F %T') $*"; }

# ── 1. Miniconda ─────────────────────────────────────────────────────────────
if [ ! -f $CONDA/bin/conda ]; then
    log "Installing miniconda3 to $CONDA"
    curl -fsSL "https://repo.anaconda.com/miniconda/Miniconda3-py311_24.11.1-0-Linux-x86_64.sh" -o /tmp/miniconda.sh
    bash /tmp/miniconda.sh -b -p $CONDA
    rm /tmp/miniconda.sh
fi
source $CONDA/etc/profile.d/conda.sh
log "conda $(conda --version)"

# ── 2. Clone SimFoundry + BEHAVIOR-1K ────────────────────────────────────────
if [ ! -d $SIMFOUNDRY/.git ]; then
    log "Cloning SimFoundry @ 617faccd"
    git clone https://github.com/NVlabs/SimFoundry.git $SIMFOUNDRY
    cd $SIMFOUNDRY && git checkout 617faccd36b07017def30db84ea897c91c577eae
fi
if [ ! -d $B1K/.git ]; then
    log "Cloning BEHAVIOR-1K @ d89aae4e"
    git clone --recursive https://github.com/StanfordVL/BEHAVIOR-1K.git $B1K
    cd $B1K && git checkout d89aae4e0e9a1de3cf8285cb9669c11d8c8bb864
fi

# ── 3. simfoundry env ─────────────────────────────────────────────────────────
if [ ! -d $CONDA/envs/simfoundry ]; then
    log "Creating simfoundry env (Python 3.11.14)"
    conda create -y -p $CONDA/envs/simfoundry python=3.11.14 -c conda-forge --override-channels
    conda activate $CONDA/envs/simfoundry
    export PIP_NO_CACHE_DIR=1

    log "Running BEHAVIOR-1K setup.sh"
    cd $B1K
    ./setup.sh --omnigibson --bddl --cuda-version 12.8 \
        --accept-conda-tos --accept-nvidia-eula --accept-dataset-tos

    log "Extra pip pins from workstation freeze"
    PINS=$(grep -iE "^(scipy|imageio|opencv-python|opencv-python-headless|pyyaml|pandas|zarr|numcodecs|numpy)==" \
           $ENV_SRC/simfoundry.pip_freeze.txt)
    echo "$PINS"
    pip install $PINS

    log "Installing lerobot + extras"
    conda install -y --freeze-installed ffmpeg=7.1.1 -c conda-forge --override-channels
    pip install --no-deps \
        "lerobot@git+https://github.com/huggingface/lerobot.git@577cd10974b84bea1f06b6472eb9e5e74e07f77a"
    pip install "datasets>=2.19.0,<3" jsonlines "av>=14.2.0" cmake \
        "deepdiff>=7.0.1,<9" draccus==0.10.0 pynput pyserial \
        "rerun-sdk>=0.21.0,<0.23.0" zmq
    pip install "numpy==1.26.4" "coverage==7.6.1" "typing_extensions>=4.15.0" "psutil==5.9.8"

    conda env config vars set -p $CONDA/envs/simfoundry \
        OMNI_KIT_ACCEPT_EULA=YES MUJOCO_GL=egl PYOPENGL_PLATFORM=egl \
        OMNIGIBSON_DATA_PATH=$B1K/datasets

    log "Verifying simfoundry"
    python -c "import torch,omnigibson,isaacsim; \
        print('torch', torch.__version__, torch.cuda.is_available()); \
        print('omnigibson import ok')"
    conda deactivate
else
    log "simfoundry env already exists, skipping"
fi

# ── 4. ur5dp env ──────────────────────────────────────────────────────────────
if [ ! -d $CONDA/envs/ur5dp ]; then
    log "Creating ur5dp env"
    # try conda_explicit first, fall back to plain python env
    conda create -y -p $CONDA/envs/ur5dp python=3.10.13 -c conda-forge --override-channels
    conda activate $CONDA/envs/ur5dp
    P=$CONDA/envs/ur5dp/bin/python

    log "pip install ur5dp deps"
    grep -vE "file://|^-e |^pytorch3d" $ENV_SRC/ur5dp.pip_freeze.txt > /tmp/ur5dp.pip.txt
    $P -m pip install --no-cache-dir --no-deps -r /tmp/ur5dp.pip.txt \
        --extra-index-url https://download.pytorch.org/whl/cu128

    log "pytorch3d (CPU-only build)"
    PT3D=$(grep "^pytorch3d" $ENV_SRC/ur5dp.pip_freeze.txt || echo "pytorch3d")
    CUDA_VISIBLE_DEVICES="" FORCE_CUDA=0 $P -m pip install --no-cache-dir --no-deps \
        --no-build-isolation "$PT3D" || log "pytorch3d install failed (non-fatal)"

    conda env config vars set -p $CONDA/envs/ur5dp MUJOCO_GL=egl PYOPENGL_PLATFORM=egl

    log "Verifying ur5dp"
    $P -c "import torch,diffusers,robomimic,hydra,zarr; \
        print('torch', torch.__version__, torch.cuda.is_available(), \
        torch.cuda.get_device_name(0) if torch.cuda.is_available() else '')"
    conda deactivate
else
    log "ur5dp env already exists, skipping"
fi

log "ALL DONE"