From 1d1fcaf4e99951b8bffbb327661e707c7d197a61 Mon Sep 17 00:00:00 2001 From: Hugo Buddelmeijer Date: Wed, 18 Mar 2026 07:57:18 +0100 Subject: [PATCH] gnu: python-scikit-image: Fix build with python-pillow 12.1.1. Followup to 017903d435f987c50c085bf415a07a551684412b. * gnu/packages/python-science.scm (python-scikit-image): Fix build. [source]: Add patch. * gnu/packages/patchen/python-scikit-image-fix-python-pillow.patch: Add. * gnu/local.mk (dist_patch_DATA): Register patch. Merges: https://codeberg.org/guix/guix/pulls/7261 Change-Id: I7eee2e1f397f1f1ce0757f588da921687296ad41 Modified-by: Sharlatan Hellseher Signed-off-by: Sharlatan Hellseher --- gnu/local.mk | 1 + ...ython-scikit-image-fix-python-pillow.patch | 20 +++++++++++++++++++ gnu/packages/python-science.scm | 4 ++++ 3 files changed, 25 insertions(+) create mode 100644 gnu/packages/patches/python-scikit-image-fix-python-pillow.patch diff --git a/gnu/local.mk b/gnu/local.mk index ef32cf8b51..c7dc083075 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2116,6 +2116,7 @@ dist_patch_DATA = \ %D%/packages/patches/python-pyreadstat-link-libiconv.patch \ %D%/packages/patches/python-sip-include-dirs.patch \ %D%/packages/patches/python-scikit-build-setuptools-compat.patch \ + %D%/packages/patches/python-scikit-image-fix-python-pillow.patch \ %D%/packages/patches/python-sgmllib3k-assertions.patch \ %D%/packages/patches/python-sphobjinv-defer-ssl-import.patch \ %D%/packages/patches/python-sphinx-prompt-docutils-0.19.patch \ diff --git a/gnu/packages/patches/python-scikit-image-fix-python-pillow.patch b/gnu/packages/patches/python-scikit-image-fix-python-pillow.patch new file mode 100644 index 0000000000..4da218d4fd --- /dev/null +++ b/gnu/packages/patches/python-scikit-image-fix-python-pillow.patch @@ -0,0 +1,20 @@ +From 9d8daba419249f9d3327fe85177d79b18adb6032 Mon Sep 17 00:00:00 2001 +From: Stefan van der Walt +Date: Thu, 8 Jan 2026 03:39:36 -0800 +Subject: [PATCH] Handle PIL Image.getdata deprecation (#8010) + +diff --git a/src/skimage/io/_plugins/pil_plugin.py b/src/skimage/io/_plugins/pil_plugin.py +index 7a75c5fc0af..098d22a148e 100644 +--- a/src/skimage/io/_plugins/pil_plugin.py ++++ b/src/skimage/io/_plugins/pil_plugin.py +@@ -47,6 +47,10 @@ def pil_to_ndarray(image, dtype=None, img_num=None): + Refer to ``imread``. + + """ ++ # PIL 12.1.0 renames getdata ++ if hasattr(image, "get_flattened_data"): ++ image.getdata = image.get_flattened_data ++ + try: + # this will raise an IOError if the file is not readable + image.getdata()[0] diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index c485a30633..1c2cd25273 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -3090,6 +3090,10 @@ logic, also known as grey logic.") (url "https://github.com/scikit-image/scikit-image") (commit (string-append "v" version)))) (file-name (git-file-name name version)) + ;; TODO: Remove patch when refreshing python-scikit-image. + ;; Prevent deprecation warning from python-pillow 12.1.1. + (patches + (search-patches "python-scikit-image-fix-python-pillow.patch")) (sha256 (base32 "1x90jad3jqin8ws1j1i89zrajpcbn1h87nl5yxxf5cs3b7ha13rf")))) (build-system pyproject-build-system)