Search code examples
rinstallationpackagebioconductor

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

Solution

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