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).

32 responses to “Resolving ‘Unable to move temporary installation’ in R”

On 31 January 2018, Ke wrote:

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.

On 2 February 2018, Rahul wrote:

Thanks. This worked perfectly.

On 15 February 2018, Lake wrote:

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

On 16 February 2018, James wrote:

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

On 2 March 2018, Sean wrote:

Works great! Thanks a lot!!!

On 5 March 2018, M L wrote:

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.

On 8 March 2018, Chris wrote:

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

On 14 March 2018, wool wrote:

You are the king!

On 20 March 2018, Gitaish Gulati wrote:

Works perfectly for me!!

On 20 March 2018, Harco wrote:

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.

On 21 March 2018, Adam Dimech wrote:

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

On 22 March 2018, FREZOULS F wrote:

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

On 24 March 2018, B wrote:

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

On 30 March 2018, Anne wrote:

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

On 30 March 2018, L B wrote:

Yep, didn’t work for me either.

On 4 April 2018, drstukatl wrote:

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

On 17 April 2018, BRIAN MERRILL wrote:

Worked perfect!

On 22 April 2018, Alex Yerukhimov wrote:

Worked perfectly! thank you very much!

On 23 April 2018, Danny wrote:

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

On 7 June 2018, Fanuel Shem wrote:

Thanks a lot. You are a star!

On 16 July 2018, Claudia Pelizaro wrote:

Thank you so much!

On 2 August 2018, Ashrith wrote:

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

On 9 August 2018, M Henni wrote:

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

On 8 September 2018, Saptarshi wrote:

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

On 22 October 2018, Adam Dimech wrote:

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

On 10 October 2018, Espoir wrote:

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?

On 10 October 2018, Espoir wrote:

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)

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)

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

On 19 December 2018, Akshay wrote:

Thanks a lot. It worked for me.

On 9 May 2019, CESAR GIL wrote:

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.

On 11 May 2019, Michael H wrote:

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

On 13 August 2019, Emanuel wrote:

You are my hero! :)

On 28 September 2019, Gill wrote:

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

<a href="" title=""> <b> <blockquote cite=""> <code> <em> <i> <q cite=""> <strike> <strong>