Windows7,update.package 问题: “无法移动临时安装”?

我将 R 2.13.0与 Windows 7一起使用,在此之前,我将给予我的用户对 R 文件夹的完全权限(如 给你所述)。 这使我可以很好地安装新的软件包。

然而,当使用 update.packages ()来更新现有的包时,我不断得到以下错误(例如,在更新 MASS 包时) :

「 MASS 」包裹成功拆封及检查 MD5金额

警告: 无法移动临时安装 C: 程序 文件 R-2.13.0库文件6cae3bcf MASS’ 到 C: 程序 档案 R-2.13.0图书馆 MASS’

对于如何解决这个问题有什么建议吗?

P.s: 作为管理员运行 R 或者将库位置从 Program Files 中移除都不是一个解决方案(这是一个技巧——但我正在寻找一个解决方案)

84266 次浏览

Can you not use the lib.loc parameter to only update packages in your personal library (in user)? There should be no way to enable a normal, non-augmented user to change files in the program files folder, so the only thing you can do (if you don't want to augment the user) is to have R not updating packages there.

A workaround is to avoid installing R in the program files folder (which may be more or less of a hack than just shifting the library location out of it, depending on your point of view).

Finally, if lib.loc doesn't cut it, you can look at the source code for update.packages and create your own customized version that will always avoid the common library location in program files.

Just to update everyone, I (think that I) found out the source of the problem: antivirus.

The "real time file system protection" was blocking R from copying the files between folders once they were downloaded. Upon adding the R directory to the exception list (coupled with adding user permission and installing R on D:\R), and the problem went away. With all of this work, I might as well switch to Linux (I should, really...)

(I updated my post with the above information: http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/)

I hope it will help someone in the future, Tal

If you can just download the binary straight from CRAN. On windows when downloaded it will be a zip file. Now manually unzip this into the ..library/ folder of your R (.libPaths()). It worked for me on some packages.

I just met the same question, and the solution I found out was that you should install packages using the original R software (plus, you should choose the right mirror site, some of them are blocked). At first I used Rstudio to install packages and I got the same problem as you met. Hope this is helpful.

I have run into this error several times. In my own case, it is because our admins want us to use remote virtual disks (on Windows 7) for our files and everything is locked up tight as a drum. The only way I can use R packages is in a lib directory on that remote virtual disk. This wouldn't be a problem except that the network isn't always smooth and fast. Thus, when I need a package, especially one with several other packages in tow (e.g., MBESS), I either have to go through the get.packages() process multiple times until it finally finishes or make it IT's headache to do quick like the bunny for me. I can't always wait for IT.

I just went to the library folder (Windows XP) and deleted all fileXXXX folders. Reran the install an it is worked.

If you cannot turn off your antivirus, due to corporate policy for example, here is a workaround that I found. Debugging the unzip package function and then stepping through it gives the antivirus enough time to do its job without interfering. Use this command:

debug(utils:::unpackPkgZip)
install.packages("packageName")

and then step through the code (by pressing enter many times) when R starts debugging during the installation.

I found this solution here.

I had the same problem. Since the issue seems to be the antivirus blocking the transf of a downloaded file, I tried a different download method in the install.packages and it worked.

For example:

install.packages("stringr", method = "curl")

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)

I had this problem installing both swirl and dplyr. I am working on Windows 64-bit.

Warning: unable to move temporary installation

What I did is I accessed my temporary files on the C: drive, and opened my file extractor program and I extracted the files from the temp file in the C: drive to my R program files in the C: drive, by manually copying them. THIS WORKED FOR BOTH dpylr and swirl. Stoked!

Cheers,

Peach

You must go into the properties of the R folder and change the security parameters. You can enable the option to write and modify for all users.

The error : "unable to move temporary installation" is basically arising due to any of the antivirus running on your system. Try unzipping the downloaded file from the Temp folder into the default library path (you can get it by running .libPaths() in R session).

I'm using a MRAN and I was having so many versioning issues. Trying to work with tidyverse and ggplot2 and by upgrading to the latest version from Microsoft it solved all of my R-Studio versioning issues.

Version info:

Microsoft R Open 3.5.1
The enhanced R distribution from Microsoft
Default CRAN mirror snapshot taken on 2018-08-01.

Download Microsoft R Open 3.5.1