1

I am currently trying install Anacondas RStudio version. Already I have R installed from the official CRAN repositories through apt package manager and the newest version of RStudio. My current version of R is installed in /usr/lib/R and the path variable set in /usr/bin/R. When running Anaconda Navigator's RStudio installer, it attempts to install a separate version of R in /opt/anaconda3/lib/R. The installation process hung and, now I am unable to type R in terminal and open the "old" R version. Instead I get the following error message:

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

I tried updating path variable for "old" R, but since /opt/anaconda3/bin is prior to usr/bin in the path list I still get the same error:

$ export PATH=$PATH:/usr/bin/R
$ echo $PATH
/opt/anaconda3/bin:/opt/anaconda3/condabin:/home/username/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/opt/mplusdemo:/usr/bin/R

Firstly, I am uncertain what this error means. What is libreadline.so.6? How can I resolve this?

Secondly, do I need to, and is it advised to install R via Anaconda? My current version is updated from the CRAN repos, meaning I get the updates when they're available. Conversely, how up to date is Anacondas version? Alternatively, would it be wise to create a symlink to directory usr/bin/R in /opt/anaconda3/bin?

Pål Bjartan
  • 637
  • 3
  • 10
  • 26

1 Answers1

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.

N0rbert
  • 103,263