1

Since I installed the latest version of Ubuntu (20.04), R (4.02) just doesn't work. If I try to launch R from the terminal I get the following message :

R-4.0.2/bin/exec/R: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory

After some research on the internet I found that I had Libreadline6 and 8 but not 7, so I installed it manually .

apt policy libreadline7
libreadline7:i386:
  Installé : 7.0-3
  Candidat : 7.0-3
 Table de version :
 *** 7.0-3 100
        100 /var/lib/dpkg/status

SO right now I do have the version R needs and yet when I try to run it, I have the exact same error message. I have no idea in what direction to even look for a solution, I think it's not a problem with R, but with Ubuntu... Any idea what might be the problem? Thank you!

user163731
  • 23
  • 1
  • 3

1 Answers1

1

First things first: where did you get your R package from?

I am running the "official" Ubuntu "backport" available at CRAN thanks to what Michael Rutter builds based on the Debian package I maintain. No issue there, neither for me nor me thousands of other people. Let's inspect:

$ dpkg -s r-base-core | grep Version
Version: 4.0.2-1.2004.0
$
$ dpkg -s r-base-core | grep readline
Depends: zip, unzip, [...edited...] , libreadline8 (>= 6.0), [...ditto...]
$ 

So that version is built against libreadline8, not 7. So why / how do you have 7?

Maybe easiest for you to just upgrade to the binary I have here? See the usual README at CRAN for more.

Second, even if you used an older R (say the one that shipped with 20.04) then libreadline, as a dependency of another package, would not uninstall.

So maybe you compiled the package yourself? In which case apt does not know that a binary in /usr/local/bin has a dependency as you are outside the package management system! Again, easiest to use the pre-made binary.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • I downloaded the R-4.0.02.tar.gz from https://www.r-project.org/ , and then installed it manually from that and it was working perfectly before the update. As for libreadline 7, I also installed it manually while trying to fix the R problem. I think you might be right about the source of the problem , it might be that the ubuntu update didn't "accept" my R as it was installed manually. I'll try to re-install R and see if it fixes the problem. Thank you for your fast answer! – user163731 Oct 09 '20 at 14:24
  • And it's working after a re-installation! I should've started with this....anyway, thank you for leading me to the solution! – user163731 Oct 09 '20 at 14:38
  • It seems that you appear to be misunderstanding what Ubuntu and the apt package manager may or not know about *local* builds you do, As I tried to explain you can avoid all these troubles by using the binary. Plus, upgrades are automatic: R 4.0.3 comes out tomorrow, and I guess by Monday at the lastest you'd have this Ubuntu binary via CRAN. Can't beat that -- I run those myself on numerous machines. – Dirk Eddelbuettel Oct 09 '20 at 14:46
  • I relatively recently started to use Ubuntu and I am not yet very familiar with it's ways, although I do my best. I will try to switch to use the binary in the future as it sounds very convenient. Thank you for the info! I ended up using the local build because for some reason (maybe because it's a work PC setup by the IT guys ?) I only had access to an older version of R via the "apt install r-base" command. So to have something more up to date I had to install it manually. – user163731 Oct 09 '20 at 15:12
  • That is why I pointed you at the README. Read it. Add the repo it describes to your setup. Ubuntu has this flexibility---many things from Chrome to Zoom to Slack to ... do the same: add repos from outside the distro core to expand the set as needed. – Dirk Eddelbuettel Oct 09 '20 at 15:21