From a4a817cc8693fcc1ec0fa56a7cf5b67bded770cd Mon Sep 17 00:00:00 2001 From: Ben Siraphob Date: Wed, 28 Oct 2026 17:18:14 -0400 Subject: [PATCH] python3Packages.grad-cam: fix build Assisted-by: Pi (gpt-6.1-sol) --- .../python-modules/grad-cam/default.nix | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/pkgs/development/python-modules/grad-cam/default.nix b/pkgs/development/python-modules/grad-cam/default.nix index e5fd9a439c68..a2ab800fe0fa 100644 --- a/pkgs/development/python-modules/grad-cam/default.nix +++ b/pkgs/development/python-modules/grad-cam/default.nix @@ -1,11 +1,11 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, setuptools, matplotlib, numpy, - opencv-python, + opencv-python-headless, pillow, scikit-learn, torch, @@ -19,11 +19,19 @@ buildPythonPackage rec { version = "1.5.7"; pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-9r4G+CZnei6SLDh535vjlEsUppZD2A577Jrfsm9rXkI="; + src = fetchFromGitHub { + owner = "jacobgil"; + repo = "pytorch-grad-cam"; + rev = "704393448a7b0c620ee2c2b9597723f1d7f17b3d"; + hash = "sha256-qNmIl+kERDiJeig6A9UjnwUd7VaO91QqhwszaszLAow="; }; + # Runtime sources match the 1.5.7 sdist, but GitHub's setup.py still declares 1.5.5. + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "version='1.5.5'" "version='${version}'" + ''; + nativeBuildInputs = [ ]; @@ -38,7 +46,7 @@ buildPythonPackage rec { dependencies = [ matplotlib numpy - opencv-python + opencv-python-headless pillow scikit-learn torchvision