Skip to content

Commit 41f17dc

Browse files
committed
Support for Python Optional Dependencies
Split out visualization and ml modules as optional dependencies
1 parent a5be78c commit 41f17dc

16 files changed

Lines changed: 99 additions & 40 deletions

.github/workflows/windows.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ jobs:
276276
run: |
277277
$ErrorActionPreference = 'Stop'
278278
python -m pip install -r python/requirements.txt
279+
python -m pip install -r python/requirements_gui.txt
279280
python -m pip install -r python/requirements_jupyter_build.txt
280281
281282
- name: Config
@@ -399,7 +400,7 @@ jobs:
399400
$PIP_PKG_NAME=(Get-ChildItem open3d*-$py_tag-*.whl).Name
400401
}
401402
echo "Installing Open3D wheel $PIP_PKG_NAME in virtual environment..."
402-
python -m pip install "$PIP_PKG_NAME"
403+
python -m pip install "$PIP_PKG_NAME[gui,ml]"
403404
python -c "import open3d; print('Imported:', open3d)"
404405
python -c "import open3d; print('CUDA enabled: ', open3d.core.cuda.is_available())"
405406

3rdparty/README_SYCL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Open3D is designed to make use of the SYCL GPU devices.
9898

9999
## List of oneAPI Python packages
100100

101-
To make `pip install open3d` works out-of-the box on SYCL-enabled platforms,
101+
To make `pip install open3d[gui,ml]` works out-of-the box on SYCL-enabled platforms,
102102
we can utilize runtime libraries released via PyPI. This feature needs to be
103103
implemented.
104104

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* Fix raycasting scene: Allow setting of number of threads that are used for building a raycasting scene
1313
* Fix Python bindings for CUDA device synchronization, voxel grid saving (PR #5425)
1414
* Support msgpack versions without cmake
15+
* Introduce new optional dependencies support, allowing you to do `pip install open3d` with any of `gui`, `ml`, `tf`, `torch`, `all` such as `pip install open3d[gui,ml]`
1516

1617
## 0.13
1718

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ Pre-built pip packages support Ubuntu 18.04+, macOS 10.15+ and Windows 10+
4949

5050
```bash
5151
# Install
52-
pip install open3d # or
53-
pip install open3d-cpu # Smaller CPU only wheel on x86_64 Linux (v0.17+)
52+
pip install open3d[gui,ml] # or
53+
pip install open3d-cpu[gui,ml] # Smaller CPU only wheel on x86_64 Linux (v0.17+)
5454

5555
# Verify installation
5656
python -c "import open3d as o3d; print(o3d.__version__)"

cpp/pybind/make_install_pip_package.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# it is guaranteed that there is only one wheel in ${PYTHON_PACKAGE_DST_DIR}/pip_package/*.whl
66
file(GLOB WHEEL_FILE "${PYTHON_PACKAGE_DST_DIR}/pip_package/*.whl")
77
execute_process(COMMAND ${Python3_EXECUTABLE} -m pip uninstall open3d --yes)
8-
execute_process(COMMAND ${Python3_EXECUTABLE} -m pip install ${WHEEL_FILE} -U)
8+
execute_process(COMMAND ${Python3_EXECUTABLE} -m pip install "${WHEEL_FILE}[gui,ml]" -U)

cpp/pybind/make_python_package.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ if (BUILD_JUPYTER_EXTENSION)
113113
# These will be installed when `pip install open3d`.
114114
execute_process(COMMAND ${CMAKE_COMMAND} -E cat
115115
${PYTHON_PACKAGE_SRC_DIR}/requirements.txt
116+
${PYTHON_PACKAGE_SRC_DIR}/requirements_gui.txt
116117
${PYTHON_PACKAGE_SRC_DIR}/requirements_jupyter_install.txt
117118
OUTPUT_VARIABLE ALL_REQUIREMENTS
118119
)

docker/Dockerfile.openblas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ COPY ./python/requirements*.txt /root/Open3D/python/
7272
RUN which python \
7373
&& python --version \
7474
&& python -m pip install -U -r /root/Open3D/python/requirements.txt \
75+
-r /root/Open3D/python/requirements_gui.txt \
7576
-r /root/Open3D/python/requirements_build.txt \
7677
-r /root/Open3D/python/requirements_test.txt
7778

docs/arm.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ we provide pre-compiled ARM64 wheels for Linux and macOS. Install the wheel by:
99

1010
.. code-block:: bash
1111
12-
pip install open3d
12+
pip install open3d[gui,ml]
1313
python -c "import open3d; print(open3d.__version__)"
1414
1515
# Test the legacy visualizer
@@ -18,21 +18,21 @@ we provide pre-compiled ARM64 wheels for Linux and macOS. Install the wheel by:
1818
# Test the new GUI visualizer
1919
python -c "import open3d as o3d; c = o3d.geometry.TriangleMesh.create_box(); o3d.visualization.draw(c)"
2020
21-
+------------------------+----------------+---------------------+------------+----------------+
22-
| | Linux (OpenGL) | Linux (OpenGL ES) | macOS | Windows on ARM |
23-
+========================+================+=====================+============+================+
24-
| ``pip install open3d`` | Yes | Yes | Yes | No |
25-
+------------------------+----------------+---------------------+------------+----------------+
26-
| Compile from source | Yes | Yes | Yes | No |
27-
+------------------------+----------------+---------------------+------------+----------------+
28-
| Visualizer and GUI | Yes | No | Yes | No |
29-
+------------------------+----------------+---------------------+------------+----------------+
30-
| Non-GUI features | Yes | Yes | Yes | No |
31-
+------------------------+----------------+---------------------+------------+----------------+
32-
| Special build flags | Not needed | ``-DBUILD_GUI=OFF`` | Not needed | N/A |
33-
+------------------------+----------------+---------------------+------------+----------------+
34-
| Example device | Nvidia Jetson | Raspberry Pi 4 | M1 MacBook | Surface Pro X |
35-
+------------------------+----------------+---------------------+------------+----------------+
21+
+--------------------------------+----------------+---------------------+------------+----------------+
22+
| | Linux (OpenGL) | Linux (OpenGL ES) | macOS | Windows on ARM |
23+
+================================+================+=====================+============+================+
24+
| ``pip install open3d[gui,ml]`` | Yes | Yes | Yes | No |
25+
+--------------------------------+----------------+---------------------+------------+----------------+
26+
| Compile from source | Yes | Yes | Yes | No |
27+
+--------------------------------+----------------+---------------------+------------+----------------+
28+
| Visualizer and GUI | Yes | No | Yes | No |
29+
+--------------------------------+----------------+---------------------+------------+----------------+
30+
| Non-GUI features | Yes | Yes | Yes | No |
31+
+--------------------------------+----------------+---------------------+------------+----------------+
32+
| Special build flags | Not needed | ``-DBUILD_GUI=OFF`` | Not needed | N/A |
33+
+--------------------------------+----------------+---------------------+------------+----------------+
34+
| Example device | Nvidia Jetson | Raspberry Pi 4 | M1 MacBook | Surface Pro X |
35+
+--------------------------------+----------------+---------------------+------------+----------------+
3636

3737
Additional notes:
3838

@@ -107,7 +107,7 @@ TBB, Parallel STL, BLAS, LAPACK) may cause compatibility issues if they are not
107107
the same version as the one used by Open3D.
108108

109109
If you only need the Python wheel, consider using the Docker build method or
110-
install Open3D via ``pip install open3d`` directly.
110+
install Open3D via ``pip install open3d[gui,ml]`` directly.
111111

112112
Install dependencies
113113
````````````````````

docs/docker.in.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Python applications looks like this:
4242
4343
# Install Open3D from the PyPI repositories
4444
RUN python3 -m pip install --no-cache-dir --upgrade pip && \
45-
python3 -m pip install --no-cache-dir --upgrade open3d
45+
python3 -m pip install --no-cache-dir --upgrade open3d[gui,ml]
4646
4747
If you have an NVIDIA GPU and want to use it for computation (``CUDA``) or
4848
visualization, follow these `directions.

docs/getting_started.in.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ Pip (PyPI)
3535

3636
.. code-block:: bash
3737
38-
pip install open3d # or
39-
pip install open3d-cpu # Smaller CPU only wheel on x86_64 Linux (since v0.17+)
38+
pip install open3d[gui,ml] # or
39+
pip install open3d-cpu[gui,ml] # Smaller CPU only wheel on x86_64 Linux (since v0.17+)
4040
41+
.. note::
42+
Above will work for most purposes and aligns with behavior seen in `v0.17` and below.
43+
Using anything under :mod:`open3d.visualization` will require ``[gui]`` where as
44+
using anything under :mod:`open3d.ml` will require ``[ml]``.
4145

4246
.. note::
4347
Please upgrade your ``pip`` to a version >=20.3 to install Open3D in Linux,
@@ -54,11 +58,11 @@ Pip (PyPI)
5458

5559
.. code-block:: bash
5660
57-
pip3 install open3d
61+
pip3 install open3d[gui,ml]
5862
# or
59-
pip install --user open3d
63+
pip install --user open3d[gui,ml]
6064
# or
61-
python3 -m pip install --user open3d
65+
python3 -m pip install --user open3d[gui,ml]
6266
6367
Development version (pip)
6468
-------------------------

0 commit comments

Comments
 (0)