Search code examples
rubuntu-20.04libreadline

R is missing libreadline.so.7 on Ubuntu 20.04, doesn't work anymore


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!


Solution

  • 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.