Skip to content

Commit 74441ab

Browse files
build: Install tensorflow-macos on Apple silicon Macs (#2119)
* 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 Linux machine: >>> import platform >>> platform.machine() 'x86_64' >>> platform.system() 'Linux' - x86-64 Apple machine: >>> import platform >>> platform.machine() 'x86_64' >>> platform.system() 'Darwin' - AArch64 machine: >>> import platform >>> platform.machine() 'aarch64' >>> platform.system() 'Linux' - Apple silicon machine: >>> import platform >>> platform.machine() 'arm64' >>> platform.system() 'Darwin'
1 parent 46ce316 commit 74441ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ Homepage = "https://github.com/scikit-hep/pyhf"
6666
[project.optional-dependencies]
6767
shellcomplete = ["click_completion"]
6868
tensorflow = [
69-
"tensorflow>=2.7.0", # c.f. PR #1962
69+
"tensorflow>=2.7.0; platform_machine != 'arm64'", # c.f. PR #1962
70+
"tensorflow-macos>=2.7.0; platform_machine == 'arm64' and platform_system == 'Darwin'", # c.f. PR #2119
7071
"tensorflow-probability>=0.11.0", # c.f. PR #1657
7172
]
7273
torch = ["torch>=1.10.0"] # c.f. PR #1657

0 commit comments

Comments
 (0)