From 52fba6f91b4a56cda26d9173d69e8b61ba407995 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 16 Feb 2023 01:40:09 -0600 Subject: [PATCH 1/3] build: Install tensorflow-macos on Apple silicon Macs * Use hatchling's environment markers system to use platform information to determine when the installing machine is an Apple silicon Mac and install tensorflow-macos instead of tensorflow in this situation. - c.f. https://hatch.pypa.io/latest/config/dependency/#environment-markers * This works because of the following: - x86 64 machine: >>> import platform >>> platform.machine() 'x86_64' >>> platform.system() 'Linux' - AArch64 machine: >>> import platform >>> platform.machine() 'aarch64' >>> platform.system() 'Linux' - Apple silicon machine: >>> import platform >>> platform.machine() 'arm64' >>> platform.system() 'Darwin' --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bb2d30930a..0655338cf2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,8 @@ Homepage = "https://github.com/scikit-hep/pyhf" [project.optional-dependencies] shellcomplete = ["click_completion"] tensorflow = [ - "tensorflow>=2.7.0", # c.f. PR #1962 + "tensorflow>=2.7.0 and platform_machine != 'arm64'", # c.f. PR #1962 + "tensorflow-macos>=2.7.0 and platform_machine == 'arm64' and platform_system == 'Darwin'", # c.f. PR #1962 "tensorflow-probability>=0.11.0", # c.f. PR #1657 ] torch = ["torch>=1.10.0"] # c.f. PR #1657 From 600585d55084ff816fc2d9a7c942723079bf82c5 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 16 Feb 2023 01:57:04 -0600 Subject: [PATCH 2/3] fix syntax --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0655338cf2..c15ed82fdf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,8 +66,8 @@ Homepage = "https://github.com/scikit-hep/pyhf" [project.optional-dependencies] shellcomplete = ["click_completion"] tensorflow = [ - "tensorflow>=2.7.0 and platform_machine != 'arm64'", # c.f. PR #1962 - "tensorflow-macos>=2.7.0 and platform_machine == 'arm64' and platform_system == 'Darwin'", # c.f. PR #1962 + "tensorflow>=2.7.0; platform_machine != 'arm64'", # c.f. PR #1962 + "tensorflow-macos>=2.7.0; platform_machine == 'arm64' and platform_system == 'Darwin'", # c.f. PR #1962 "tensorflow-probability>=0.11.0", # c.f. PR #1657 ] torch = ["torch>=1.10.0"] # c.f. PR #1657 From b970ed41c55c706dc9a2de00e37fda8a1284b533 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 16 Feb 2023 02:09:16 -0600 Subject: [PATCH 3/3] Update reference PR number --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c15ed82fdf..07336892d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,7 +67,7 @@ Homepage = "https://github.com/scikit-hep/pyhf" shellcomplete = ["click_completion"] tensorflow = [ "tensorflow>=2.7.0; platform_machine != 'arm64'", # c.f. PR #1962 - "tensorflow-macos>=2.7.0; platform_machine == 'arm64' and platform_system == 'Darwin'", # c.f. PR #1962 + "tensorflow-macos>=2.7.0; platform_machine == 'arm64' and platform_system == 'Darwin'", # c.f. PR #2119 "tensorflow-probability>=0.11.0", # c.f. PR #1657 ] torch = ["torch>=1.10.0"] # c.f. PR #1657