torch icon indicating copy to clipboard operation
torch copied to clipboard

install_torch() unable to download lantern from a link

Open kuiyuanshao opened this issue 5 months ago • 4 comments

install_torch(reinstall = T) trying URL 'https://github.com/mlverse/libtorch-mac-m1/releases/download/LibTorch-for-R/libtorch-arm64-v2.5.1.zip' Content type 'application/octet-stream' length 54413594 bytes (51.9 MB)

downloaded 51.9 MB

trying URL 'https://torch-cdn.mlverse.org/binaries/refs/heads/cran/v0.15.0/latest/lantern-0.15.1+cpu+arm64-Darwin.zip' Error in value[[3L]](): ! Unable to download from https://torch-cdn.mlverse.org/binaries/refs/heads/cran/v0.15.0/latest/lantern-0.15.1+cpu+arm64-Darwin.zip Run rlang::last_trace() to see where the error occurred.

kuiyuanshao avatar Jul 13 '25 05:07 kuiyuanshao

Hi @kuiyuanshao,

I faced the exact same issue recetly while running install_torch() during CRAN check (R CMD check) in an isolated environment, typically used for package testing. The error occured because the lantern binary couldn't be downloaded from the default CDN URL. This seems to be a common problem in sandboxed environments where cached downloads aren't available.

Here is a simple fix that may work for you:

torch::install_torch(version = "0.12.0", reinstall = TRUE)

Hope this helps.

ielbadisy avatar Jul 13 '25 12:07 ielbadisy

It doesn't work for me, calling "version = "0.12.0" still ends up in grabbing the 0.15.0 lantern.

kuiyuanshao avatar Jul 13 '25 21:07 kuiyuanshao

This problem is still prohibiting the installation, could you help? @dfalbel https://torch-cdn.mlverse.org/binaries/refs/heads/cran/v0.15.1/latest/lantern-0.15.1+cu128-win64.zip returns error 403 access denied.

chriscainx avatar Aug 19 '25 01:08 chriscainx

That's because cuda12.8 is not a supported version for torch v0.15.1. I'm preparing a submission for v0.16.0 that will support cuda 12.8. You can still install torch for older cuda versions, like 12.6 and 12.4.

dfalbel avatar Aug 19 '25 01:08 dfalbel