Repository: secondmind-labs/trieste

Issue:
Cannot install trieste from pypi on MacOS
**Describe the bug**
`pip install trieste` fails on MacOS

**To reproduce**
Steps to reproduce the behaviour:
```
$ pip install trieste
Collecting trieste
  Downloading trieste-1.1.2-py3-none-any.whl (246 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 246.6/246.6 kB 3.4 MB/s eta 0:00:00
  Downloading trieste-1.1.1-py3-none-any.whl (246 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 246.5/246.5 kB 10.5 MB/s eta 0:00:00
  Downloading trieste-1.1.0-py3-none-any.whl (246 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 246.5/246.5 kB 10.5 MB/s eta 0:00:00
  Downloading trieste-1.0.0-py3-none-any.whl (240 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 240.4/240.4 kB 16.6 MB/s eta 0:00:00
  Using cached trieste-0.13.3-py3-none-any.whl (233 kB)
  Using cached trieste-0.13.2-py3-none-any.whl (218 kB)
  Using cached trieste-0.13.1-py3-none-any.whl (220 kB)
Collecting dill==0.3.4
  Using cached dill-0.3.4-py2.py3-none-any.whl (86 kB)
Collecting gpflow==2.5.2
  Using cached gpflow-2.5.2-py3-none-any.whl (383 kB)
Collecting trieste
  Using cached trieste-0.13.0-py3-none-any.whl (215 kB)
  Using cached trieste-0.12.0-py3-none-any.whl (208 kB)
  Using cached trieste-0.11.3-py3-none-any.whl (196 kB)
  Using cached trieste-0.11.2-py3-none-any.whl (196 kB)
  Using cached trieste-0.11.1-py3-none-any.whl (195 kB)
  Using cached trieste-0.11.0-py3-none-any.whl (195 kB)
  Using cached trieste-0.10.0-py3-none-any.whl (168 kB)
  Using cached trieste-0.9.1-py3-none-any.whl (139 kB)
  Using cached trieste-0.9.0-py3-none-any.whl (136 kB)
  Using cached trieste-0.8.0-py3-none-any.whl (150 kB)
  Using cached trieste-0.7.0-py3-none-any.whl (110 kB)
  Using cached trieste-0.6.1-py3-none-any.whl (77 kB)
  Using cached trieste-0.6.0-py3-none-any.whl (77 kB)
  Using cached trieste-0.5.1-py3-none-any.whl (63 kB)
Collecting gpflow==2.2.*
  Using cached gpflow-2.2.1-py3-none-any.whl (271 kB)
Collecting numpy
  Downloading numpy-1.24.3-cp39-cp39-macosx_11_0_arm64.whl (13.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.9/13.9 MB 16.5 MB/s eta 0:00:00
Collecting trieste
  Using cached trieste-0.5.0-py3-none-any.whl (63 kB)
Collecting gpflow==2.1.*
  Using cached gpflow-2.1.5-py3-none-any.whl (260 kB)
Collecting trieste
  Using cached trieste-0.4.0-py3-none-any.whl (43 kB)
  Using cached trieste-0.3.1-py3-none-any.whl (38 kB)
  Using cached trieste-0.3.0-py3-none-any.whl (38 kB)
  Using cached trieste-0.2.0-py3-none-any.whl (35 kB)
ERROR: Cannot install trieste==0.10.0, trieste==0.11.0, trieste==0.11.1, trieste==0.11.2, trieste==0.11.3, trieste==0.12.0, trieste==0.13.0, trieste==0.13.1, trieste==0.13.2, trieste==0.13.3, trieste==0.2.0, trieste==0.3.0, trieste==0.3.1, trieste==0.4.0, trieste==0.5.0, trieste==0.5.1, trieste==0.6.0, trieste==0.6.1, trieste==0.7.0, trieste==0.8.0, trieste==0.9.0, trieste==0.9.1, trieste==1.0.0, trieste==1.1.0, trieste==1.1.1 and trieste==1.1.2 because these package versions have conflicting dependencies.

The conflict is caused by:
    trieste 1.1.2 depends on tensorflow>=2.5
    trieste 1.1.1 depends on tensorflow>=2.5
    trieste 1.1.0 depends on tensorflow>=2.5
    trieste 1.0.0 depends on tensorflow>=2.5
    trieste 0.13.3 depends on tensorflow>=2.5
    trieste 0.13.2 depends on tensorflow>=2.4
    trieste 0.13.1 depends on tensorflow>=2.4
    trieste 0.13.0 depends on tensorflow>=2.4
    trieste 0.12.0 depends on tensorflow>=2.4
    trieste 0.11.3 depends on tensorflow>=2.4
    trieste 0.11.2 depends on tensorflow>=2.4
    trieste 0.11.1 depends on tensorflow>=2.4
    trieste 0.11.0 depends on tensorflow>=2.4
    trieste 0.10.0 depends on tensorflow>=2.4
    trieste 0.9.1 depends on tensorflow>=2.4
    trieste 0.9.0 depends on tensorflow>=2.4
    trieste 0.8.0 depends on tensorflow>=2.4
    trieste 0.7.0 depends on tensorflow>=2.4
    trieste 0.6.1 depends on tensorflow>=2.4
    trieste 0.6.0 depends on tensorflow>=2.4
    trieste 0.5.1 depends on tensorflow!=2.2.0, !=2.3.0 and >=2.1
    trieste 0.5.0 depends on tensorflow!=2.2.0, !=2.3.0 and >=2.1
    trieste 0.4.0 depends on tensorflow!=2.2.0, !=2.3.0 and >=2.1
    trieste 0.3.1 depends on tensorflow!=2.2.0, !=2.3.0 and >=2.1
    trieste 0.3.0 depends on tensorflow!=2.2.0, !=2.3.0 and >=2.1
    trieste 0.2.0 depends on tensorflow!=2.2.0, !=2.3.0 and >=2.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts
```

**Expected behaviour**
It should be possible to install trieste from pypi on MacOS

**System information**
 - OS: MacOS Ventura 13.2
 - Python version: 3.8.13
 - Trieste version: 0.2.0 - 1.1.2
 - TensorFlow version: 2.11.0
 - GPflow version: 2.8.0




Discussion:
GPFlux has updated the third party dependencies list to conditionally install `tensorflow-macos` based on the setuptools platform and architecture flags. It would be useful to have a similar modification to the third party dependencies of `trieste`.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -43,7 +43,8 @@
         "gpflow>=2.7.0",
         "gpflux>=0.4.0",
         "numpy",
-        "tensorflow>=2.5",
+        "tensorflow>=2.5; platform_system!='Darwin' or platform_machine!='arm64'",
+        "tensorflow-macos>=2.5; platform_system=='Darwin' and platform_machine=='arm64'",
         "tensorflow-probability>=0.13",
         "greenlet>=1.1.0",
     ],


Test patch: