Installing torch: undefined symbol for liblantern.so

Hey guys,

I try to install the R-Version of pytorch CPU, to avoid using reticulate as a workaround.
I simply used install.packages("torch") which successfully finished.

When using library(torch) after that, it states that there must be two additional system dependencies installed, e.g. libtorch and liblantern

So running install_torch() manually downloads both dependencies as zip files. However, then the following error occurs:

trying URL 'https://storage.googleapis.com/torch-lantern-builds/refs/heads/cran/v0.9.1/latest/Linux-cpu.zip'
Content type 'application/zip' length 4844513 bytes (4.6 MB)
==================================================
downloaded 4.6 MB

/R/x86_64-pc-linux-gnu-library/4.2/torch/lib/liblantern.so: undefined symbol:
  _ZNK5torch3jit6MethodclESt6vectorIN3c106IValueESaIS4_EERKSt13unordered_mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_St4hashISD_ESt8equal_toISD_ESaISt4pairIKSD_S4_EEE

Any ideas how to solve this?

Hi @Micha1

What OS version are you running? Looks like it might be a glibc compatibility issue.

Best,
Daniel

Hi @dfalbel ,

thank for your reply!
I'm running on an Ubuntu 22.04 LTS x86_64

1 Like

That's a weird issue, I couldn't reproduce. I think this might be an error caused by some problem when downloading the additional dependencies. Does the same error repeat if you simply re-install the package? Ie, running install.packages("torch") again?

Unfornately, yes :confused: That being sad, running the code you shared runs through, but as I said whenever I call library(torch), posit states that there are missing dependencies., i.e. libtorch and liblantern. I also tried to download the zip-files manually and provide posit with the path to the files - same error. Strangely, in the /torch/lib folder, there is an liblantern.so

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.