# Resolving ‘Unable to move temporary installation’ in R

G29th November 2017

TR

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

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

• Written by Ke on 31 January 2018:

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.

• Written by Rahul on 2 February 2018:

Thanks. This worked perfectly.

• Written by Lake on 15 February 2018:

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

• Written by James on 16 February 2018:

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

• Written by Sean on 2 March 2018:

Works great! Thanks a lot!!!

• Written by M L on 5 March 2018:

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.

• Written by Chris on 8 March 2018:

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

• Written by wool on 14 March 2018:

You are the king!

• Written by Gitaish Gulati on 20 March 2018:

Works perfectly for me!!

• Written by Harco on 20 March 2018:

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.

• Written by Adam Dimech on 21 March 2018:

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

• Written by FREZOULS F on 22 March 2018:

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

• Written by B on 24 March 2018:

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

• Written by Anne on 30 March 2018:

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

• Written by L B on 30 March 2018:

Yep, didn’t work for me either.

• Written by drstukatl on 4 April 2018:

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

• Written by BRIAN MERRILL on 17 April 2018:

Worked perfect!

• Written by Alex Yerukhimov on 22 April 2018:

Worked perfectly! thank you very much!

• Written by Danny on 23 April 2018:

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

• Written by Fanuel Shem on 7 June 2018:

Thanks a lot. You are a star!

• Written by Claudia Pelizaro on 16 July 2018:

Thank you so much!

• Written by Ashrith on 2 August 2018:

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

• Written by M Henni on 9 August 2018:

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

• Written by Saptarshi on 8 September 2018:

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

• Written by Adam Dimech on 22 October 2018:

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

• Written by Espoir on 10 October 2018:

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?

• Written by Espoir on 10 October 2018:

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

• Written by Akshay on 19 December 2018:

Thanks a lot. It worked for me.

• Written by CESAR GIL on 9 May 2019:

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.

• Written by Michael H on 11 May 2019:

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

• Written by Emanuel on 13 August 2019:

You are my hero! :)

﻿