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.79k stars 810 forks source link

Installing mujoco someplace other than the /home directory #783

Closed Deepakgthomas closed 6 months ago

Deepakgthomas commented 6 months ago

Describe the bug I am trying to install mujoco in a location other than the home directory in Docker. Therefore, I do this - To Reproduce

WORKDIR /opt
ENV MUJOCO_PY_MUJOCO_PATH=/opt
RUN wget https://roboti.us/download/mjpro150_linux.zip \
        && unzip mjpro150_linux.zip \
        && mkdir /opt/mujoco \
        && mv mjpro150 /opt/mujoco \
        && wget https://roboti.us/file/mjkey.txt \
        && mv mjkey.txt /opt/mujoco \
        && rm mjpro150_linux.zip

RUN cd /miniconda3/envs/myenv/lib/ && mv libstdc++.so.6 libstdc++.so.6.old && ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6

However, later when I try to do the following it fails -

RUN pip install --no-cache-dir "Cython<3" \
    && pip install mujoco-py==1.50.1.0

Error Messages Dockerfile:53

52 |
53 | >>> RUN pip install --no-cache-dir "Cython<3" \ 54 | >>> && pip install mujoco-py==1.50.1.0 \ 55 | >>> && pip install numpy \ 56 | >>> && pip install gym 57 |

ERROR: failed to solve: process "conda run -n myenv /bin/bash -c pip install --no-cache-dir \"Cython<3\" && pip install mujoco-py==1.50.1.0 && pip install numpy && pip install gym" did not complete successfully: exit code: 1

If instead of /opt I did ~/., things work well. However, based on the documentation here, I can change the path using MUJOCO_PY_MUJOCO_PATH. Can someone please tell me where my bug is.

Here is my entire Dockerfile for reference -

FROM ubuntu:22.04

WORKDIR /app

SHELL ["/bin/bash", "-c"] 

RUN echo "Hello World!"
RUN apt-get update && apt-get install -y \
    libosmesa6-dev \
    sudo \
    wget \
    curl \
    unzip \
    gcc \
    g++ \
    &&  apt-get install \
    libosmesa6-dev \
    && rm -rf /var/lib/apt/lists/*

ENV DEBIAN_FRONTEND=noninteractive

ENV PATH="/miniconda3/bin:${PATH}"
ARG PATH="/miniconda3/bin:${PATH}"
RUN cd / \
    && mkdir -p /miniconda3 \
    && wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /miniconda3/miniconda.sh \
    && bash /miniconda3/miniconda.sh -b -u -p /miniconda3 \
    && /miniconda3/bin/conda init bash \
    && source ~/.bashrc \
    && conda init \
    && conda create -y -n myenv python=3.8 \
    && conda update -y conda

WORKDIR /opt
ENV MUJOCO_PY_MUJOCO_PATH = /opt
RUN wget https://roboti.us/download/mjpro150_linux.zip \
    && unzip mjpro150_linux.zip \
    && mkdir /opt/mujoco \
    && mv mjpro150 /opt/mujoco \
    && wget https://roboti.us/file/mjkey.txt \
    && mv mjkey.txt /opt/mujoco \
    && rm mjpro150_linux.zip

RUN cd /miniconda3/envs/myenv/lib/ && mv libstdc++.so.6 libstdc++.so.6.old && ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
SHELL ["conda", "run", "-n", "myenv", "/bin/bash", "-c"]
EXPOSE 5003

RUN pip install --no-cache-dir "Cython<3" \
    && pip install mujoco-py==1.50.1.0 \
    && pip install numpy \
    && pip install gym