openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.83k stars 810 forks source link

Dockerfile Build Error #676

Open peterdavidfagan opened 2 years ago

peterdavidfagan commented 2 years ago

Issue:

The current Dockerfile fails to build, it appears that for Ubuntu 16.04 xenial which the base image is based on the python 3.6 package install is broken since python 3.6 is no longer successfully installing from the ppa:deadsnakes/ppa package repository. Below is the error I have observed when building the image.

Step 4/26 : RUN DEBIAN_FRONTEND=noninteractive apt-get install --yes python3.6-dev python3.6 python3-pip
 ---> Running in 06c42aa3641f
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package python3.6-dev
E: Couldn't find any package by glob 'python3.6-dev'
E: Couldn't find any package by regex 'python3.6-dev'
E: Unable to locate package python3.6
E: Couldn't find any package by glob 'python3.6'
E: Couldn't find any package by regex 'python3.6'
The command '/bin/sh -c DEBIAN_FRONTEND=noninteractive apt-get install --yes python3.6-dev python3.6 python3-pip' returned a non-zero code: 100

Reproduce steps: Run the below command from the root directory of this repository. docker build -t mujoco_py .

Expected behavior: A successful build of the image.

Fix: I plan to open a pull request to fix this issue but I would also be happy to hear comments/suggestions on the above from others.

peterdavidfagan commented 2 years ago

FYI @nimrod-gileadi who performed the last commit. A general question is also whether it is worthwhile updating the image to Focal? It would be great to discuss this further, I am happy to work towards the required updates if necessary. Maybe the following base image could be used instead: nvidia/cuda@sha256:8480ffb4a547ba36cb9b9553eac5cdbb3fd33c346351c41a947279838817c7d8

peterdavidfagan commented 2 years ago

I have submitted the above pull request addressing the points outlined in this issue, looking forward to feedback on this and potentially implementing further changes where needed.

Have a great rest of the day.

peterdavidfagan commented 2 years ago

Also please find the following issue which is resulting in the build errors seen in the current Dockerfile: https://github.com/deadsnakes/issues/issues/195.

JiahuiSun commented 2 years ago

I make a simpler Dockerfile that installs ubuntu18.04, mujoco2.1.0 and anaconda.

# Install nvidia docker for GPU support
# https://hub.docker.com/r/nvidia/cuda
FROM nvidia/cuda:11.3.0-devel-ubuntu18.04

# Install all needed tools
RUN apt-get update -q \
    && DEBIAN_FRONTEND=noninteractive apt-get install -y \
    openssh-server \
    curl \
    git \
    vim \
    wget \
    net-tools \
    software-properties-common \
    xserver-xorg-dev \
    libgl1-mesa-dev \
    libgl1-mesa-glx \
    libglew-dev \
    libosmesa6-dev \
    patchelf \
    build-essential \
    libssl-dev \
    libffi-dev \
    libxml2-dev \
    libxslt1-dev \
    zlib1g-dev \
    libglew1.5 \
    libegl1-mesa \
    libxrandr2 \ 
    libxss1 \
    libxcursor1 \
    libxcomposite1 \
    libasound2 \
    libxi6 \
    libxtst6 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install mujoco
RUN mkdir -p /root/.mujoco \
    && wget https://github.com/deepmind/mujoco/releases/download/2.1.0/mujoco210-linux-x86_64.tar.gz -O mujoco.tar.gz \
    && tar -xf mujoco.tar.gz -C /root/.mujoco \
    && rm mujoco.tar.gz
RUN echo "LD_LIBRARY_PATH=/root/.mujoco/mujoco210/bin:${LD_LIBRARY_PATH}" >> ~/.bashrc
RUN echo "LD_LIBRARY_PATH=/usr/local/nvidia/lib64:${LD_LIBRARY_PATH}" >> ~/.bashrc

# Install anaconda
RUN wget \
    https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh \
    && mkdir /root/.conda \
    && bash Anaconda3-2021.11-Linux-x86_64.sh -b \
    && rm -f Anaconda3-2021.11-Linux-x86_64.sh
ENV PATH="/root/anaconda3/bin:${PATH}"
RUN conda init bash

EXPOSE 22
EXPOSE 6006

# After create the image, users can run a container.
# The remaining steps are about creating the python env for mujoco-py. 
# Here is our example.
# conda create -n mujoco python=3.7
# conda activate mujoco
# conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
# pip install -U 'mujoco-py<2.2,>=2.1'