isl-org / isl-org/Open3D

Make dash an optional dependency

Open
#5,740 1 comment 9 reactions 0 assignees View on GitHub
feature request
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, 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 `master` branch).

### Proposed new feature or change

Current `dash` is a hard requirement of Open3D:

https://github.com/isl-org/Open3D/blob/6dcb7f53b1a6ad81a27857573d21e05edc26df6c/python/requirements.txt#L2

But for headless use of Open3D, this extra requirement pulls in a large number (13) of sub-dependencies, including a web server, Flask, as visualized by [`pipdeptree`](https://github.com/tox-dev/pipdeptree):

```
- dash [required: >=2.6.0, installed: 2.7.0]
- dash-core-components [required: ==2.0.0, installed: 2.0.0]
- dash-html-components [required: ==2.0.0, installed: 2.0.0]
- dash-table [required: ==5.0.0, installed: 5.0.0]
- Flask [required: >=1.0.4, installed: 2.2.2]
- click [required: >=8.0, installed: 8.1.3]
- importlib-metadata [required: >=3.6.0, installed: 5.1.0]
- zipp [required: >=0.5, installed: 3.11.0]
- itsdangerous [required: >=2.0, installed: 2.1.2]
- Jinja2 [required: >=3.0, installed: 3.1.2]
- MarkupSafe [required: >=2.0, installed: 2.1.1]
- Werkzeug [required: >=2.2.2, installed: 2.2.2]
- MarkupSafe [required: >=2.1.1, installed: 2.1.1]
```

`dash` is only used in one function:

https://github.com/isl-org/Open3D/blob/c074f5d00b5bdf37266f71a87125156b1087ac98/python/open3d/visualization/draw_plotly.py#L240

If this were made an optional dependency, it would reduce on CI load for packages that test Open3D and do not use this feature. It also reduces the size of container images for Python applications using Open3D that do not use this feature. Also, the extra dependencies can complicate version resolution for users who lock their dependency versions using a tool such as Poetry or `pip-tools`.

To declare an optional dependency in `setuptools`:

- https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#optional-dependencies

This could look like in `setup.py`:

```py
setup(
install_requires=["dash[visualizaion]"],
...,
)
```

And users could be instructed to opt-in to this by running:

```
pip install open3d[visualization]
```

### References

_No response_

### Additional information

Related to:

- #5124

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.