From e6b482cc0bb9f7a72538f154b5572885a8146ede Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sun, 12 Jul 2026 17:45:24 -0400 Subject: [PATCH] python3Package.albumentations: fix build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - pkg_resources is removed in setuptools 82 ([src][1]) - test_blur was failing with “ValueError: The truth value of an array with more than one element is ambiguous”; converting sigma to float (from `numpy.float64`) resolves, see also [this issue][2] [1]: https://github.com/pypa/setuptools/blob/v82.0.0/NEWS.rst [2]: https://github.com/python-pillow/Pillow/issues/8911 --- .../python-modules/albumentations/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/python-modules/albumentations/default.nix b/pkgs/development/python-modules/albumentations/default.nix index 0cf23c5bf18e..623187c8e1ec 100644 --- a/pkgs/development/python-modules/albumentations/default.nix +++ b/pkgs/development/python-modules/albumentations/default.nix @@ -44,6 +44,17 @@ buildPythonPackage rec { ./dont-check-for-updates.patch ]; + postPatch = '' + substituteInPlace setup.py \ + --replace-fail \ + 'from pkg_resources import DistributionNotFound, get_distribution' \ + 'from importlib.metadata import PackageNotFoundError as DistributionNotFound, distribution as get_distribution' + substituteInPlace tests/test_blur.py \ + --replace-fail \ + '(ImageFilter.GaussianBlur(radius=sigma))' \ + '(ImageFilter.GaussianBlur(radius=float(sigma)))' + ''; + pythonRelaxDeps = [ "opencv-python" ]; build-system = [ setuptools ];