[bug#78951,1/1] gnu: python-pytorch-geometric: Update to 2.6.1-1.8d76e12.

Message ID 9daa2b1cc9ce3e86548d2aa987279ca41677db94.1751553752.git.bvits@riseup.net
State New
Headers
Series [bug#78951,1/1] gnu: python-pytorch-geometric: Update to 2.6.1-1.8d76e12. |

Commit Message

Ayan Das July 3, 2025, 3:07 p.m. UTC
This fixes the python-pytorch-geometric test failures with PyTorch 2.7.0
that were failing with 'AttributeError: module torch.fx._symbolic_trace
has no attribute List'.

* gnu/packages/machine-learning.scm: Import (gnu packages digest).
(python-pytorch-geometric): Update to commit 8d76e12.
[source]: Update hash.
[arguments]: Add 'patch-pyproject-toml phase to fix compatibility with
older flit-core. Update 'delete-top-level-directories phase to check
directory existence before deletion.
[propagated-inputs]: Add python-xxhash.

Signed-off-by: Ayan Das <bvits@riseup.net>
---
 gnu/packages/machine-learning.scm | 44 ++++++++++++++++++++-----------
 1 file changed, 29 insertions(+), 15 deletions(-)
  

Comments

Andreas Enge July 13, 2025, 9:35 p.m. UTC | #1
Hello,

thanks for your patch! A similar one was sent to Codeberg:
   https://codeberg.org/guix/guix/pulls/1174
which I have just pushed, since it works with python-flit-core-next,
so it becomes a little bit easier.

Maybe see you on Codeberg soon!

Andreas
  

Patch

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index d51eb62176..b44a93d7cf 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -88,6 +88,7 @@  (define-module (gnu packages machine-learning)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages dejagnu)
+  #:use-module (gnu packages digest)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gcc)
@@ -5459,18 +5460,20 @@  (define-public python-pytorch-for-r-torch
                python-sympy)))))
 
 (define-public python-pytorch-geometric
-  (package
-    (name "python-pytorch-geometric")
-    (version "2.6.1")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/pyg-team/pytorch_geometric/")
-                    (commit version)))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "0dbxz9d22vzm7fr9kgg66hj3sf8ag2ly8qky58cxvn1hyjl5h3v7"))))
+  (let ((commit "8d76e1220665dfc701b14e04b543e9dbaad479ce")
+        (revision "1"))
+    (package
+      (name "python-pytorch-geometric")
+      (version (git-version "2.6.1" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/pyg-team/pytorch_geometric/")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0m0naifd67d0kpvhvpm70k2v35mprx1270wj03i1v22d39xsz722"))))
     (build-system pyproject-build-system)
     (arguments
      (list
@@ -5502,11 +5505,21 @@  (define-public python-pytorch-geometric
                    " and not test_type_repr"))
       #:phases
       '(modify-phases %standard-phases
+         (add-after 'unpack 'patch-pyproject-toml
+           (lambda _
+             ;; Older flit-core expects license to be a dict, not a string
+             ;; and doesn't recognize license-files
+             (substitute* "pyproject.toml"
+               (("license = \"MIT\"")
+                "license = {text = \"MIT\"}")
+               (("license-files = .*") ""))))
          (add-after 'unpack 'delete-top-level-directories
            (lambda _
              ;; The presence of these directories confuses the pyproject build
              ;; system.
-             (for-each delete-file-recursively
+             (for-each (lambda (dir)
+                         (when (file-exists? dir)
+                           (delete-file-recursively dir)))
                        '("conda" "docker" "graphgym")))))))
     (propagated-inputs
      (list onnx
@@ -5533,7 +5546,8 @@  (define-public python-pytorch-geometric
            python-sympy
            python-tabulate
            python-torchmetrics
-           python-tqdm))
+           python-tqdm
+           python-xxhash))
     (native-inputs
      (list python-flit-core
            python-pytest
@@ -5543,7 +5557,7 @@  (define-public python-pytorch-geometric
     (description
      "PyG is a library built upon PyTorch to easily write and train Graph
 Neural Networks for a wide range of applications related to structured data.")
-    (license license:expat)))
+      (license license:expat))))
 
 (define-public python-lightning-cloud
   (package