Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package ‘stringr’ was installed before R 4.0.0: please re-install it BiocManager Installation path not writeable, unable to update packages

Got the errors Error : package ‘stringr’ was installed before R 4.0.0: please re-install it and BiocManager Installation path not writeable, unable to update packages:

and further down the road rstudio gave me

/usr/local/lib/R/lib/libR.so not found
like image 621
kana Avatar asked Jul 25 '20 13:07

kana


2 Answers

I had a similar problem when upgrading from R 3.6 to 4.0 in my Linux box. I am also answering this because this question is one of the first results google gives when looking for this problem. It turns out that, even by removing R (apt purge) there is a folder that remains in the system creating a lot of problems for the future installation. I want to link the GREAT answer that was given here and saved me: https://askubuntu.com/questions/1219737/installing-ggplot2-for-r-3-6-on-ubuntu-18-04

In Linux systems you should look in:

$ ls /usr/local/lib/R/site-library

If the folder has a list of directories you should remove everything with:

sudo rm -Rf /usr/local/lib/R/site-library

Then reinstall R and all the libraries.

like image 118
Fabrizio Avatar answered Nov 06 '22 12:11

Fabrizio


This is a long answer to how to fix these errors but I assume necessary and also tips and tricks included (e.g. don't install R 4.0.2 right now (Jul 25, 2020)). It caused me a lot of pain because there were many more errors that I ran into on the way. Error : package ‘stringr’ was installed before R 4.0.0: please re-install it and BiocManager Installation path not writeable, unable to update packages:

I removed .RData in my home folder (invisible, use ls -la) This fixed my problem for the installed before R 4.0.0 error, but did not fix my bioconductor problems. I assume it might work if you only had the re-install error.

After many attempts at trying to get my packages to load but only getting these errors, I opted to reinstall R. In R, I ran .libpaths and deleted all the files in each of the directories. I then reinstalled R by downloading R from https://www.r-project.org/ and ran the general compile commands in the downloaded folder ./configure --enable-R-shlib --with-blas --with-lapack make sudo make install. The --enable-R-shlib is needed for rstudio to be able to use R, but the others aren't.

On Jul 25, 2020 I tried to install from apt on ubuntu, but rstudio was not able to find libR.so (error of /usr/local/lib/R/lib/libR.so not found). I tried to compile from source R 4.0.2 with the ./configure --enable-R-shlib which should make the libR.so but this returned an error.

I assume this to be an underlying problem as running ./configure --enable-R-shlib compile from source with R 4.0.0, I got the files and Rstudio opened up (please fix R 4.0.2 and subsequently apt).

I then ran the general

if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install(version = "3.11")

to install biocmanager and it finally worked.

like image 3
kana Avatar answered Nov 06 '22 13:11

kana