Warning in Install.Packages: Unable to Move Temporary Installation

Cant install a package in R

There are a couple of potential solutions at this link: Windows 7, update.packages problem: "unable to move temporary installation"?

Could be an antivirus problem, or possibly lacking administrator privileges. The link recommends installing R in a different folder, or downloading the zip file for the package and installing it by hand.

Windows 7, update.packages problem: unable to move temporary installation ?

I found that the problem indeed is the antivirus "real time file system protection". I do the following to fix the problem:

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

I edit line 140 (line 142 in R 3.4.4):

Sys.sleep(0.5)

to:

Sys.sleep(2)

I seems like the antivirus stalls the creation of the package tmp dir. After changing it to 2 seconds the error is gone.

EDIT: to do this programmatically execute

trace(utils:::unpackPkgZip, quote(Sys.sleep(2)), at = which(grepl("Sys.sleep", body(utils:::unpackPkgZip), fixed = TRUE)))

(credits @DavidArenburg)



Related Topics



Leave a reply



Submit