From 9cdf6041631a8f2b35487870e8161b3c64c26801 Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 15 Nov 2024 23:56:39 -0500 Subject: [PATCH] python312Packages.torchvision: fix building on darwin https://hydra.nixos.org/build/278183972 https://hydra.nixos.org/build/278157714 --- .../python-modules/torchvision/default.nix | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/torchvision/default.nix b/pkgs/development/python-modules/torchvision/default.nix index 7ec3e7858b56..2c81797f2e91 100644 --- a/pkgs/development/python-modules/torchvision/default.nix +++ b/pkgs/development/python-modules/torchvision/default.nix @@ -1,7 +1,10 @@ { lib, + stdenv, torch, + apple-sdk_13, buildPythonPackage, + darwinMinVersionHook, fetchFromGitHub, # nativeBuildInputs @@ -44,11 +47,20 @@ buildPythonPackage { which ] ++ lib.optionals cudaSupport [ cudaPackages.cuda_nvcc ]; - buildInputs = [ - libjpeg_turbo - libpng - torch.cxxdev - ]; + buildInputs = + [ + libjpeg_turbo + libpng + torch.cxxdev + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # This should match the SDK used by `torch` above + apple-sdk_13 + + # error: unknown type name 'MPSGraphCompilationDescriptor'; did you mean 'MPSGraphExecutionDescriptor'? + # https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphcompilationdescriptor/ + (darwinMinVersionHook "12.0") + ]; dependencies = [ numpy