1

I've installed R 3.5.3 as described here. I then install Rstudio from the source. I run Rstudio from the Ubuntu launcher. Then when I try to install certain packages, it gives me this error:

libRlapack.so: cannot open shared object file: No such file or directory

After a lucky Google find, I came across this solution to fix the issue:

  • Find where libRlapack.so is on your system: locate libRlapack.so.
  • Create a symlink to /usr/lib/libRlapack.so with sudo ln -s /usr/lib/R/modules/lapack.so /usr/lib/libRlapack.so

Then you will get an error like so:

libRblas.so: cannot open shared object file: No such file or directory

and a similar process with locate libblas.so and linking it fixes the issue, and Rstudio seems to work ok. (sudo ln -s /usr/lib/x86_64-linux-gnu/libblas.so /usr/lib/libRblas.so)

The other weird thing is running Rstudio from the command line didn't show the same issues...things installed and loaded fine. But then running Rstudio from the launcher wouldn't work.

So what is it about running Rstudio from the launcher that causes it not be able to find certain files? Is it a ~/.profile vs ~/.bashrc issue, or some other environment variable issue?

Obviously the linking worked ok in this case, but I'm wondering if there's a better way that these files (libRlapack.so, libRblas.so) should be installed in Ubuntu, or some environment variable(s) that should usually be set to avoid issues. I've had similar problems with Rstudio not being able to find other files (e.g. openssl files) as well in the past.

wordsforthewise
  • 13,746
  • 5
  • 87
  • 117
  • 1
    I would stay away from manually symlinking unless absolutely necessary. I would usually start with installing header packages like `libblas-dev` through `apt`. Then check/change what the default is using `sudo update-alternatives --config libblas.so`. – Marius Apr 11 '19 at 01:18
  • 1
    Thanks. `libblas-dev` is already installed, of course. Trying `sudo update-alternatives --config libblas.so` returned `update-alternatives: error: no alternatives for libblas.so`. – wordsforthewise Apr 11 '19 at 01:20
  • Do you have `r-base-dev` installed through `apt`? That's needed to be able to compile a lot of R packages I think. – Marius Apr 11 '19 at 01:29
  • Yes, but something weird was going on, because with the original instructions I linked to, it was trying to install libcurl3 and uninstall mongodb and libcurl4. With these instructions it seems to work properly: https://linuxize.com/post/how-to-install-r-on-ubuntu-18-04/ maybe a keyserver issue. – wordsforthewise Apr 11 '19 at 01:49

0 Answers0