can not install packagers in Rstudio(files missing in /usr/lib/R/etc)

Hello , I installed the R 4.3.3 version on my ubuntu 22.04,but for some reason I need to install a older version ,so I purged the newer version and make install a 3.6.3version with another rstudio, and it won't open ,says "R shared library (/usr/local/lib/R/lib/libR.so) not found. If this is a custom build of R, was it built with the --enable-R-shlib option?''
can't solve it so I delete the source dir again and uninstalled the rstudio, then installed the new version again( I am just a beginner)......Then here's the point, when I open the R, it says
"/usr/bin/R: line 249: /usr/lib/R/etc/ldpaths: No such file or directory"on the top,
and "uring startup - Warning message:
In file(file, "rt") :
** cannot open file '/usr/lib/R/etc/repositories': No such file or directory

below,
and when I try to install packages in studio, parts of the errors are like
"cannot open file '/usr/lib/R/etc/Makeconf': No such file or directory
Warning in install.packages :
" installation of package ‘data.table’ had non-zero exit status"
"installation of package ‘htmltools’ had non-zero exit status
/usr/lib/R/bin/R: line 142: /usr/lib/R/etc/ldpaths: No such file or directory
/usr/lib/R/bin/R: line 249: /usr/lib/R/etc/ldpaths: No such file or directory
Error in file(con, "r") : cannot open the connection"

and the files in my /usr/lib/R/etc is screenshot as follows, the repositories file is created by my self and it was empty

Thank you in advance!

I would suggest removing R and RStudio fully, then follow the instructions here to install R 3.6. Confirm that it runs in a terminal, then install RStudio (and any required R packages).

Thank you sir, I'll try that

Did this work for you? I'm having a similar problem and I've uninstalled/reinstalled several times.

Not using that , I use
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
to clean out ,and install R 4.3.3 by the guide of CRAN , Then problem solved.
Hope that'll help you too.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.