Subject: [bug#76240] [PATCH] gnu: Add NumPy 2 related variants.

From: Sharlatan Hellseher <[email-masked]>
Date: Wed, 12 Feb 2025 20:58:39 +0000

This to make Pandas, MatplotLib and SciPy compatible with NumPy 2.  They
need to be build with newer version otherwise it raise the error.

* gnu/packages/python-science.scm: (python-pandas-with-numpy-2,
python-scipy-with-numpy-2): New variables.

* gnu/packages/python-xyz.scm (python-matplotlib-with-numpy-2): New variable.

Change-Id: I53878b643ea6f7b35e3d893a18da438c2c111c52
---
 gnu/packages/python-science.scm | 19 +++++++++++++++++++
 gnu/packages/python-xyz.scm     | 21 +++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 1f4cdb239a1..0332546d22d 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -475,6 +475,14 @@ (define-public python-scipy
 routines such as routines for numerical integration and optimization.")
     (license license:bsd-3)))
 
+(define-public python-scipy-with-numpy-2
+  (package
+    (inherit python-scipy)
+    (propagated-inputs
+     (modify-inputs (package-propagated-inputs python-scipy)
+       (replace "python-numpy" python-numpy-2)
+       (replace "python-matplotlib" python-matplotlib-with-numpy-2)))))
+
 (define-public python-scikit-allel
   (package
     (name "python-scikit-allel")
@@ -1479,6 +1487,17 @@ (define-public python-pandas-2
 
 (define-public python-pandas python-pandas-2)
 
+(define-public python-pandas-with-numpy-2
+  (package
+    (inherit python-pandas)
+    (native-inputs
+     (modify-inputs (package-native-inputs python-pandas)
+       (replace "python-numpy" python-numpy-2)
+       (replace "python-matplotlib" python-matplotlib-with-numpy-2)))
+    (propagated-inputs
+     (modify-inputs (package-propagated-inputs python-pandas)
+       (replace "python-matplotlib" python-matplotlib-with-numpy-2)))))
+
 (define-public python-pandas-stubs
   (package
     (name "python-pandas-stubs")
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a4017fffe48..1fc6ebdb0b4 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -10462,6 +10462,27 @@ (define-public python-matplotlib
 toolkits.")
     (license license:psfl)))
 
+(define-public python-matplotlib-with-numpy-2
+  (package
+    (inherit python-matplotlib)
+    (version "3.8.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "matplotlib" version))
+       (sha256
+        (base32 "1spzglb3hh3959z72iwspm9dsbf5zz2q3hri1sb5ihcybrykkb4a"))))
+    (arguments
+     (substitute-keyword-arguments
+         (package-arguments python-matplotlib)
+       ((#:tests? _ #t) #f)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (delete 'sanity-check)))))
+    (propagated-inputs
+     (modify-inputs (package-propagated-inputs python-matplotlib)
+       (replace "python-numpy" python-numpy-2)))))
+
 (define-public python-matplotlib-documentation
   (package
     (inherit python-matplotlib)

base-commit: c9abfacd9f58f7365668b67a8125640b7497932a
prerequisite-patch-id: a2254ccef49d23b75149b22b200b6156097b673f
prerequisite-patch-id: 4e4a0833f7c017f2922344883800161335290814
prerequisite-patch-id: 97653359db283a3832359fc4cd0dc1741a2f51bc
prerequisite-patch-id: 2eac1b43f9e9050e8467c89cd384da43bff63305
-- 
2.47.1