Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need docker #50

Closed
yytang0204 opened this issue Dec 19, 2024 · 7 comments
Closed

Need docker #50

yytang0204 opened this issue Dec 19, 2024 · 7 comments

Comments

@yytang0204
Copy link

Really need a docker to run this on linux. Taichi is hard to run naturally

@zhouxian
Copy link
Collaborator

is there any problem with pip install taichi?

@ Kashu7100 could you help with this?

@zhouxian
Copy link
Collaborator

@Kashu7100

@Kashu7100
Copy link
Collaborator

I will create PR

@yytang0204
Copy link
Author

is there any problem with pip install taichi?

@ Kashu7100 could you help with this?

Basically my offline enviroment is messy since many people work on it. So I want to use it on cloud. A docker file will be best.

@antoinebou12
Copy link

antoinebou12 commented Dec 21, 2024

https://github.com/ETSTribology/Genesis

Still working on it

# Use a base image with Python 3.9 and CUDA support
ARG BASE_IMAGE=pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel
FROM ${BASE_IMAGE}

# Set environment variables
ARG PYTHON_VERSION=3.9
ARG CMAKE_VERSION=3.26.1
ARG GCC_VERSION=11
ARG ENABLE_LUISARENDER=ON
ARG ENABLE_MOTION_PLANNING=ON
ARG ENABLE_SURFACE_RECONSTRUCTION=ON
ENV DEBIAN_FRONTEND=noninteractive
ENV CONDA_DIR=/opt/conda
ENV PATH="$CONDA_DIR/bin:$PATH:/root/.cargo/bin"

# Install basic dependencies
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y manpages-dev
RUN apt-get install -y software-properties-common
RUN apt-get install -y curl
RUN apt-get install -y git
RUN apt-get install -y vim 
RUN apt-get install -y tar 
RUN apt-get install -y xz-utils
RUN apt-get install -y cmake
RUN apt-get install -y libvulkan-dev
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y libglu1-mesa-dev
RUN apt-get install -y xorg-dev
RUN apt-get install -y libsnappy-dev
RUN apt-get install -y python3-pip
RUN apt-get install -y python${PYTHON_VERSION}
RUN apt-get install -y python${PYTHON_VERSION}-dev
RUN apt-get install -y python${PYTHON_VERSION}-distutils
RUN apt-get install -y libzstd-dev
RUN apt-get install -y libbz2-dev
RUN apt-get install -y libpng-dev
RUN apt-get install -y libtiff-dev
RUN apt-get install -y libjpeg-dev
RUN apt-get install -y libglvnd0 
RUN apt-get install -y libgl1 
RUN apt-get install -y libglx0 
RUN apt-get install -y libegl1 
RUN apt-get install -y libgles2 
RUN apt-get install -y ffmpeg
RUN apt-get install -y python3-opengl
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*

# Install GUI module dependencies
RUN apt-get update
RUN apt-get install -y libopencv-dev
RUN apt-get install -y libglfw3-dev
RUN apt-get install -y libxinerama-dev
RUN apt-get install -y libxcursor-dev
RUN apt-get install -y libxi-dev
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*

# Install GCC/G++ version
RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt-get update
RUN apt-get install -y gcc-${GCC_VERSION}
RUN apt-get install -y g++-${GCC_VERSION}
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 110
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 110
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*

# Install Rust for SplashSurf
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

# Install Miniconda (for Conda dependencies)
RUN curl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -o Miniconda3.sh
RUN bash Miniconda3.sh -b -p $CONDA_DIR
RUN rm Miniconda3.sh
RUN conda update -y conda

# Install Conda dependencies
RUN conda install -c conda-forge gcc=${GCC_VERSION}
RUN conda install -c conda-forge gxx=${GCC_VERSION}
RUN conda install -c conda-forge cmake=${CMAKE_VERSION}
RUN conda install -c conda-forge zlib
RUN conda install -c conda-forge libuuid
RUN conda install -c conda-forge patchelf
RUN conda install -c conda-forge vulkan-tools
RUN conda install -c conda-forge vulkan-headers
RUN conda clean --all --yes

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip
RUN pip install pillow
RUN pip install pybind11[global]
RUN pip install genesis-world
RUN pip install pyrender
RUN pip install PyOpenGL==3.1.7
RUN cargo install splashsurf

# Clone Genesis repository
WORKDIR /app
ARG GENESIS_REPO=https://github.com/Genesis-Embodied-AI/Genesis.git
RUN git clone --recursive ${GENESIS_REPO} .
RUN git submodule update --init --recursive

# Debugging: List LuisaRender directory contents
RUN ls -al /app/genesis/ext/LuisaRender

# Apply fixes to Rust code to resolve warnings and potential errors
WORKDIR /app/genesis/ext/LuisaRender

# Compile LuisaRender for Ray Tracing (Optional)
RUN if [ "${ENABLE_LUISARENDER}" = "ON" ]; then \
    if [ -f "CMakeLists.txt" ]; then \
        cmake -S . -B build \
            -D CMAKE_BUILD_TYPE=Release \
            -D LUISA_COMPUTE_DOWNLOAD_NVCOMP=ON \
            -D LUISA_COMPUTE_ENABLE_GUI=ON \
            -D PYTHON_VERSIONS=${PYTHON_VERSION} && \
        cmake --build build -j$(nproc); \
    else \
        echo "CMakeLists.txt not found in /app/genesis/ext/LuisaRender. Skipping build."; \
        exit 1; \
    fi; \
fi

# Set the entrypoint
ENTRYPOINT ["python3"]

@Riften
Copy link

Riften commented Dec 21, 2024

I make it work with following Dockerfile. It does not build genesis from source. But install genesis through pip and install all dependencies.

FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel
ENV DEBIAN_FRONTEND=noninteractive
# install basic tools
RUN apt-get update && apt-get install -y git wget curl \
        vim tar xz-utils

# install python package genesis
RUN pip install genesis-world
# install pillow for image processing
RUN pip install pillow

# install OpenGL
RUN apt-get update && apt-get install -y \
       libglvnd0 libgl1 libglx0 libegl1 libgles2 

# fix missing libraries
RUN apt-get update && apt-get install -y libxrender1 libglib2.0-0

# fix pyrender
# install ffmpeg
# https://github.com/Genesis-Embodied-AI/Genesis/pull/27
RUN apt-get update && apt-get install -y ffmpeg
# install pyrender
RUN pip install pyrender
RUN pip install PyOpenGL==3.1.7
# note that there would be a conflict between PyOpenGL and pyrender.
# but we still need PyOpenGL 3.1.7 refer to https://github.com/Genesis-Embodied-AI/Genesis/issues/74
# PyOpenGL 3.1.7 raise error when using pyrender even if i build pyrender from source
# fix glGetError refer to: https://github.com/MPI-IS/mesh/issues/23
RUN apt-get install -y python3-opengl

@Kashu7100
Copy link
Collaborator

Sorry for taking some time. Finally created a PR with Luisa support.
#303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants