isl-org / Open3D-ML

An extension of Open3D to address 3D Machine Learning tasks
Other
1.87k stars 321 forks source link

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

Open ccoulombe opened 10 months ago

ccoulombe commented 10 months ago

Checklist

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

# 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 "<stdin>", line 1, in <module>
  File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/__init__.py", line 146, in <module>
    import open3d.ml
  File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/ml/__init__.py", line 16, in <module>
    from . import datasets
  File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/ml/datasets.py", line 15, in <module>
    from open3d._ml3d.datasets import *
  File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/datasets/__init__.py", line 3, in <module>
    from .semantickitti import SemanticKITTI
  File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/datasets/semantickitti.py", line 10, in <module>
    from .utils import DataProcessing
  File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/datasets/utils/__init__.py", line 6, in <module>
    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 <module>
    from ...vis import BoundingBox3D
  File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/vis/__init__.py", line 5, in <module>
    from .visualizer import *
  File "/home/coulombc/.envs/14710/lib/python3.11/site-packages/open3d/_ml3d/vis/visualizer.py", line 6, in <module>
    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

- 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