installation path not writable R, unable to update packages

前端 未结 11 1695
轻奢々
轻奢々 2020-12-15 04:10

I am trying to install Bioconductor into R, using the code on their website. When I type in the code (see bellow) I get an error message saying that some packages can\'t be

相关标签:
11条回答
  • 2020-12-15 04:33

    I had same problem, and the answer is to give Root Access to R i.e run R or Rstudio as administrator.

    check this question out: installed directory not writable, cannot update packages 'boot', 'class', 'KernSmooth', 'mgcv', 'nnet', 'rpart', 'spatial'

    0 讨论(0)
  • 2020-12-15 04:34

    In general, I would advise against changing the permission in system folders, because R should work without additional administrative rights.

    Thus I would likewise advise against installing packages using administrative rights, as you would be required to do so in the future every time you have to update these packages!

    To backtrace this issue and prevent to minimize it in future updates, you should perform the following steps:

    1. Note which packages that fail to update (already shown in the error message).
    2. Locate the folders where all R packages are installed using .libPaths(). This should provide two results, a destination in your home folder and a system folder.

    "/home/USER/R/x86_64-pc-linux-gnu-library/X.X" "/usr/lib/R/library"

    1. Install the packages with install.packages(c("PKG1", "PKG2", "PKG3")) or BiocManager::install(c("PKG1", "PKG2", "PKG3"))*
    2. Only If you have administrator rights: Manually remove the older package folders from the system folder ("/usr/lib/R/library"), using administrator rights (sudo) OR enter R with administrator rights One last time and run remove.packages(c("PKG1", "PKG2", "PKG3"), lib = "/usr/lib/R/library").

    *If there are issues with the installation path, add the argument , lib = "/home/USER/R/x86_64-pc-linux-gnu-library/X.X" to either of the install functions in step 3. This argument explicitly states to install in your home folder.

    There is a single issue with this approach, at least with the official R repository on Arch Linux: Whenever R is updated, the updated version still includes packages in the system folder, that can't be updated without administrative rights. Therefore for each R update, this procedure must be repeated. I'm especially looking at you survival!!!

    *Edit: It is important to note that biocLite is no longer the recommended tool for installing BioConductor packages. You should instead use BiocManager, which is in the official CRAN repository (install.packages("BiocManager")).

    **Second edit: As this answer still receives votes, I have updated and cleaned up the answer.

    0 讨论(0)
  • 2020-12-15 04:39

    It was a permission issue for me. First, I identified where the packages were installed using installed.packages()[, c("Package", "LibPath")]. This outputs a long 2 column matrix with the names and locations of the packages. Then you will see where the offending packages are. In my case, they were at /usr/lib/R/site-library and /usr/lib/R/library. Then I changed the permission of these folders by chmod (I used chmod -R 777 on the main R folder, this is my personal computer, so security is not a big concern here I think).

    0 讨论(0)
  • 2020-12-15 04:39

    If you are running R/Rstudio on Windows, then just open R/Rstudio as administrator. Right click on the icon then run as administrator

    0 讨论(0)
  • 2020-12-15 04:41

    It looks like several 'recommended' packages are installed in two places -- maybe by an administrator account in a directory you don't have write access to, and then by RStudio in a directory where you do have write access. biocLite() is complaining about the former.

    Unless biocLite() complains about a Bioconductor package that cannot be installed (different from cannot be updated), there is no problem and basic Bioconductor packages have been successfully installed. Check out https://support.bioconductor.org for future Bioconductor-related support.

    0 讨论(0)
  • 2020-12-15 04:48

    I had a similar problem with other Bioconductor packages and the solution was simpler than I thought. I had to install some OS packages pointed out on my log: libcurl-dev, libcurl4-openssl-dev, libssl-dev.

    My advice is to check your R log and look for "Configuration failed because [PACKAGE] was not found. Try installing".

    0 讨论(0)
提交回复
热议问题