From 8e321254c0e11ec1e73083324fdfff52a8321d67 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 19 Sep 2022 21:58:29 +0200 Subject: [PATCH] gnu: r-torch: Do not hardcode Python version. * gnu/packages/cran.scm (r-torch)[arguments]: Do not hardcode Python version 3.9. --- gnu/packages/cran.scm | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm index af672c0c5e..46e6d8a380 100644 --- a/gnu/packages/cran.scm +++ b/gnu/packages/cran.scm @@ -24535,19 +24535,23 @@ Visualizations are also available for most of these settings.") (arguments (list #:phases - #~(modify-phases %standard-phases - (add-after 'install 'link-libraries - (lambda* (#:key inputs #:allow-other-keys) - (let ((deps (string-append #$output "/site-library/torch/deps"))) - (mkdir-p deps) - (symlink - (search-input-file - inputs "/lib/python3.9/site-packages/torch/lib/libtorch.so") - (string-append deps "/libtorch.so")) - (symlink - (search-input-file - inputs "/lib/liblantern.so") - (string-append deps "/liblantern.so")))))))) + (let ((python-version (version-major+minor (package-version python)))) + #~(modify-phases %standard-phases + (add-after 'install 'link-libraries + (lambda* (#:key inputs #:allow-other-keys) + (let ((deps (string-append #$output "/site-library/torch/deps")) + (site-packages (string-append "/lib/python" + #$python-version + "/site-packages"))) + (mkdir-p deps) + (symlink + (search-input-file + inputs (string-append site-packages "/torch/lib/libtorch.so")) + (string-append deps "/libtorch.so")) + (symlink + (search-input-file + inputs "/lib/liblantern.so") + (string-append deps "/liblantern.so"))))))))) (inputs (list python-pytorch-for-r-torch liblantern))