Resolving ‘Unable to move temporary installation’ in R
A simple solution to overcoming the “Unable to move temporary installation” fault when installing packages in R
R is notorious for its difficult installations and upgrades (although I have tried to make upgrading easier). Transferring packages between installations can be a challenge, but another problem can arise when the installations of libraries are too fast. If this happens, an R user will start noticing an error: “Unable to move temporary installation”.
To overcome this problem, type the following command into R:
trace(utils:::unpackPkgZip, edit=TRUE)
Go to Line 140 and change Sys.sleep(0.5)
to Sys.sleep(2.5)
.
Comments
32 responses to “Resolving ‘Unable to move temporary installation’ in R”
Thanks for the hints. It saved my day. I have spent hours trying to resolve the problem. Most common suggestion is to disable the anti virus software. Unfortunately, I am not allowed to do that.
Thanks. This worked perfectly.
thank you so much, it has helped me to solve the problem
Hi, Just thought I’d note that this solution didn’t work for me. Thanks.
Works great! Thanks a lot!!!
Me too. Spent all day trying to install rsconnect, and its dependencies. Reinstalled Rstudio and R, both a few times… tried to defeat the antivirus, changed permissions on any remotely relevant directories… manually unzipped one of the packages into the library, and then found this. It works! Thank you Soooooo much!!!!!!
Manually unzipping the downloaded packages into the library path also worked but this is less complicated and hopefully a more permanent solution.
Thanks for this, the IT team didn’t want to change the virusguard settings for me, so I thought I was stuck
You are the king!
Works perfectly for me!!
Is it normal that I have to change the parameter everytime i start RStudio? It somehow doesn’t save the change after closing the application.
Yes, I have had this happen a couple of times myself when upgrading. It’s annoying, I agree.
Thank you so much. I am a beginner in R, and didn’t understand some other responses. Your answer saved my day!
Thank you so much! This saved me a huge amount of time and trouble.
Thank you! It works perfectly! You are the best!
Yep, didn’t work for me either.
I used this to install readxl, helped alot but somehow missed the “pillar” component
installed it separately, worked.
Worked perfect!
Worked perfectly! thank you very much!
Thanks very much. Is there a way to change this through commands instead of interactively?
Thanks a lot. You are a star!
Thank you so much!
Works like charm! Like many others, I spent hours fixing this issue and then landed on this post. Thank you so much!
For some reason in my corporate (Lenovo T560) laptop, the “Sys.sleep(2.5)” did not work, but the “Sys.sleep(4.5)” did ..
Hi, do I have to run this code every time we start a R session?
Unfortunately yes, every time you want to update R packages.
hello Sir,
I tried “trace(utils:::unpackPkgZip, edit=TRUE)” and changed the “Sys.sleep(2.5)” but am still having the same warning: unable to move…
any other suggestion?
Thanks?
here is what i have:
> install.packages(“dplyr”)
Installing package into ‘C:/Users/pmurerwa13/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘Rcpp’
trying URL ‘https://cran.rstudio.com/bin/windows/contrib/3.4/Rcpp_0.12.19.zip’
Content type ‘application/zip’ length 4433722 bytes (4.2 MB)
downloaded 4.2 MB
trying URL ‘https://cran.rstudio.com/bin/windows/contrib/3.4/dplyr_0.7.6.zip’
Content type ‘application/zip’ length 2851553 bytes (2.7 MB)
downloaded 2.7 MB
package ‘Rcpp’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Users\pmurerwa13\Documents\R\win-library\3.4\file5e866b12ac9\Rcpp’ to ‘C:\Users\pmurerwa13\Documents\R\win-library\3.4\Rcpp’
package ‘dplyr’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\pmurerwa13\AppData\Local\Temp\RtmpuGdxKS\downloaded_packages
Thanks a lot. It worked for me.
Worked greatly for me too. Just so other people with the same problem may know, I started used BitLocker encryption on my pendrive where R is installed, and I guess the encryption process takes a bit longer, so the extra delay worked fine.
Thanks, I couldn’t figure out why I couldn’t install packages. this did the trick!
You are my hero! :)
I have come across the same problem, but am running R 3.5.1, so Sys.sleep() no longer exists. Is there another fix?