isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
10.83k stars 2.24k forks source link

Cannot compile on under Headless Ubuntu 18.04 and module 'open3d.visualization' has no attribute 'rendering' #5505

Open lcc157 opened 1 year ago

lcc157 commented 1 year ago

Checklist

Steps to reproduce the issue

I want to render and save images from a terminal without any display device

the cmake command is the following: cmake -DENABLE_HEADLESS_RENDERING=ON \ -DBUILD_GUI=OFF \ -DBUILD_WEBRTC=OFF \ -DUSE_SYSTEM_GLEW=OFF \ -DUSE_SYSTEM_GLFW=OFF \ .. The result of cmake is as follows: image

Then, I make install-pip-package: image

Finally, successfully tested the provided Python script for saving depth and surface normal sequences: cd ~/Open3D/examples/python/visualization python headless_rendering.py This should print the following: Capture image 00000 Capture image 00001 Capture image 00002

It all looks normal!

But, when i want to test own program : render = o3d.visualization.rendering.OffscreenRenderer(width, height, headless=True) AttributeError: module 'open3d.visualization' has no attribute 'rendering'

image

Error message

render = o3d.visualization.rendering.OffscreenRenderer(width, height, headless=True)
AttributeError: module 'open3d.visualization' has no attribute 'rendering'

I don't know if the compilation is correct, if not how to fix it, thank you!

Open3D, Python and System information

- Operating system: Ubuntu 18.04
- Python version: Python 3.7
- Open3D version: output from python: `print(open3d.__version__)`
- System architecture: x86
- Is this a remote workstation?: yes
- How did you install Open3D?: build from source
- Compiler version (if built from source): gcc 7.5

Additional information

No response

lcc157 commented 1 year ago

image I think this filament module is not installed successfully

lcc157 commented 1 year ago

_I noticed that “The Filament-based GUI implementation is not compatible with headless rendering, please set -DBUILD_GUI=OFF.” So, the remote workstation is unavailable OffscreenRenderer?

import open3d.visualization.rendering as rendering Open3D was not compiled with BUILDGUI, but script is importing open3d.visualization.rendering render = rendering.OffscreenRenderer(640, 480, headless=True) Traceback (most recent call last): File "", line 1, in AttributeError: module 'open3d.visualization.rendering' has no attribute 'OffscreenRenderer'

kzky commented 1 year ago

I got into the same problem, but finally I realized OffscreenRenderer does not need headless build. Just use OffscreenRenderer(..., headless=True) after installing Open3D by pip. If using docker container on a server, do not set DISPLAY environment variable and use cudagl to fix eglinitialization issue. Finally, I could render image on a server with segmentaion fault error msg, but I could get an expected rendered image!

Ostyk commented 1 year ago

@kzky so you completely omitted setting the DISPLAY variable? As far as I understand http://www.open3d.org/docs/latest/docker.html - they claim the opposite.

lcc157 commented 1 year ago

@kzky Can you tell me in detail how to use cuda gl to solve the eglinitialization issue, like "LD_PRELOAD=/usr/local/nvidia/lib/libEGL.so python3 render_to_image.py"

kungkook commented 1 year ago

I got into the same problem, but finally I realized OffscreenRenderer does not need headless build. Just use OffscreenRenderer(..., headless=True) after installing Open3D by pip. If using docker container on a server, do not set DISPLAY environment variable and use cudagl to fix eglinitialization issue. Finally, I could render image on a server with segmentaion fault error msg, but I could get an expected rendered image!

hello~ i use pip install open3d0.16.0 in windows11, but when i run: o3d.visualization.rendering.OffscreenRenderer(width=img_w, height=img_h, headless=True),ERROR occur: TypeError: init(): incompatible constructor arguments. The following argument types are supported:

  1. open3d.cpu.pybind.visualization.rendering.OffscreenRenderer(width: int, height: int, resource_path: str = '')

Invoked with: kwargs: width=1440, height=1080, headless=True