Skip to content

Resolving ‘Unable to move temporary installation’ in R

G29th November 2017

C21 Comments


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



21 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!

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.