ggigelmo1's picture
Accept Anaconda ToS before conda create (keep in lockstep with modal_app)
a76f6b9 verified
Raw History Blame Contribute Delete
3.49 kB
# Dockerfile — exact environment for the StBR / SPOT reproduction (hopper-medium-v2)
# Mirrors StBR's conda_env.yml (pinned repo commit c47ebe2bf1c4bc801a225c8b86ae00917e7e706a):
# python=3.8.5, pytorch>=2.1.0 (pytorch-cuda=12.1), gym==0.18.3, mujoco-py,
# numpy<1.24.0, pyyaml==5.4.1, coolname==1.1.0, termcolor==1.1.0,
# tensorboard==2.7.0, protobuf==3.17.3
# + MuJoCo 2.1.0 at /root/.mujoco/mujoco210 (StBR README step 1)
# + d4rl pinned at the exact commit linked in the StBR README:
# 4aff6f8c46f62f9a57f79caa9287efefa45b6688
# NOTE (disclosed): SPOT's own conda_env.yml pins torch 1.10.0 + cudatoolkit 10.x,
# which cannot run on any current GPU (T4/L4/A10G). SPOT (plain PyTorch) is therefore
# run under this StBR-derived environment; its training hyperparameters are untouched.
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
# apt-get update FIRST (fixes the earlier failure: stale lists -> 404)
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl wget bzip2 ca-certificates build-essential pkg-config \
libgl1-mesa-dev libosmesa6-dev libglew-dev libglfw3 libglfw3-dev patchelf libegl1 \
&& rm -rf /var/lib/apt/lists/*
# MuJoCo 2.1.0 (StBR README step 1)
RUN mkdir -p /root/.mujoco && \
wget -q https://mujoco.org/download/mujoco210-linux-x86_64.tar.gz -O /tmp/mujoco210.tar.gz && \
tar -zxf /tmp/mujoco210.tar.gz -C /root/.mujoco/
ENV LD_LIBRARY_PATH=/root/.mujoco/mujoco210/bin:/usr/lib/nvidia:/usr/lib/x86_64-linux-gnu
ENV MUJOCO_PY_MUJOCO_PATH=/root/.mujoco/mujoco210
ENV D4RL_SUPPRESS_IMPORT_ERROR=1
# Miniconda with `defaults` channel (still hosts python=3.8.5 as in conda_env.yml)
RUN wget -q https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh && \
bash /tmp/miniconda.sh -b -p /opt/conda
ENV PATH=/opt/conda/bin:/opt/conda/envs/stbr/bin:$PATH
# newer conda requires accepting Anaconda's ToS for the defaults channel
RUN /opt/conda/bin/conda tos accept --override-channels \
--channel https://repo.anaconda.com/pkgs/main --channel https://repo.anaconda.com/pkgs/r || true
RUN conda create -y -n stbr python=3.8.5
RUN /opt/conda/envs/stbr/bin/pip install --upgrade pip==24.0 setuptools==59.5.0 wheel==0.37.1
# pytorch>=2.1.0 + CUDA 12.1 (StBR conda_env.yml), via official cu121 wheels
RUN /opt/conda/envs/stbr/bin/pip install torch==2.4.1 --index-url https://download.pytorch.org/whl/cu121
RUN /opt/conda/envs/stbr/bin/pip install numpy==1.23.5 gym==0.18.3 "cython<3" mujoco-py==2.1.2.14 \
pyyaml==5.4.1 coolname==1.1.0 termcolor==1.1.0 tensorboard==2.7.0 protobuf==3.17.3 \
tqdm==4.61.2 imageio==2.31.1 h5py==3.8.0 click cloudpickle==1.6.0 pyglet==1.5.0 \
scipy matplotlib==3.7.5
# modern gymnasium + mujoco (ONLY used by the Step-3 MP4 rendering, offscreen CPU;
# separate packages, not touched by the authors' training stack)
RUN /opt/conda/envs/stbr/bin/pip install gymnasium==0.29.1 mujoco==2.3.7 imageio-ffmpeg huggingface_hub
# d4rl pinned at the commit linked in the StBR README (--no-deps: skips pybullet /
# dm_control / mjrl, which only concern non-MuJoCo domains; d4rl guards them via try/except)
RUN /opt/conda/envs/stbr/bin/pip install --no-deps \
"git+https://github.com/rail-berkeley/d4rl.git@4aff6f8c46f62f9a57f79caa9287efefa45b6688"
# precompile mujoco-py at build time (catches build issues early)
RUN /opt/conda/envs/stbr/bin/python -c "import mujoco_py; print('mujoco-py OK', mujoco_py.__version__)"
CMD ["/bin/bash"]