Open3D
Open3D copied to clipboard
Cannot compile on under Headless Ubuntu 18.04 and module 'open3d.visualization' has no attribute 'rendering'
Checklist
- [X] I have searched for similar issues.
- [X] For Python issues, I have tested with the latest development wheel.
- [X] I have checked the release documentation and the latest documentation (for
masterbranch).
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:

Then, I make install-pip-package:

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'

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
I think this filament module is not installed successfully
_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 BUILD_GUI, 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'_
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!
@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.
@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"
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 usecudaglto 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