Windows 7,update.packages 问题:“无法移动临时安装"? [英] Windows 7, update.packages problem: "unable to move temporary installation"?
问题描述
在授予我的用户对 R 文件夹的完全权限后,我将 R 2.13.0 与 Windows 7 一起使用(如此处).这使我可以很好地安装新软件包.
I am using R 2.13.0 with windows 7, after giving my user full privileges to the R folder (as described here). This allows me to install new packages just fine.
但是,当使用 update.packages() 更新现有包时,我不断收到以下错误(例如,在更新 MASS 包时):
However, when using update.packages(), to update existing packages, I keep getting the following error (for example, when updating the MASS package):
包'MASS'成功解包并检查MD5总和
package 'MASS' successfully unpacked and MD5 sums checked
警告:无法移动临时安装'C:程序文件RR-2.13.0libraryfile6cae3bcfMASS'到 'C:ProgramFilesRR-2.13.0libraryMASS'
Warning: unable to move temporary installation 'C:Program FilesRR-2.13.0libraryfile6cae3bcfMASS' to 'C:Program FilesRR-2.13.0libraryMASS'
关于如何解决这个问题有什么建议吗?
Any suggestions on how to fix this?
ps:以管理员身份运行 R 或将库位置移出 Program Files 不是解决方案(这是一个黑客 - 但我正在寻找解决方案)
p.s: Running R as an administrator or shifting the library location out of Program Files is not a solution (it's a hack - but I am looking for a solution)
推荐答案
我发现问题确实出在杀毒软件的实时文件系统保护"上.我执行以下操作来解决问题:
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)
我编辑第 140 行(R 3.4.4 中的第 142 行):
I edit line 140 (line 142 in R 3.4.4):
Sys.sleep(0.5)
到:
Sys.sleep(2)
我似乎防病毒软件阻止了包 tmp 目录的创建.将其更改为 2 秒后,错误消失了.
I seems like the antivirus stalls the creation of the package tmp dir. After changing it to 2 seconds the error is gone.
以编程方式执行此操作
trace(utils:::unpackPkgZip, quote(Sys.sleep(2)), at = which(grepl("Sys.sleep", body(utils:::unpackPkgZip), fixed = TRUE)))
(学分@DavidArenburg)
(credits @DavidArenburg)
这篇关于Windows 7,update.packages 问题:“无法移动临时安装"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!