R: line 238: /usr/local/lib/R/etc/ldpaths: No such file or directory

I used the following steps to install R on my Ubuntu 18.04, but encountered problem:

usr@dell:~$ history

 1141  sudo apt-get remove --auto-remove r-base
 1142  sudo apt-get purge r-base
 1143  sudo apt-get purge --auto-remove r-base
 1144  sudo apt-get remove --auto-remove r-base
 1145  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
 1146  sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
 1147  sudo apt update
 1148  apt list --upgradable
 1149  sudo apt install r-base
 1150  sudo -i R
 1151  deluser --remove-home shiny
 1152  R

usr@dell:~$ R

/usr/local/bin/R: line 238: 
/usr/local/lib/R/etc/ldpaths: No such file or directory
/usr/local/bin/R: line 261: /usr/local/lib/R/bin/exec/R: No such file or directory

I tried to remove previous R version, but the problem is still the same. Could anyone please help me? Thanks in advance.

Can you share the output of your installation? The sudo apt install r-base command? Maybe try that again and see what happens? The log would be very helpful!

Try it using the CRAN installation recipe at https://goo.gl/alZYVs

Hi Cole,

Many thanks for your email.

After I tried it again, the same problem still exists. I attach the log file (the pdf one, the authorized version) in this email. Thank you for your help.

Kind regards,


R_log.pdf (134 KB)

Hi Richard,

Many thanks for your email. However, after I tried the recipe from https://goo.gl/alZYVs, the error still exists. I add the log in this email (pdf version), hope it helps. And thanks again for you help.

Kind regards,


The problem shows up at the end of the log, which is that it shows

r-base-dev is already the newest version (3.5.1-2xenial)

But that's an older Ubuntu version than the one you're on, which is bionic, which is what I'm using, and it does not have

/usr/local/bin/R: line 238: /usr/local/lib/R/etc/ldpaths: No such file or directory/usr/local/bin/R: line 261: /usr/local/lib/R/bin/exec/R: No such file or directory

because the install for bionic puts R in /usr/bin.

That said, my Ubuntu uninstall experience is rusty. Anyone else ?

When you to to re-install? Be sure to start out with adding

deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/

to your

 /etc/apt/sources.list file

Hi Cole,

Many thanks for your email.

After I tried it again, the same problem still exists. I attach the log in this email. Thank you for your help.

Kind regards,


Cole Arendt tidyverse@discoursemail.com 于2018εΉ΄11月29ζ—₯周四 δΈ‹εˆ4:57ε†™ι“οΌš

(Attachment r_base_log is missing)

Sorry, the log file.

Hillary Zhao hillary.zhao25@gmail.com 于2018εΉ΄11月29ζ—₯周四 δΈ‹εˆ6:33ε†™ι“οΌš

R_log.pdf (134 KB)

This is a strange one. It seems like something is very wrong with the binary installation. Unfortunately, my understanding of how the binary installation works / how it can break / how to resolve it is pretty limited. I would love to hear if others have thoughts. You can always try exploration of the R installation directory, which R, and the like.

Something I would actually recommend trying is to build R from source. I'm curious if that will either (1) succeed, or (2) fail with a bit more verbosity that points to the root issue. One downside is that you do need the build dependencies for R in this case.

There are a lot of resources on the topic. I believe my favorites are:



Hi Richard,

Many thanks for your help. However, after I added the line you mentioned in the source.list, this problem still exists. Please see the attached file of the latest log. Could you give me further suggestion? Thank you again.

Kind regards,


R_log_latest.pdf (17.8 KB)

The new log still shows the old (xenial) R-Base installed. In your situation, I would try uninstalling it (see https://www.howtoinstall.co/en/ubuntu/xenial/r-base?action=remove) and start over with a fresh R-Base.

Hi Cole,

I finally solved this problem by using the following command:

$ export PATH=$PATH:/usr/local/bin

$ hash -r

And thanks for your kindness help. Without your suggestions, I couldn't find this solution.

Kind regards,


Cole Arendt tidyverse@discoursemail.com 于2018εΉ΄11月30ζ—₯周五 δΈ‹εˆ2:04ε†™ι“οΌš


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.