“unable to move temporary installation” when installing dependency packages in R

大城市里の小女人 提交于 2019-12-03 16:27:22

This problem is caused by the antivirus (most likely) as was suggested by user3710546. If you cannot disable the antivirus a workaround is to enable debugging in the package unzip function with this command:

debug(utils:::unpackPkgZip)

This will then allow you to step through the code (by pressing enter many times). This just makes the function run slower, giving the antivirus software time to complete its scanning of the new files before R wants to copy them.

I found this solution here.

Following way helped for me for windows 10: I wanted to install shiny package and was getting same error.

  1. I created "shiny" folder inside /library.
  2. I did setwd to this shiny folder.
  3. Then triggered bellow command: install.packages("shiny",destdir="./",lib="./")
  4. It still failed with the same error, but now zips were downloaded in the shiny folder.
  5. There were two zips: httpuv.zip and shiny.zip
  6. I extracted contents of shiny zip into shiny folder and contents of httpuv zip in httpuv folder.
  7. Restarted R studio to be safe. Then triggered library(shiny) and boom, it worked like a charm..!!!

I tried all the solutions suggested here and elsewhere. I'm running Windows 7 in a large company where antivirus etc. is forced. The solution for me was:

  1. Uninstall R and RStudio
  2. Delete all files (including hidden) that has to do with R
  3. Install R and RStudio as administrator
  4. Run RStudio as administrator

Only downside is a warning when starting RStudio (running as admin). All updates and installs works perfect.

If you run the below statement right before the install.packages expression then it should install the package:

trace("unpackPkgZip", where=asNamespace("utils"), quote(Sys.sleep(2.5)), at=14L 
,print=FALSE)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!