From 1b7107b4b3f805c3deefcadf8bf209340d8a684d Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Mon, 15 Jan 2024 10:08:43 +0100 Subject: [PATCH] python311Packages.torchmetrics: fix build --- ...illegal-name-from-extra-dependencies.patch | 24 +++++++++++++++++++ .../python-modules/torchmetrics/default.nix | 9 ++++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 pkgs/development/python-modules/torchmetrics/0001-remove-illegal-name-from-extra-dependencies.patch diff --git a/pkgs/development/python-modules/torchmetrics/0001-remove-illegal-name-from-extra-dependencies.patch b/pkgs/development/python-modules/torchmetrics/0001-remove-illegal-name-from-extra-dependencies.patch new file mode 100644 index 000000000000..b11a2c93637d --- /dev/null +++ b/pkgs/development/python-modules/torchmetrics/0001-remove-illegal-name-from-extra-dependencies.patch @@ -0,0 +1,24 @@ +From 3ae04e8b9be879cf25fb5b51a48c8a1263a4844d Mon Sep 17 00:00:00 2001 +From: Gaetan Lepage +Date: Mon, 15 Jan 2024 10:05:40 +0100 +Subject: [PATCH] remove-illegal-name-from-extra-dependencies + +--- + setup.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/setup.py b/setup.py +index 968c32d6..c98ee9f8 100755 +--- a/setup.py ++++ b/setup.py +@@ -190,6 +190,7 @@ def _prepare_extras(skip_pattern: str = "^_", skip_files: Tuple[str] = ("base.tx + # create an 'all' keyword that install all possible dependencies + extras_req["all"] = list(chain([pkgs for k, pkgs in extras_req.items() if k not in ("_test", "_tests")])) + extras_req["dev"] = extras_req["all"] + extras_req["_tests"] ++ extras_req.pop("_tests") + return extras_req + + +-- +2.42.0 + diff --git a/pkgs/development/python-modules/torchmetrics/default.nix b/pkgs/development/python-modules/torchmetrics/default.nix index 70657185acba..26ff5f37882e 100644 --- a/pkgs/development/python-modules/torchmetrics/default.nix +++ b/pkgs/development/python-modules/torchmetrics/default.nix @@ -26,6 +26,8 @@ buildPythonPackage { inherit pname version; pyproject = true; + disabled = pythonOlder "3.8"; + src = fetchFromGitHub { owner = "Lightning-AI"; repo = "torchmetrics"; @@ -33,7 +35,12 @@ buildPythonPackage { hash = "sha256-xDUT9GSOn6ZNDFRsFws3NLxBsILKDHPKeEANwM8NXj8="; }; - disabled = pythonOlder "3.8"; + patches = [ + # The extra dependencies dictionary contains an illegally named entry '_tests'. + # The build fails because of this. + # Issue has been opened upstream: https://github.com/Lightning-AI/torchmetrics/issues/2305 + ./0001-remove-illegal-name-from-extra-dependencies.patch + ]; propagatedBuildInputs = [ numpy