Score:1

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

vn flag

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?

N0rbert avatar
zw flag
What is your Ubuntu version? Why do you think you need Anaconda on top of mature APT deb-packaging system? Normal RStudio is [packaged](https://rstudio.org/download/latest/stable/desktop/bionic/rstudio-latest-amd64.deb), R can install packages to `~/R` in your home folder. Which winning point do you get by using Anaconda?
Pål Bjartan avatar
vn flag
My version is 20.04 LTS. I didn't think I need it, my "winning point" was that I thought it be neat to use Anaconda as hub for the programming tools I need, to "gather everything in one place" so to speak. As stated, my current version (4.1.1) is installed and updated from CRAN repos. I also has the latest version of RStudio.
Score:1
zw flag

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.

Pål Bjartan avatar
vn flag
I think you misunderstood my question. I already have R and RStudio installed. I was actually just trying to add RStudio in Anaconda, so that I can use it as a hub. I had no idea when I started that it would try install another version of R in its own directory.
N0rbert avatar
zw flag
By the way `libreadline.so.6` is not provided by any official Ubuntu package. Possible solutions are - install this library manually from Debian Jessie. See updated answer.
Pål Bjartan avatar
vn flag
This was sort of my point aside from understanding/fixing the error: Does Anaconda provide an up-to-date version of R and RStudio? If not, can I access my current installs from Anaconda somehow?
N0rbert avatar
zw flag
R executable from Anaconda installation needs `libreadline.so.6` , to get it fixed you have to install single deb-package by using 4 commands above.
N0rbert avatar
zw flag
@PålBjartan I edited your edit. But then it seems that your Anaconda installation is outdated. For me it is strange that it ships very old R 3.2.2.
Pål Bjartan avatar
vn flag
I agree it seems odd it runs 3.2.2. I forgot to mention it installs 3.6 with RStudio. You are correct: Anaconda is messy. Updating Anaconda was the first thing I tried after you initial post, running `conda update anaconda` in terminal. Is this the correct command?
N0rbert avatar
zw flag
I do not use Anaconda to keep my system clean and functional, try to find/use their official documentation.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.