Beat the Delays: installing R and the BH package on a memory stick

I use R on a range of Windows machines. Often, I’ll only use these once, and they won’t already have R. So I want to carry an installation with me. So I decided to install R on a memory stick. Installing R itself worked, once I’d changed the folder on the “Select Destination Location” pop-up. But when I then tried installing the Tidyverse package, it seemed to hang. This is just a note for others facing the same problem, which in my case was caused by the BH package.

I tried installing Tidyverse packages one by one, and found that the hang was probably caused by BH. Some Googling led me to “mondano”‘s question https://stackoverflow.com/questions/31272280/installation-of-r-package-bh-not-possible. To which Dirk Eddelbuettel replied that “BH, as a sizeable subset of Boost Headers is big, as in really big”. It’s 111 megabytes, and mondano might simply have run out of patience if Windows was slow writing the files.

So I tried installing BH on its own, and using the Windows file explorer to watch the files. Indeed, I could see a temporary copy of BH slowly taking shape in a subdirectory of R-3.4.2/library called file1afc7c1c1629, with files slowly appearing under its subdirectories. Presumably, once the temporary copy had been made, R would copy it upwards to library where the other packages lived.

But after far too many minutes — memory sticks must be really slow — when the temporary copy was complete, it never did get copied upwards. Instead, I got the error Warning: unable to move temporary installation.

It would be nice to have been told the reason for the failure, but R is not that clever. There was enough space on the stick, so that wasn’t the problem. Time to Google once more. In https://stackoverflow.com/questions/5700505/windows-7-update-packages-problem-unable-to-move-temporary-installation, Tal Galili had the same error with the MASS package. The consensus reply was that this is probably an antivirus program locking a file.

So I installed R, and the Tidyverse, on my hard drive, which always works. I then copied its version of the final BH install to R-3.4.2/library. And the memory-stick Tidyverse then worked beautifully.

Leave a Reply

Your email address will not be published. Required fields are marked *