isl-org / isl-org/Open3D-ML

Importing opend3d fails since open3d-ml doesn't check for build_gui

Open
#637 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
2.3k
Forks
365
Avg merge
4h 6m
Merged PRs (30d)
1

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D-ML/issues).
- [X] I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `main` branch).

### Describe the issue

When Open3D has been built without GUI support, it should still be able to import correctly.
It currently fails since there's no check if it was built or not with GUI in Open3D-ML.

### Steps to reproduce the bug

```python
# Build Open3d with `-DBUILD_GUI=OFF -DBUILD_PYTORCH_OPS=ON -DBUNDLE_OPEN3D_ML=ON -DOPEN3D_ML_ROOT=$PWD/Open3D-ML` (for cpu or gpu)

python -c 'import open3d'
```
```

### Error message

```python
>>> import open3d
Traceback (most recent call last):
File "", line 1, in
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/__init__.py", line 146, in
import open3d.ml
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/ml/__init__.py", line 16, in
from . import datasets
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/ml/datasets.py", line 15, in
from open3d._ml3d.datasets import *
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/datasets/__init__.py", line 3, in
from .semantickitti import SemanticKITTI
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/datasets/semantickitti.py", line 10, in
from .utils import DataProcessing
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/datasets/utils/__init__.py", line 6, in
from .bev_box import BEVBox3D
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/datasets/utils/bev_box.py", line 1, in
from ...vis import BoundingBox3D
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/vis/__init__.py", line 5, in
from .visualizer import *
File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/vis/visualizer.py", line 6, in
from open3d.visualization import gui
ImportError: cannot import name 'gui' from 'open3d.visualization' (/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/visualization/__init__.py)
```

### Expected behavior

Import correctly.
```
>>> import open3d
>>>
```

### Open3D, Python and System information

```markdown
- Operating system: Centos
- Python version: Any
- Open3D version: 0.18
- System type: x86
- Is this remote workstation?: yes
- How did you install Open3D?: from source
- Compiler version (if built from source): GCC 9, clang
```

### Additional information

Partial solution in #636

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.