Warning in install.packages: unable to move temporary installation

后端 未结 11 2452
孤城傲影
孤城傲影 2020-12-05 05:00

I\'ve found a number of questions related to this warning when installing or updating packages in R/RStudio, but none seem to completely match my situation:

  • Co
相关标签:
11条回答
  • 2020-12-05 05:21

    This was the error message that was spit out for me:

    package ‘mlogit’ successfully unpacked and MD5 sums checked
    Warning in install.packages :
    unable to move temporary installation ‘C:\Users\E\Documents\R\win-
    library\3.4\file9ec6cfb5e40\mlogit’ to ‘C:\Users\E\Documents\R\win-
    library\3.4\mlogit’
    
    The downloaded binary packages are in
    C:\Users\E\AppData\Local\Temp\RtmpS0uNDm\downloaded_packages
    

    What I did was went to where the package was downloaded (C:\Users\E\AppData\Local\Temp\RtmpS0uNDm\downloaded_packages) and then copied that zipped file to the desktop then used Winzip to unzip to my file directory where all the packages for R are stored (C:\Users\E\Documents\R\win-library\3.4). It now will load in R.

    library("mlogit")
    Loading required package: Formula
    Loading required package: maxLik
    Loading required package: miscTools
    ....
    

    It worked well for me as it was the only package that was not downloading for some reason. Might not be helpful if you have to do this for every package.

    0 讨论(0)
  • 2020-12-05 05:21

    I struggled with the same issue. For me (on Windows 10), the issue was using MalwareBytes (Premium trial). I uninstalled it and went back to using Windows Defender, and the issue was resolved. Perhaps if more time, I can find out how to create an exception and/or file checking delay for MalwareBytes (i.e., which is a pretty good program), but the user-guide (https://www.malwarebytes.com/pdf/guides/Malwarebytes-User-Guide.pdf) is unclear on this.

    0 讨论(0)
  • 2020-12-05 05:22

    Got the same error - seems to be a company gp / access security problem.

    It might also be worthwhile checking whether the folder it fails to write to has a Read Only structure (Right Click - Properties). This folder's address can be found by running: .libPaths()[1] in R.

    An ad hoc solution to this problem is to unzip and store the downloaded (but not moved) packages using a piece of R code below. You will get an error stating where the binary packages are located (something like: C:/Users/....AppData/...)

    Now you can simply unzip the files from here to your .libPaths() location

    zipF <- list.files("C:/Users/<YOURNAMEHERE>/AppData/Local/Temp/Rtmp4Apz6Z/downloaded_packages", full.names = TRUE)
    outDir <- .libPaths()[1]
    
    for(i in 1: length(zipF)) {
    unzip(zipF[i],exdir=outDir)
    }
    

    A more general solution will still be extremely worthwhile, as this is unfortunately a common problem when updating R on Windows.

    0 讨论(0)
  • 2020-12-05 05:25

    Extending the Sys.sleep value to 3.5 on line 142 in the unpackPkgZip function works manually via

    trace(utils:::unpackPkgZip, edit=TRUE)
    

    However, it can also be done programmatically by running the following before install.packages:

    localUnpackPkgZip <- utils:::unpackPkgZip
    body(localUnpackPkgZip)[[14]][[4]][[4]][[4]][[3]][[3]][[2]][[2]] <- substitute(3.5)
    assignInNamespace("unpackPkgZip", localUnpackPkgZip, "utils")
    

    This must be run every time you have a new session. You can run it multiple times in the same session without issue.

    0 讨论(0)
  • 2020-12-05 05:26

    I fixed my instance of this problem (Windows 7) by removing the 'Read-Only' attribute of the folder R was trying to move stuff to.

    I went to the Run command from the Start menu in Windows (7) and typed attrib -r +s drive:\\

    Note that just right clicking the folder and trying to change properties didn't take, as per this link from Microsoft: https://support.microsoft.com/en-us/help/326549/you-cannot-view-or-change-the-read-only-or-the-system-attributes-of-fo

    Hope that helps someone.

    I hope this change doesn't screw me in other ways.

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