Error when installing RStudio in Anaconda: `/opt/anaconda3/lib/R/bin/exec/R: error while loading shared libraries: libreadline.so.6:

Solution 1:

The library named libreadline.so.6 is not provided by any official deb-packages in the Ubuntu repository, only Debian Jessie has package for it. If you want to save Anaconda - install this library manually by using commands below

cd ~/Downloads
wget -c wget http://ftp.debian.org/debian/pool/main/r/readline6/libreadline6_6.3-8+b3_amd64.deb
wget -c http://ftp.debian.org/debian/pool/main/g/glibc/multiarch-support_2.19-18+deb8u10_amd64.deb
sudo apt install ./libreadline6_6.3-8+b3_amd64.deb  ./multiarch-support_2.19-18+deb8u10_amd64.deb

and then retry launching R from Anaconda.

Update is below.

1. Fixes for libraries

Installing libreadline.so.6 removed OP's error message, but lead to a second:

$ /opt/anaconda3/lib/R/bin/R
/opt/anaconda3/lib/R/bin/exec/R: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

This error was resolved by installing the missing library :

sudo add-apt-repository universe
sudo apt-get install libncurses5

This removed the error messages, and it was now possible to run Anaconda's R version from terminal.

$ /opt/anaconda3/lib/R/bin/R
R version 3.2.2 (2015-08-14) -- "Fire Safety"

Still it did not resolve the issue of installation of RStudio hanging. This is seemingly related to not having created an R environment createdd first. Following this tutorial, the installation of RStudio was completed.

2. Running the latest version of R and RStudio from Anaconda Navigator

After installation it became clear that both Anaconda's R and RStudio version are quite outdated. I find it better to have both downloaded and updated from their official repos:

cd ~/Downloads
wget -c https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.4.1717-amd64.deb
sudo apt-get install ./rstudio-1.4.1717-amd64.deb

Recreating the path to CRAN's version of R, was a simple matter of removing the symbolic link /opt/anaconda3/bin/R from path.

sudo rm /opt/anaconda3/bin/R

As for running the newest version of RStudio (which was alredy pre-installed) within Anaconda was a simple matter of removing the existing symlink from Anaconda's RStudio directory, and creating a new one directing to the "old" installation directory:

sudo rm /opt/anaconda3/envs/renv/bin/rstudio
ln -s /usr/lib/rstudio/bin/rstudio /opt/anaconda3/envs/renv/bin/rstudio 

This last step enabled running the latest version of R and RStudio from Anaconda.