installation path not writable R, unable to update packages

前端 未结 11 1696
轻奢々
轻奢々 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:51

    One solution is to open a terminal and load R using admin rights

    sudo R
    update.packages()
    source("https://bioconductor.org/biocLite.R")
    biocLite()
    

    Then you can update. But careful. This can create packages by the admin in a directory supposed to be owned by a user.

    In this case, instead of loading R as root (which is solving the problem until the next update), check the .libPaths(). You will have a list of directories.

    .libPaths()
    "/home/it_s_me/R/x86_64-pc-linux-gnu-library/3.4" "/usr/lib/R/library"
    

    In my case, all packages in "/usr/lib/R/library" are owned by root, and all except one are owned by a normal user (not root) at "/home/itsame/R/x86_64-pc-linux-gnu-library/3.4".

    If you have admin rights, an easy solution may be to run chown in all the places: For example, I had trouble updating the curl package. I used:

    sudo chown -R it_s_me /home/it_s_me/R/x86_64-pc-linux-gnu-library/3.4/curl/
    
    0 讨论(0)
  • 2020-12-15 04:52

    Since with the version of R 3.6.1 the script http://bioconductor.org/biocLite.R returns this message " Error: With R version 3.5 or greater, install Bioconductor packages using BiocManager; see https://bioconductor.org/install " I solved the problem with the following steps:

    1. Get the list of directories used by R to install libraries and choose the one with write permissions using: .libPaths()
    2. Installing the "BiocManager" library using: install.packages("BiocManager")
    3. Installation of the library "bioconductor" by forcing the directory with write permissions using: BiocManager::install("Rgraphviz", lib = "C:/Users/tizbet/Documents/R/win-library/3.6")

    I worked on the following R installation:

    platform x86_64-w64-mingw32, arch x86_64, os mingw32, system x86_64, mingw32, version.string R version 3.6.1 (2019-07-05)

    I was inspired by the Kasper Thystrup Karstensen answer

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

    Correct way to resolve this problem is as followed:

    1. Start R as an administrator: sudo R
    2. In R console execute this: update.packages()

    Summary is, some latest packages are required and updating those on admin mode solve this issue. `

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

    Quit R by typing q() and enter then type again sudo R and hit enter for mew package installation.

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

    I solved it by opening Rstudio as administrator.

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