autonomousvision / sdfstudio

A Unified Framework for Surface Reconstruction
Apache License 2.0
1.95k stars 182 forks source link

Can't run docker image due to missing Qt 5.15 required by pymeshlab 2022.2.post2 #58

Open sagydr opened 1 year ago

sagydr commented 1 year ago

Describe the bug Can't run "ns-install-cli" on docker images.

  1. neftstudio is dependent on "pymeshlab==2022.2.post2" (inside pyproject.toml)
  2. pymeshlab 2022.2.post2 requires "Qt = 5.15"
  3. Qt 5.15 can't be simply installed using apt-get and needs to be built
  4. It takes hours and I'm getting errors trying to build it on the docker specified

To Reproduce Steps to reproduce the behavior: Simply build the Dockerfile provided and try to run the image

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image

Additional context running "qmake -v" shows I have Qt 5.12: QMake version 3.1 Using Qt version 5.12.8 in /usr/lib/x86_64-linux-gnu

niujinshuchong commented 1 year ago

Hi, pymeshlab is used for mesh simplification. You could comment it if not needed.

sagydr commented 1 year ago

Hi, pymeshlab is used for mesh simplification. You could comment it if not needed.

Thanks! Do you know if it will also work with the previous pymeshlab version? AKA v2021.10 ?

niujinshuchong commented 1 year ago

Hi, other version should also works.

officialgoat commented 1 year ago

Hey, export_utils.py and tsdf_utils.py depend on it, so how are you supposed to comment it out? Or is there some way to get qt 5.15 without having to compile it?

toomy0toons commented 1 year ago

hi i also had to struggle trying to get things working in docker, and i would like to share my experience. i tried many methods, like getting a unofficial qt5 build and libs, degrading pymeshlab versions.. etc... none worked. i have successfully managed to get sdfstudio docker working and the solution was relatively simple. just pull the official nerfstudio image, then on top of that image install

sample dockerfile

FROM dromni/nerfstudio:latest
#set cuda arch to yours
ENV TCNN_CUDA_ARCHITECTURES=80 <--mine is 80
# overwrite default nerfstudio with sdfstudio
RUN rm -rf . /home/user/nerfstudio
# Copy nerfstudio (sdfstudio) folder and give ownership to user.
ADD . /home/user/nerfstudio
USER root
RUN chown -R user:user /home/user/nerfstudio
USER 1000:1000

# Change working directory
WORKDIR /workspace

# Install nerfstudio cli auto completion and enter shell if no command was provided.
CMD ns-install-cli --mode install && /bin/bash

i found it to run fine, except for torch version mismatch, which makes a tiny error importing deprecated torch._six string classes. so go to nerfstudio_collate.py, comment out torch._six like

#from torch._six import string_classes
string_classes = str
RishabhBajaj25 commented 1 year ago

Hi, I am trying to implement your solution and get the following error when I tried to run the container: ModuleNotFoundError: No module named 'nerfstudio' image

Here is my dockerfile:

# Define base image.
FROM dromni/nerfstudio:0.3.1
#Set non-interactive to prevent asking for user inputs blocking image creation.
ENV DEBIAN_FRONTEND=noninteractive
## Set timezone as it is required by some packages.
ENV TZ=Europe/Berlin
## CUDA architectures, required by tiny-cuda-nn.
ENV TCNN_CUDA_ARCHITECTURES=86
## CUDA Home, required to find CUDA in some packages.
ENV CUDA_HOME="/usr/local/cuda"
RUN pwd

#RUN rm -rf /home/user/nerfstudio
# Copy nerfstudio (sdfstudio) folder and give ownership to user.
ADD . /home/user/nerfstudio

# Create non root user and setup environment.
#RUN useradd -m -d /home/user -u 1000 user

USER root
RUN chown -R root:root /home/user/nerfstudio
USER root:root
RUN apt-get install curl
# Change working directory
WORKDIR /workspace

# Install nerfstudio cli auto completion and enter shell if no command was provided.
CMD ns-install-cli --mode install && /bin/bash

Can you please assist me with this?

LemonZhong commented 1 year ago

same problem, how to solve it?

toomy0toons commented 1 year ago

sorry i have left installing part. go to nerfstudio folder and run pip install -e . for local installation of sdfstudio. follow the installation docs in sdfstudio.

https://github.com/autonomousvision/sdfstudio#installing-sdfstudio

jia-yli commented 11 months ago

In case you are still interested in this topic. I just finished a complete docker setup. The problem is actually from the Ubuntu version. You must use ubuntu 22.04 in the image. Here is the Dockerfile I was using: https://github.com/jia-yli/sdfstudio/blob/master/Dockerfile.

The nvidia/cudagl:11.3.1-devel image (https://github.com/autonomousvision/sdfstudio/blob/master/Dockerfile#L2) is using cuda 11.3 + ubuntu 20.04. And the working image dromni/nerfstudio(https://hub.docker.com/r/dromni/nerfstudio) is using cuda 11.8 + ubuntu 22.04. I went inside those images and checked the qtbase5-dev package versions and possible updates. Basically for ubuntu 20.02, the latest one is 5.12. Only ubuntu 22.04 has 5.15 available.

For a cuda image with ubuntu 22.04, I am using nvidia/cuda:11.8.0-devel-ubuntu22.04(https://hub.docker.com/r/nvidia/cuda). There are some other problems I met in this step:

  1. Although the original image was cudagl (cuda + opengl), in my case the opengl in the image will lead to something like "QT5: Undefined Symbol" error when you try to import pymeshlab.
  2. CUDA version should < 12.0. Newer versions will fail in the colmap building process (https://github.com/colmap/colmap/issues/1834). And I used the v3.8 building process (https://github.com/colmap/colmap/blob/3.8/docker/Dockerfile) since it looks nicer the the 3.7 one.
  3. Although dromni/nerfstudio uses cu118 versions for torch, torchvision, torchaudio. In my case due to the version conflict with this version requirement: https://github.com/autonomousvision/sdfstudio/blob/master/pyproject.toml#L43, the auto downgrade of torch led to a version mismatch between torch and torchaudio, which also led to some errors in the scripts. So I stick to the cu113 version specified in the original Dockerfile(although I am using cuda 11.8 in the image): https://github.com/autonomousvision/sdfstudio/blob/master/Dockerfile#L94

In case you want to try it yourself, I was using this gitlab repo(https://gitlab.com/nvidia/container-images/cuda.git), which provides a script to build docker images using different combinations of cuda version +opengl (or not)+unbuntu version.