YuxueYang1204 / TrimGS

Trim 3D Gaussian Splatting for Accurate Geometry Representation
https://trimgs.github.io/
208 stars 6 forks source link

Dockerizing the project #20

Open Limonka11 opened 1 week ago

Limonka11 commented 1 week ago

Hi am trying to run the project in a docker container, however, I am struggling with this task. In particualar using this Dockerfile:

# Base image for CUDA and system dependencies
FROM nvidia/cuda:12.1.0-devel-ubuntu20.04 AS base

ENV DEBIAN_FRONTEND=noninteractive

# Install system dependencies
RUN apt update -y && \
    apt install -y build-essential wget cmake git && \
    apt install -y libglew-dev libassimp-dev libboost-all-dev libgtk-3-dev libopencv-dev \
    libglfw3-dev libavdevice-dev libavcodec-dev libeigen3-dev libxxf86vm-dev libembree-dev && \
    apt install -y colmap imagemagick && \
    apt clean && rm -rf /var/lib/apt/lists/*

# Miniconda installation
FROM base AS miniconda

ENV CONDA_DIR=/opt/conda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
    /bin/bash ~/miniconda.sh -b -p /opt/conda && \
    rm ~/miniconda.sh
ENV PATH=$CONDA_DIR/bin:$PATH

# Python environment setup
FROM miniconda AS environment

WORKDIR /root/trimgs
COPY ./ ./

ENV TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX"

RUN conda env create --file environment.yml

# Final image
FROM environment AS final

# Use the conda environment
SHELL ["conda", "run", "-n", "trimgs", "/bin/bash", "-c"]

# Default command
CMD ["bash"]

I get this error:

Installing pip dependencies: ...working... Pip subprocess error:
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [19 lines of output]
      No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
      running bdist_wheel
      /opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/utils/cpp_extension.py:502: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/diff_gaussian_rasterization
      copying diff_gaussian_rasterization/__init__.py -> build/lib.linux-x86_64-cpython-38/diff_gaussian_rasterization
      running build_ext
      /opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no g++ version bounds defined for CUDA version 12.1
        warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
      building 'diff_gaussian_rasterization._C' extension
      creating build/temp.linux-x86_64-cpython-38
      creating build/temp.linux-x86_64-cpython-38/cuda_rasterizer
      /usr/local/cuda/bin/nvcc -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/TH -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda/include -I/opt/conda/envs/trimgs/include/python3.8 -c cuda_rasterizer/backward.cu -o build/temp.linux-x86_64-cpython-38/cuda_rasterizer/backward.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -I/root/trimgs/Trim3DGS/submodules/diff-gaussian-rasterization/third_party/glm/ -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      nvcc fatal   : Unsupported gpu architecture 'compute_35'
      error: command '/usr/local/cuda/bin/nvcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for diff_gaussian_rasterization
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
      running bdist_wheel
      /opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/utils/cpp_extension.py:502: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
        warnings.warn(msg.format('we could not find ninja.'))
      running build
      running build_ext
      /opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/utils/cpp_extension.py:424: UserWarning: There are no g++ version bounds defined for CUDA version 12.1
        warnings.warn(f'There are no {compiler_name} version bounds defined for CUDA version {cuda_str_version}')
      building 'simple_knn._C' extension
      creating build
      creating build/temp.linux-x86_64-cpython-38
      gcc -pthread -B /opt/conda/envs/trimgs/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/envs/trimgs/include -fPIC -O2 -isystem /opt/conda/envs/trimgs/include -fPIC -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/TH -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda/include -I/opt/conda/envs/trimgs/include/python3.8 -c ext.cpp -o build/temp.linux-x86_64-cpython-38/ext.o -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++17
      /usr/local/cuda/bin/nvcc -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/TH -I/opt/conda/envs/trimgs/lib/python3.8/site-packages/torch/include/THC -I/usr/local/cuda/include -I/opt/conda/envs/trimgs/include/python3.8 -c simple_knn.cu -o build/temp.linux-x86_64-cpython-38/simple_knn.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE=\"_gcc\" -DPYBIND11_STDLIB=\"_libstdcpp\" -DPYBIND11_BUILD_ABI=\"_cxxabi1011\" -DTORCH_EXTENSION_NAME=_C -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 -std=c++17
      nvcc fatal   : Unsupported gpu architecture 'compute_35'
      error: command '/usr/local/cuda/bin/nvcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for simple_knn
ERROR: Could not build wheels for diff_gaussian_rasterization, simple_knn, which is required to install pyproject.toml-based projects

I am trying to run the project on a VertexAI instance with a single T4 gpu