Skip to content

Dear Internet Explorer user: Your browser is no longer supported

Please switch to a modern browser such as Microsoft Edge, Mozilla Firefox or Google Chrome to view this website's content.

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”

On 31 January 2018, Ke wrote: Hyperlink chain icon

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.

Reply

On 2 February 2018, Rahul wrote: Hyperlink chain icon

Thanks. This worked perfectly.

Reply

On 15 February 2018, Lake wrote: Hyperlink chain icon

thank you so much, it has helped me to solve the problem

Reply

On 16 February 2018, James wrote: Hyperlink chain icon

Hi, Just thought I’d note that this solution didn’t work for me. Thanks.

Reply

On 2 March 2018, Sean wrote: Hyperlink chain icon

Works great! Thanks a lot!!!

Reply

On 5 March 2018, M L wrote: Hyperlink chain icon

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.

Reply

On 8 March 2018, Chris wrote: Hyperlink chain icon

Thanks for this, the IT team didn’t want to change the virusguard settings for me, so I thought I was stuck

Reply

On 14 March 2018, wool wrote: Hyperlink chain icon

You are the king!

Reply

On 20 March 2018, Gitaish Gulati wrote: Hyperlink chain icon

Works perfectly for me!!

Reply

On 20 March 2018, Harco wrote: Hyperlink chain icon

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.

Reply

    On 21 March 2018, Adam Dimech wrote: Hyperlink chain icon

    Yes, I have had this happen a couple of times myself when upgrading. It’s annoying, I agree.

    Reply

On 22 March 2018, FREZOULS F wrote: Hyperlink chain icon

Thank you so much. I am a beginner in R, and didn’t understand some other responses. Your answer saved my day!

Reply

On 24 March 2018, B wrote: Hyperlink chain icon

Thank you so much! This saved me a huge amount of time and trouble.

Reply

On 30 March 2018, Anne wrote: Hyperlink chain icon

Thank you! It works perfectly! You are the best!

Reply

On 30 March 2018, L B wrote: Hyperlink chain icon

Yep, didn’t work for me either.

Reply

On 4 April 2018, drstukatl wrote: Hyperlink chain icon

I used this to install readxl, helped alot but somehow missed the “pillar” component
installed it separately, worked.

Reply

On 17 April 2018, BRIAN MERRILL wrote: Hyperlink chain icon

Worked perfect!

Reply

On 22 April 2018, Alex Yerukhimov wrote: Hyperlink chain icon

Worked perfectly! thank you very much!

Reply

On 23 April 2018, Danny wrote: Hyperlink chain icon

Thanks very much. Is there a way to change this through commands instead of interactively?

Reply

On 7 June 2018, Fanuel Shem wrote: Hyperlink chain icon

Thanks a lot. You are a star!

Reply

On 16 July 2018, Claudia Pelizaro wrote: Hyperlink chain icon

Thank you so much!

Reply

On 2 August 2018, Ashrith wrote: Hyperlink chain icon

Works like charm! Like many others, I spent hours fixing this issue and then landed on this post. Thank you so much!

Reply

On 9 August 2018, M Henni wrote: Hyperlink chain icon

For some reason in my corporate (Lenovo T560) laptop, the “Sys.sleep(2.5)” did not work, but the “Sys.sleep(4.5)” did ..

Reply

On 8 September 2018, Saptarshi wrote: Hyperlink chain icon

Hi, do I have to run this code every time we start a R session?

Reply

    On 22 October 2018, Adam Dimech wrote: Hyperlink chain icon

    Unfortunately yes, every time you want to update R packages.

    Reply

On 10 October 2018, Espoir wrote: Hyperlink chain icon

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?

Reply

On 10 October 2018, Espoir wrote: Hyperlink chain icon

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

Reply

On 19 December 2018, Akshay wrote: Hyperlink chain icon

Thanks a lot. It worked for me.

Reply

On 9 May 2019, CESAR GIL wrote: Hyperlink chain icon

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.

Reply

On 11 May 2019, Michael H wrote: Hyperlink chain icon

Thanks, I couldn’t figure out why I couldn’t install packages. this did the trick!

Reply

On 13 August 2019, Emanuel wrote: Hyperlink chain icon

You are my hero! :)

Reply

On 28 September 2019, Gill wrote: Hyperlink chain icon

I have come across the same problem, but am running R 3.5.1, so Sys.sleep() no longer exists. Is there another fix?

Reply

Have Your Say

The following HTML is permitted:
<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>

Comments will be published subject to the Editorial Policy.