"unable to move temporary installation" when installing dependency packages in R
Asked Answered
C

4

4

When I install a package, the prerequisite packages were installed first before the actual package. I get the "unable to move temporary installation" warning for all the prerequisite packages, but no such warning for the actual package. But the package will give error when I load it.

For example, when I install.packages("mlr"), it installed all the dependencies and I got various warnings such as this:

package ‘BBmisc’ successfully unpacked and MD5 sums checked
Warning in install.packages :
  unable to move temporary installation ‘D:\Documents\R\win-library\3.2\filef3811142c73\BBmisc’ to ‘D:\Documents\R\win-library\3.2\BBmisc’

I ignored it because it's just a warning. Unfortunately library(mlr) gave me Error: package ‘BBmisc’ required by ‘mlr’ could not be found, so I couldn't ignore it after all.

install.packages("BBmisc") directly didn't produce the warning.

What gives? How can I work through this, short of installing all the dependencies on my own?

In case session info needed:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_Singapore.1252  LC_CTYPE=English_Singapore.1252   
[3] LC_MONETARY=English_Singapore.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Singapore.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.2.2
Coplin answered 12/1, 2016 at 9:21 Comment(2)
Runing antivirus? Often source of this kind of problem in Windows.Statfarad
yes, which I cannot disable (office environment). Any way I can verify this is the cause?Coplin
G
14

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.

Guntar answered 30/5, 2017 at 7:45 Comment(1)
I had the same problem only recently probably due to a change made by company IT. Some packages would install properly but a lot wouldn't. Running the debug command above before installing the problem packages worked perfectly. I only had to click continue at most 3 times. Install still only took several seconds.Alvey
A
2

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..!!!
Araujo answered 6/11, 2017 at 6:38 Comment(0)
O
1

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.

Opisthognathous answered 7/12, 2017 at 9:37 Comment(2)
Running programs on administrator's rights should really be very last resort due to security reasons.Mineral
You are of course absolutely right. But this was the only solution I could find, and I went through all the suggested solutions I could find. This also included a fresh Windows 10 installation (same security measures as my W7). All failed, so this was the last resort. I wonder why it should be a security risk to move a file around in my user directory in the first place.Opisthognathous
G
0

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)
Goulette answered 14/9, 2018 at 17:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.