Skip to content

torch fails to start on Alpine Linux #1323

Open
@bastistician

Description

@bastistician

Installing the R package from CRAN succeeds (currently version 0.14.2), but the package is unusable because install_torch() seems to download glibc-specific binaries. This can be reproduced using Alpine's Docker image, i.e., in docker run --rm -it alpine:

export TZ=UTC
apk add R R-dev R-doc g++ linux-headers
R -s -e 'install.packages("torch", repos = "https://cloud.R-project.org")'  # succeeds
R -s -e 'torch::install_torch()'  # succeeds downloading "libtorch-cxx11-abi-shared-with-deps-2.5.1%2Bcpu.zip" and "lantern-0.14.2+cpu+x86_64-Linux.zip"
R -s -e 'torch::torch_is_installed()'  # TRUE, but liblantern.so cannot be loaded, see below
Warning message:
ℹ torch failed to start, restart your R session to try again.
ℹ You might need to reinstall torch using `install_torch()`
✖ /usr/lib/R/library/torch/lib/liblantern.so - Error loading shared library ld-linux-x86-64.so.2: No such file or directory
  (needed by /usr/lib/R/library/torch/lib/liblantern.so)
Caused by error in `cpp_lantern_init()`:
! /usr/lib/R/library/torch/lib/liblantern.so - Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /usr/lib/R/library/torch/lib/liblantern.so) 

Furthermore, ldd /usr/lib/R/library/torch/lib/liblantern.so shows several glibc-specific symbols:

Error relocating /usr/lib/R/library/torch/lib/libc10.so: backtrace: symbol not found
Error relocating /usr/lib/R/library/torch/lib/libtorch_cpu.so: fcntl64: symbol not found
Error relocating /usr/lib/R/library/torch/lib/libtorch_cpu.so: gnu_get_libc_version: symbol not found
Error relocating /usr/lib/R/library/torch/lib/libgomp-98b21ff3.so.1: pthread_attr_setaffinity_np: symbol not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions