From 19cac579d7d8885fce841bb536e3af5c596433cf Mon Sep 17 00:00:00 2001 From: Ayan Das Date: Fri, 20 Feb 2026 23:14:12 +0530 Subject: [PATCH] gnu: python-pytorch-for-r-torch: Fix build and RUNPATH. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/packages/machine-learning.scm (python-pytorch-for-r-torch): [arguments] <#:phases>: In 'use-system-libraries', replace the 'build_bundled' import workaround with a no-op 'create_bundled' binding. Adjust functorch INSTALL_RPATH to "$ORIGIN/../torch/lib". Change-Id: I6386137d658dc11c6b0a3b553de87524a4b1d708 Signed-off-by: Ludovic Courtès Merges: #6004 --- gnu/packages/machine-learning.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index 66871b229d..abad520010 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -5425,6 +5425,12 @@ in the audio domain.") ;; For Vulkan (substitute* "CMakeLists.txt" (("append_cxx_flag.*-Werror=(return-type|range-loop-construct).*") "")) + ;; In this variant functorch is installed directly under + ;; site-packages/functorch, so use a direct rpath to + ;; site-packages/torch/lib. + (substitute* "functorch/CMakeLists.txt" + (("set_target_properties\\(\\$\\{PROJECT_NAME\\} PROPERTIES INSTALL_RPATH \"\\$\\{_rpath_portable_origin\\}/\\.\\./torch/lib\"\\)") + "set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH \"$ORIGIN/../torch/lib\")")) (substitute* (cons* "torch/csrc/Module.cpp" @@ -5454,7 +5460,11 @@ in the audio domain.") (setenv "USE_QNNPACK" "0")) (substitute* '("requirements.txt" "setup.py") (("sympy>=1\\.13\\.3") - "sympy>=1.13.1")))) + "sympy>=1.13.1")) + ;; Avoid ModuleNotFoundError while preserving setup.py flow. + (substitute* "setup.py" + (("from build_bundled import create_bundled") + "create_bundled = lambda *args, **kwargs: None")))) (replace 'skip-nccl-call (lambda _ ;; Comment-out `checkout_nccl()` invokation in build_pytorch().