Dockerfile
ssnake opened this issue ยท 13 comments
Hye guys,
Trying to set up stuff via docker. Bumped into issue:
>docker-compose up
3d_1 | Traceback (most recent call last):
3d_1 | File "main.py", line 28, in <module>
3d_1 | vispy.use(app='egl')
3d_1 | File "/opt/conda/lib/python3.7/site-packages/vispy/util/wrappers.py", line 97, in use
3d_1 | use_app(app)
3d_1 | File "/opt/conda/lib/python3.7/site-packages/vispy/app/_default_app.py", line 47, in use_app
3d_1 | default_app = Application(backend_name)
3d_1 | File "/opt/conda/lib/python3.7/site-packages/vispy/app/application.py", line 49, in __init__
3d_1 | self._use(backend_name)
3d_1 | File "/opt/conda/lib/python3.7/site-packages/vispy/app/application.py", line 235, in _use
3d_1 | raise RuntimeError(msg)
3d_1 | RuntimeError: Could not import backend "EGL":
3d_1 | Could not initialize
My Dockerfile
FROM pytorch/pytorch:1.4-cuda10.1-cudnn7-runtime
COPY . /app/
WORKDIR /app
RUN pip install -r requirements.txt
RUN apt update
RUN apt install -y wget
RUN apt install -y libfontconfig1-dev
RUN pip install scipy matplotlib scikit-image
RUN apt install -y ffmpeg git less nano libsm6 libxext6 libxrender-dev python3-pyqt4 libgegl-0.3-0 libegl1 libegl-mesa0 libegl1-mesa-dev libgegl-dev
docker-compose.yml
version: '2.3'
services:
3d:
build: .
volumes:
- .:/app
- .torch:/root/.torch
working_dir: /app
networks:
- withvpn
stdin_open: true
tty: true
runtime: nvidia
ipc: host
environment:
- CUDA_VISIBLE_DEVICES=0
command: python main.py --config argument.yml
networks:
withvpn:
ipam:
config:
- subnet: 170.13.241.0/24
gateway: 170.13.241.1
>>> import vispy; print(vispy.sys_info())
Platform: Linux-4.15.0-96-generic-x86_64-with-debian-buster-sid
Python: 3.7.4 (default, Aug 13 2019, 20:35:49) [GCC 7.3.0]
NumPy: 1.17.4
App info-gathering error:
Traceback (most recent call last):
File "/opt/conda/lib/python3.7/site-packages/vispy/util/config.py", line 422, in sys_info
app = use_app(call_reuse=False) # suppress messages
File "/opt/conda/lib/python3.7/site-packages/vispy/app/_default_app.py", line 47, in use_app
default_app = Application(backend_name)
File "/opt/conda/lib/python3.7/site-packages/vispy/app/application.py", line 49, in __init__
self._use(backend_name)
File "/opt/conda/lib/python3.7/site-packages/vispy/app/application.py", line 256, in _use
'PyQt' % [b[0] for b in CORE_BACKENDS])
RuntimeError: Could not import any of the backends. You need to install any of ['PyQt4', 'PyQt5', 'PySide', 'PySide2', 'Pyglet', 'Glfw', 'SDL2', 'wx', 'EGL', 'osmesa']. We recommend PyQt
Working docker stuff:
Dockerfile
FROM pytorch/pytorch:1.4-cuda10.1-cudnn7-runtime
COPY . /app/
WORKDIR /app
RUN apt update
RUN apt install -y libfontconfig1-dev wget ffmpeg libsm6 libxext6 libxrender-dev mesa-utils-extra libegl1-mesa-dev libgles2-mesa-dev xvfb
ENV DISPLAY=:0
RUN pip install -r requirements.txt
RUN pip install scipy matplotlib scikit-image
docker-compose.yaml:
version: '2.3'
services:
3d:
build: .
volumes:
- .:/app
- .torch:/root/.torch
working_dir: /app
stdin_open: true
tty: true
runtime: nvidia
ipc: host
environment:
- CUDA_VISIBLE_DEVICES=0
command: ./start.sh
start.sh:
#!/bin/sh
Xvfb :0 -screen 0 1024x768x24 -ac +extension GLX +render -noreset &
python -c "import vispy; print(vispy.sys_info())"
python main.py --config argument.yml
To make magic happen type in same folder
> docker-compose up
I've used this as the starting point to make an automated build on Docker Hub here: https://hub.docker.com/r/ryanfb/3d-photo-inpainting
@ryanfb sorry, do you have any ideas how can I fix it?
ymlt@ed-sl-gc16:/3d-photo-inpainting# xvfb-run python main.py --config argument.y
0% 0/1 [00:00<?, ?it/s]Current Source ==> moon
initialize
device: cpu
start processing
processing image/moon.jpg (1/1)
torch.Size([1, 3, 384, 384])
finished
Start Running 3D_Photo ...
Writing mesh file mesh/moon.ply ...
53.13010235415598
WARNING: could not determine DPI
Traceback (most recent call last):
File "main.py", line 115, in <module>
videos_poses, video_basename, config.get('original_h'), config.get('original_w'), border=border, depth=depth, normal_canvas=normal_canvas, all_canvas=all_canvas)
File "/3d-photo-inpainting/mesh.py", line 2203, in output_3d_photo
proj='perspective')
File "/3d-photo-inpainting/mesh.py", line 2132, in __init__
self.canvas = scene.SceneCanvas(bgcolor=bgcolor, size=(canvas_size*factor, canvas_size*factor))
File "/opt/conda/lib/python3.7/site-packages/vispy/scene/canvas.py", line 137, in __init__
always_on_top, px_scale)
File "/opt/conda/lib/python3.7/site-packages/vispy/app/canvas.py", line 205, in __init__
self.create_native()
File "/opt/conda/lib/python3.7/site-packages/vispy/app/canvas.py", line 222, in create_native
self._app.backend_module.CanvasBackend(self, **self._backend_kwargs)
File "/opt/conda/lib/python3.7/site-packages/vispy/app/backends/_egl.py", line 161, in __init__
self._native_config = egl.eglChooseConfig(_EGL_DISPLAY, attribs)[0]
File "/opt/conda/lib/python3.7/site-packages/vispy/ext/egl.py", line 295, in eglChooseConfig
raise RuntimeError('Could not find any suitable config.')
RuntimeError: Could not find any suitable config.
0% 0/1 [06:13<?, ?it/s]
Thanks - it looks like when I was trying to get EGL default rendering working in the container, I installed libglfw3-dev
manually but not in the Dockerfile, and it turns out that it seems to be necessary for the EGL backend to work. I've added it in this commit which should build on Docker Hub in a bit and then you can re-pull, or you can just apt-get install -y libglfw3-dev
in a running instance of the container and see if that fixes it.
@ryanfb It solved the problem, thank you very much ๐ค
But unfrotutetely I got another one.
After generating mesh file it's just gettings stock with a single warning
WARNING: could not determine DPI
I waited like for 20 min, but nothing happend. Taking into account that I'm having nvidia 8x1080ti.
Funny thing, it works great in google colab.
Have no clue where to start debugging.
ymlt@ed-sl-gc16:/3d-photo-inpainting# xvfb-run python main.py --config argument.y
0% 0/1 [00:00<?, ?it/s]Current Source ==> moon
initialize
device: cpu
start processing
processing image/moon.jpg (1/1)
torch.Size([1, 3, 384, 384])
finished
Start Running 3D_Photo ...
Writing mesh file mesh/moon.ply ...
53.13010235415598
WARNING: could not determine DPI
After force cancel I'm getting this error
IO: fatal IO error 11 (Resource temporarily unavailable) on X server ":99"
after 8429 requests (8429 known processed) with 12 events remaining.
Try waiting a while longer on the video render (an hour or so). It seems to be the slowest part, and I'm not sure if will take advantage of multiple GPUs. You can also try dropping num_frames
in argument.yml
to a small value if you just want to test that it can run to completion.
@ryanfb It worked again! Thank you :)
That's weird. It takes like 10 times longer on dedicated server in comparison with google colab.
I thought I have good hardware, lol.
Yeah its kind of weird. I'm running https://sdan.io/3d and it takes longer than Colab and can't figure out why (I'm running on Tesla V100s and 200gb of ram, 64 cpus)
Yeah, there is one service which already use 3d photo inpainting
I just executed the docker pull command. What should I do next? :)
docker run -ti ryanfb/3d-photo-inpainting /bin/bash
cd /3d-photo-inpainting && xvfb-run python main.py --config argument.yml
@ryanfb Thanks for creating the Dockerfile - golden! I'm trying to deploy it in a Kubernetes cluster, but I'm struggling to enable the display. I've added some further context here. If you ran into something similar and know how to fix, I'd appreaciate a nudge in the right direction.