From d7e700ca6699df40d38ec2668e3017857a66ffec Mon Sep 17 00:00:00 2001 From: johnthagen Date: Wed, 10 Jan 2024 07:32:25 -0500 Subject: [PATCH 1/2] Use PEP 503 environment markers to control ML dependency installation --- python/setup.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/python/setup.py b/python/setup.py index 029c5717180..49f404a9f5e 100644 --- a/python/setup.py +++ b/python/setup.py @@ -94,9 +94,18 @@ def finalize_options(self): install_requires = [line.strip() for line in f.readlines() if line] # Read requirements for ML. -if "@BUNDLE_OPEN3D_ML@" == "ON": - with open("@OPEN3D_ML_ROOT@/requirements.txt", "r") as f: - install_requires += [line.strip() for line in f.readlines() if line] +with open("@OPEN3D_ML_ROOT@/requirements.txt", "r") as f: + # Unconditionally include the ML dependencies so that all wheels share + # the same dependencies. This is needed for the PyPI JSON API to + # return consistent results, which tools such as Poetry depend on. + # https://discuss.python.org/t/pep-rfc-python-package-index-warehouse-json-api-v1/9205/23 + # Use PEP 508 environment markers to limit installation of ML + # dependencies to only where they are needed. + install_requires += [ + f'{line.strip()} ; platform_system == "Darwin" or (platform_system == "Linux" and platform_machine == "x86_64")' + for line in f.readlines() + if line + ] entry_points = { "console_scripts": ["open3d = @PYPI_PACKAGE_NAME@.tools.cli:main",] From dab48481df7f4d699a8887de4179642ddada7a57 Mon Sep 17 00:00:00 2001 From: johnthagen Date: Wed, 10 Jan 2024 07:46:17 -0500 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dadd273cc9..aa05170dd3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Rename master branch to main. - Support in memory loading of XYZ files - Fix geometry picker Error when LineSet objects are presented (PR #6499) +- Use PEP 508 environment markers to control ML dependency installation (PR #6588) ## 0.13