vt-vl-lab / 3d-photo-inpainting

[CVPR 2020] 3D Photography using Context-aware Layered Depth Inpainting
https://shihmengli.github.io/3D-Photo-Inpainting/
Other
6.88k stars 1.11k forks source link

Problem with PyQt5 #83

Open bibhas2 opened 3 years ago

bibhas2 commented 3 years ago

I am running in a docker container in macOS. I think the container is missing OpenGL. How do I fix that?

main.py is failing after a long time with this message.

WARNING: Could not load OpenGL library.
running on device cpu
  0%|                                                                                                       | 0/1 [00:00<?, ?it/s]Current Source ==>  moon
Running depth extraction at 1595437846.1242821
initialize
device: cpu
start processing
  processing image/moon.jpg (1/1)
torch.Size([1, 3, 384, 384])
finished
Start Running 3D_Photo ...
Loading edge model at 1595437869.7599049
Loading depth model at 1595437869.9819047
Loading rgb model at 1595437871.283845
Writing depth ply (and basically doing everything) at 1595437872.7684999
Writing mesh file mesh/moon.ply ...
Making video at 1595438313.7236035
fov: 53.13010235415598
WARNING: Although PyQt5 is already imported, the PyQt5 backend could not
be used ("libGL.so.1: cannot open shared object file: No such file or directory"). 
Note that running multiple GUI toolkits simultaneously can cause side effects.
  0%|                                                                                                       | 0/1 [07:52<?, ?it/s]
Traceback (most recent call last):
  File "main.py", line 137, in <module>
    mean_loc_depth=mean_loc_depth)
  File "/3d-photo-inpainting/mesh.py", line 2203, in output_3d_photo
    proj='perspective')
  File "/3d-photo-inpainting/mesh.py", line 2134, in __init__
    self.canvas = scene.SceneCanvas(bgcolor=bgcolor, size=(canvas_size*factor, canvas_size*factor))
  File "/opt/conda/envs/3DP/lib/python3.7/site-packages/vispy/scene/canvas.py", line 137, in __init__
    always_on_top, px_scale)
  File "/opt/conda/envs/3DP/lib/python3.7/site-packages/vispy/app/canvas.py", line 169, in __init__
    self._app = use_app(call_reuse=False)
  File "/opt/conda/envs/3DP/lib/python3.7/site-packages/vispy/app/_default_app.py", line 47, in use_app
    default_app = Application(backend_name)
  File "/opt/conda/envs/3DP/lib/python3.7/site-packages/vispy/app/application.py", line 49, in __init__
    self._use(backend_name)
  File "/opt/conda/envs/3DP/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
liviclee commented 3 years ago

I meet the same issue and I am running in a docker container in Unbuntu 18.04.

(3DP) jiavili@shaoguowen-LC1:~/WebXR-3DP/3d-photo-inpainting$ python main.py --config argument.yml
WARNING: Could not load OpenGL library.
running on device 1
  0%|                                                                                                                                                                     | 0/1 [00:00<?, ?it/s]Current Source ==>  moon
Running depth extraction at 1596654019.6363363
initialize
device: cpu
start processing
  processing image/moon.jpg (1/1)
torch.Size([1, 3, 384, 384])
finished
Start Running 3D_Photo ...
Loading edge model at 1596654035.1774054
Loading depth model at 1596654037.208895
Loading rgb model at 1596654037.7980866
Writing depth ply (and basically doing everything) at 1596654038.3231933
Writing mesh file mesh/moon.ply ...
Making video at 1596654220.3630939
fov: 53.13010235415598
WARNING: could not determine DPI
WARNING: Although PyQt5 is already imported, the PyQt5 backend could not
be used ("libGL.so.1: cannot open shared object file: No such file or directory").
Note that running multiple GUI toolkits simultaneously can cause side effects.
  0%|                                                                                                                                                                     | 0/1 [03:24<?, ?it/s]
Traceback (most recent call last):
  File "main.py", line 137, in <module>
    mean_loc_depth=mean_loc_depth)
  File "/home/jiavili/WebXR-3DP/3d-photo-inpainting/mesh.py", line 2203, in output_3d_photo
    proj='perspective')
  File "/home/jiavili/WebXR-3DP/3d-photo-inpainting/mesh.py", line 2134, in __init__
    self.canvas = scene.SceneCanvas(bgcolor=bgcolor, size=(canvas_size*factor, canvas_size*factor))
  File "/home/jiavili/anaconda3/envs/3DP/lib/python3.7/site-packages/vispy/scene/canvas.py", line 137, in __init__
    always_on_top, px_scale)
  File "/home/jiavili/anaconda3/envs/3DP/lib/python3.7/site-packages/vispy/app/canvas.py", line 169, in __init__
    self._app = use_app(call_reuse=False)
  File "/home/jiavili/anaconda3/envs/3DP/lib/python3.7/site-packages/vispy/app/_default_app.py", line 47, in use_app
    default_app = Application(backend_name)
  File "/home/jiavili/anaconda3/envs/3DP/lib/python3.7/site-packages/vispy/app/application.py", line 49, in __init__
    self._use(backend_name)
  File "/home/jiavili/anaconda3/envs/3DP/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
liviclee commented 3 years ago

Update: I refer to this page: https://gist.github.com/ujjwal96/1dcd57542bdaf3c9d1b0dd526ccd44ff and solve the problem.

Installation

pip3 install --user pyqt5  
sudo apt-get install python3-pyqt5  
sudo apt-get install pyqt5-dev-tools
sudo apt-get install qttools5-dev-tools

Configuring to run from terminal

$ qtchooser -run-tool=designer -qt=5