install.packages 中的警告:无法移动临时安装 [英] Warning in install.packages: unable to move temporary installation

查看:50
本文介绍了install.packages 中的警告:无法移动临时安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 R/RStudio 中安装或更新软件包时,我发现了许多与此警告相关的问题,但似乎没有一个完全符合我的情况:

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:

  • 企业 Windows 7 系统,因此无法获得管理员权限
  • 无法更改 McAfee Anti-Virus 例外列表
  • R 完全安装在用户空间 C:\Users\[myname]\R
  • RStudio 完全安装在用户空间 C\Users\[myname]\RStudio
  • 在任何一个目录中都没有权限问题...我对它们有完全的访问控制
  • 问题仅在安装 R 3.4 后才开始,但 RStudio 在启动时随机失败或挂了几个月
  • R_LIBS_USER 添加为用户环境变量,指向正确的目录
  • .libPaths() 显示正确的目录,包括系统和用户
  • R 版本 3.4.2,RStudio 版本 1.0.153
  • 卸载了 R 和 Rstudio 并重新安装了两者
  • 尝试了 trace(utils::unpackPkgZip,edit = T) 并将第 140 行 Sys.sleep(0.5) 编辑为 Sys.sleep(2),有时会暂时起作用,但编辑不会保持原状...在每次会话重新启动时重置为 Sys.sleep(0.5)
  • 在 RStudio 和 RGui 中都发生
  • 任何大于几 Kb 的包都会给出以下信息:

  • Corporate Windows 7 system, so no access to admin privileges
  • No way to make changes to McAfee Anti-Virus exceptions lists
  • R is fully installed in the user space C:\Users\[myname]\R
  • RStudio fully installed in userspace C\Users\[myname]\RStudio
  • no permission issues in either of the directories... I have full access control over them
  • Problem only started after installing R 3.4, but RStudio has randomly failing at start or hanging for a few months now
  • R_LIBS_USER added as user environment variable, pointing to right directory
  • .libPaths() show correct directories, both system and user
  • R version 3.4.2, RStudio version 1.0.153
  • Uninstalled both R and Rstudio and did a clean re-install of both
  • Tried trace(utils:::unpackPkgZip,edit = T) and edited Line 140 Sys.sleep(0.5) to Sys.sleep(2), which sometimes works temporarily but the edit won't stay put... resets to Sys.sleep(0.5) on every session restart
  • Happens in both RStudio and RGui
  • Any package larger than a few Kb gives the message:

package ‘packagename’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  unable to move temporary installation ‘C:\Users\[myname]\R\win-library\3.4\file2b884fc37c13\packagename’ to ‘C:\Users\[myname]\R\win-library\3.4\packagename’

软件包无法安装或更新.所以,我的问题是:

The packages are failing to install or update. So, my questions are:

  1. 有没有一种方法可以完全避免这个问题,而不需要管理员权限或更改防病毒策略?
  2. 有没有办法让 unpackPkgZip 的编辑永久保存?
  1. is there a way to avoid the problem altogether that doesn't require admin privileges or changes to the antivirus policies?
  2. is there a way to get the edit to unpackPkgZip to save permanently?

在这一点上,我被难住了.我怀疑这与防病毒软件在下载后临时锁定文件/目录有关,但我对此无能为力.Sys.sleep(2) 似乎可以解决问题,但我无法在每次安装或更新包之前继续这样做,并且似乎无法让编辑保持原状.

At this point, I'm stumped. I suspect it has something to do with the antivirus temporarily locking the file/directory after download, but I can't do anything about it from that end. The Sys.sleep(2) seems to do the trick, but I can't keep doing that before every package install or update and can't seem to get the edit to stay put.

推荐答案

在这个问题上,这是唯一对我有用的方法(不幸的是,卸载防病毒软件并没有让我到任何地方),所以希望它对你有用.

This was the only thing that worked for me on this issue (the uninstalling antivirus software didn't get me anywhere, unfortunately), so hopeful it works for you.

在 Windows 系统上,有时库的安装可能运行得太快,从而产生无法移动临时安装"的错误.然后在用户库中没有找到这个包,因为还没有移过来...

On Windows systems, sometimes installation of libraries may be running too fast, creating the error "unable to move temporary installation". Then the package is not found in the user library, because it hasn't been moved over...

要修复,请尝试:trace(utils::unpackPkgZip, edit=TRUE)

然后转到代码中的第 140 行,将 Sys.sleep(0.5) 更改为 Sys.sleep(2.5)

Then go to Line 140 in the code and change Sys.sleep(0.5) to Sys.sleep(2.5)

这是一个不错的长期解决方案,不需要手动移动包、卸载软件、替换管理员职责或单独将包路由到某些位置.

This is a nice longer term solution that does not require manual package moving, uninstalling software, replacing admin responsibilities, or individually routing packages to certain locations.

这篇关于install.packages 中的警告:无法移动临时安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆