Skip to content

Commit 04308e4

Browse files
authored
python312Packages.cleanlab: fix build by patching numpy2 incompatibilities (NixOS#372059)
2 parents d92f98e + a9ceeb3 commit 04308e4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkgs/development/python-modules/cleanlab/default.nix

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
lib,
33
buildPythonPackage,
44
fetchFromGitHub,
5+
fetchpatch,
56

67
# build-system
78
setuptools,
@@ -42,8 +43,21 @@ buildPythonPackage rec {
4243
hash = "sha256-0kCEIHNOXIkdwDH5zCVWnR/W79ppc/1PFsJ/a4goGzk=";
4344
};
4445

46+
patches = [
47+
# https://github.com/cleanlab/cleanlab/pull/1224
48+
(fetchpatch {
49+
name = "numpy2-compatibility";
50+
url = "https://github.com/GaetanLepage/cleanlab/commit/7d4cef11cf8d58b0ca7dba78f4c64995ed709274.patch";
51+
hash = "sha256-1mLEITYj30F9tJh8tajWnpGC5FANh8he/lgw1f+LAsI=";
52+
})
53+
];
54+
4555
build-system = [ setuptools ];
4656

57+
pythonRelaxDeps = [
58+
"numpy"
59+
];
60+
4761
dependencies = [
4862
numpy
4963
scikit-learn
@@ -79,6 +93,12 @@ buildPythonPackage rec {
7993
[
8094
# Requires the datasets we prevent from downloading
8195
"test_create_imagelab"
96+
97+
# Non-trivial numpy2 incompatibilities
98+
# assert np.float64(0.492) == 0.491
99+
"test_duplicate_points_have_similar_scores"
100+
# AssertionError: assert 'Annotators [1] did not label any examples.'
101+
"test_label_quality_scores_multiannotator"
82102
]
83103
++ lib.optionals (pythonAtLeast "3.12") [
84104
# AttributeError: 'called_once_with' is not a valid assertion.

0 commit comments

Comments
 (0)