GNU bug report logs - #75801
[PATCH python-team 0/2] NumPy 1+ and 2+.

Previous Next

Package: guix-patches;

Reported by: Sharlatan Hellseher <sharlatanus <at> gmail.com>

Date: Fri, 24 Jan 2025 08:05:03 UTC

Severity: normal

Tags: patch

Done: Sharlatan Hellseher <sharlatanus <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 75801 <at> debbugs.gnu.org (full text, mbox):

From: Sharlatan Hellseher <sharlatanus <at> gmail.com>
To: 75801 <at> debbugs.gnu.org
Cc: Sharlatan Hellseher <sharlatanus <at> gmail.com>
Subject: [PATCH python-team 2/2] gnu: Add python-numpy-2.
Date: Fri, 24 Jan 2025 08:05:34 +0000
* gnu/packages/python-xyz.scm (python-numpy-2): New variable.

Change-Id: I07e7aac8c1bf7e686b1c543a11f9ecbf682d6ad5
---
 gnu/packages/python-xyz.scm | 74 +++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 88e1796143..d6bffb6f77 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -9360,6 +9360,80 @@ (define-public python-numpy
      '((upstream-name . "numpy")))
     (license license:bsd-3)))
 
+(define-public python-numpy-2
+  (package
+    (inherit python-numpy)
+    (name "python-numpy")
+    (version "2.2.2")
+    ;; XXX: Shipped with vendored-meson which is needed for SIMD and
+    ;; BLAS/LAPACK features that are not yet available in upstream Meson.
+    ;; See <https://raw.githubusercontent.com/numpy/numpy/
+    ;; 2f3549c9d7c5048621568e431c86bc7530742723/doc/source/building/
+    ;; understanding_meson.rst>
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/numpy/numpy/releases/download/v"
+             version "/numpy-" version ".tar.gz"))
+       (sha256
+        (base32
+         "13sdvwiqn85vw1dn1k1nd5ihadv82zhqm615imrqgmil33v0csgd"))))
+    (arguments
+     (list
+      ;; TODO: Tests fail on setup, there is some issue with vendored-meson.
+      #:tests? #f 
+      #:modules '((guix build utils)
+                  (guix build pyproject-build-system)
+                  (ice-9 format))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-executable-paths
+            (lambda _
+              (substitute* "numpy/distutils/exec_command.py"
+                (("'/bin/sh'")
+                 (format #f "~s" (which "bash"))))))
+          (add-before 'build 'parallelize-build
+            (lambda _
+              (setenv "OMP_NUM_THREAD"
+                      (number->string (parallel-job-count)))
+              (setenv "NPY_NUM_BUILD_JOBS"
+                      (number->string (parallel-job-count)))))
+          ;; XXX: istl/test/matrixtest.cc includes <fenv.h> and fails to find
+          ;; the stdlib types when the gfortran header is used.  Remove
+          ;; gfortran from CPLUS_INCLUDE_PATH as a workaround.
+          ;; Taken from <https://issues.guix.gnu.org/73439#45>.
+          (add-after 'set-paths 'hide-gfortran
+            (lambda* (#:key inputs #:allow-other-keys)
+              (let ((gfortran (assoc-ref inputs "gfortran")))
+                (setenv "CPLUS_INCLUDE_PATH"
+                        (string-join
+                         (delete (string-append gfortran "/include/c++")
+                                 (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
+                         ":")))))
+          (add-before 'build 'configure-blas
+            (lambda* (#:key inputs #:allow-other-keys)
+              (call-with-output-file "site.cfg"
+                (lambda (port)
+                  (format port
+                          "[openblas]
+libraries = openblas
+library_dirs = ~a/lib
+include_dirs = ~:*~a/include~%" #$(this-package-input "openblas")))))))))
+    (native-inputs
+     (list gfortran
+           meson-python
+           ninja
+           pkg-config
+           python-hypothesis
+           python-mypy
+           python-pytest
+           python-pytest-xdist
+           python-setuptools
+           python-setuptools
+           python-typing-extensions
+           python-wheel))))
+
 (define-public python-numpy-documentation
   (package
     (inherit python-numpy)
-- 
2.47.1





This bug report was last modified 157 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.