R (and Bioconductor) cant install packages "path not writable/access denied" - r

I am using R again after some time and need to install various packages (e.g. lumi, GENAVi, ideal, limma) and for some the installation works for some not. I receive failure notifications indicating that I the library paths are not writable or that access is denied.
installation of lumi with bioconductor fails
thus, lumi appears to be not existing
My PC uses windows 10, recently updated, and R 4.1.1
I tried the following steps (based on older forum entries):
I ran R Studio with administrator permissions
I gave R full permission through the firewall of my antivirus program
I gave R permission through the windows security settings
I reinstalled R on another harddrive (E:/) where it should have full permission for all paths.
I added a path in the xxx
I ran R inside a new environment in the “Conda” software, but the permission problems persisted.
(Outside of Conda) I installed the lumi package out of a zip file (instead of a Bioconductor download). Still didnt work...
So I now don’t know what to do anymore and barely find new ideas for solving the problem.
I appreciate your help

Related

Warning in install.packages: unable to move temporary installation

I've found a number of questions related to this warning when installing or updating packages in R/RStudio, but none seem to completely match my situation:
Corporate Windows 7 system, so no access to admin privileges
No way to make changes to McAfee Anti-Virus exceptions lists
R is fully installed in the user space C:\Users\[myname]\R
RStudio fully installed in userspace C\Users\[myname]\RStudio
no permission issues in either of the directories... I have full access control over them
Problem only started after installing R 3.4, but RStudio has randomly failing at start or hanging for a few months now
R_LIBS_USER added as user environment variable, pointing to right directory
.libPaths() show correct directories, both system and user
R version 3.4.2, RStudio version 1.0.153
Uninstalled both R and Rstudio and did a clean re-install of both
Tried trace(utils:::unpackPkgZip,edit = T) and edited Line 140 Sys.sleep(0.5) to Sys.sleep(2), which sometimes works temporarily but the edit won't stay put... resets to Sys.sleep(0.5) on every session restart
Happens in both RStudio and RGui
Any package larger than a few Kb gives the message:
package ‘packagename’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Users\[myname]\R\win-library\3.4\file2b884fc37c13\packagename’ to ‘C:\Users\[myname]\R\win-library\3.4\packagename’
The packages are failing to install or update. So, my questions are:
is there a way to avoid the problem altogether that doesn't require admin privileges or changes to the antivirus policies?
is there a way to get the edit to unpackPkgZip to save permanently?
At this point, I'm stumped. I suspect it has something to do with the antivirus temporarily locking the file/directory after download, but I can't do anything about it from that end. The Sys.sleep(2) seems to do the trick, but I can't keep doing that before every package install or update and can't seem to get the edit to stay put.
This was the only thing that worked for me on this issue (the uninstalling antivirus software didn't get me anywhere, unfortunately), so hopeful it works for you.
On Windows systems, sometimes installation of libraries may be running too fast, creating the error "unable to move temporary installation". Then the package is not found in the user library, because it hasn't been moved over...
To fix, try: trace(utils:::unpackPkgZip, edit=TRUE)
Then go to Line 140 in the code and change Sys.sleep(0.5) to Sys.sleep(2.5)
This is a nice longer term solution that does not require manual package moving, uninstalling software, replacing admin responsibilities, or individually routing packages to certain locations.
My original reply is below, but I've subsequently found a better solution.
Execute the following line:
Trace(utils:::unpackPkgZip, edit=TRUE)
Note that there three colons in there, not two.
Then edit line 142, from Sys.sleep(0.5) to: Sys.sleep(2.0), and click to save the edit (the line number may vary slightly). Unfortunately this does not hold across R sessions, but it only takes 10 seconds to do this, and then you can install packages for the current session to your heart's content.
Original answer:
I ran into the same problem at work. I was able to use Sheldon's suggested approach, but as noted that can get tedious quickly. As an alternative, I found I could go to the location of the downloaded zip file(s) in my temp directory (as reported by install.packages), unzip the file or files (there will be multiple zip files if there are dependent packages), and then move or copy all the unzipped directories straight into my R\win-library\3.4 directory. This isn't a whole lot of fun either, but I find it to be less painful than stepping through the debugger, per Sheldon's method, especially when multiple dependencies are involved and also have to be installed.
If you cannot turn off your antivirus here is a workaround that I found that doesn't involve editing the unpackPkgZip file. Debugging the unzip package function and then stepping through it gives the antivirus enough time to do its job without interfering. Use this command:
debug(utils:::unpackPkgZip)
install.packages("packageName")
and then step through the code (by pressing enter many times) when R starts debugging during the installation.
I found this solution here.
If you want to make this change more permanent you can add the debug code into your Rprofile file, see here, but you'll still need to use step through the unzip function each time a package is installed.
Got the same error - seems to be a company gp / access security problem.
It might also be worthwhile checking whether the folder it fails to write to has a Read Only structure (Right Click - Properties). This folder's address can be found by running: .libPaths()[1] in R.
An ad hoc solution to this problem is to unzip and store the downloaded (but not moved) packages using a piece of R code below. You will get an error stating where the binary packages are located (something like: C:/Users/....AppData/...)
Now you can simply unzip the files from here to your .libPaths() location
zipF <- list.files("C:/Users/<YOURNAMEHERE>/AppData/Local/Temp/Rtmp4Apz6Z/downloaded_packages", full.names = TRUE)
outDir <- .libPaths()[1]
for(i in 1: length(zipF)) {
unzip(zipF[i],exdir=outDir)
}
A more general solution will still be extremely worthwhile, as this is unfortunately a common problem when updating R on Windows.
We've had the same problem at my workplace, and one of my coworkers discovered a great workaround. Unfortunately it's a temporary thing you'll need to do each time you install packages, rather than a permanent fix. We're running corporate Windows 8 (no admin privileges) with McAfee, and I've tested this in R 3.4.0-3.4.3.
Temporarily turning off McAfee's "On-Access Scan" feature (in Threat Prevention) solved this for us -- R packages now all install on the first try the way they're intended to. Here's detailed steps to turn that off:
Right-click the McAfee icon in the notification area at the right of
your taskbar, and select McAfee Endpoint Security.
Click on Threat Prevention. This opens up a screen where you should see categories such as "Access Protection", "Exploit Prevention", and "On-Access Scan".
Un-check "Enable On-Access Scan", and then click Apply. (NB: it's
easy to forget to click Apply, but it's essential)
Once you've installed your packages, it's best to repeat the process to turn On-Access Scan back on.
I fixed my instance of this problem (Windows 7) by removing the 'Read-Only' attribute of the folder R was trying to move stuff to.
I went to the Run command from the Start menu in Windows (7) and typed
attrib -r +s drive:\\
Note that just right clicking the folder and trying to change properties didn't take, as per this link from Microsoft: https://support.microsoft.com/en-us/help/326549/you-cannot-view-or-change-the-read-only-or-the-system-attributes-of-fo
Hope that helps someone.
I hope this change doesn't screw me in other ways.
This was the error message that was spit out for me:
package ‘mlogit’ successfully unpacked and MD5 sums checked
Warning in install.packages :
unable to move temporary installation ‘C:\Users\E\Documents\R\win-
library\3.4\file9ec6cfb5e40\mlogit’ to ‘C:\Users\E\Documents\R\win-
library\3.4\mlogit’
The downloaded binary packages are in
C:\Users\E\AppData\Local\Temp\RtmpS0uNDm\downloaded_packages
What I did was went to where the package was downloaded (C:\Users\E\AppData\Local\Temp\RtmpS0uNDm\downloaded_packages) and then copied that zipped file to the desktop then used Winzip to unzip to my file directory where all the packages for R are stored (C:\Users\E\Documents\R\win-library\3.4). It now will load in R.
library("mlogit")
Loading required package: Formula
Loading required package: maxLik
Loading required package: miscTools
....
It worked well for me as it was the only package that was not downloading for some reason. Might not be helpful if you have to do this for every package.
I also found one solution if above solutions wouldn't work in corporate antivirus.
First change the path of package installation use this command and execute in R:
install.packages('caTools','D:\\ML\\Tools\\Installed\\RPackages')
Now it will show a console's error that unable to move and the package is placed on to some location. just remember this location, we need this zip file for further operations.
Now use this command:
install.packages("D:/ML/Tools/Installed/RPackages/caTools_1.17.1.zip", repos = NULL, type = "win.binary", lib="D:/ML/Tools/Installed/R-3.4.3/library")
I struggled with the same issue. For me (on Windows 10), the issue was using MalwareBytes (Premium trial). I uninstalled it and went back to using Windows Defender, and the issue was resolved. Perhaps if more time, I can find out how to create an exception and/or file checking delay for MalwareBytes (i.e., which is a pretty good program), but the user-guide (https://www.malwarebytes.com/pdf/guides/Malwarebytes-User-Guide.pdf) is unclear on this.
Extending the Sys.sleep value to 3.5 on line 142 in the unpackPkgZip function works manually via
trace(utils:::unpackPkgZip, edit=TRUE)
However, it can also be done programmatically by running the following before install.packages:
localUnpackPkgZip <- utils:::unpackPkgZip
body(localUnpackPkgZip)[[14]][[4]][[4]][[4]][[3]][[3]][[2]][[2]] <- substitute(3.5)
assignInNamespace("unpackPkgZip", localUnpackPkgZip, "utils")
This must be run every time you have a new session. You can run it multiple times in the same session without issue.
If you run the below statement right before the install.packages expression then it should install the package:
trace("unpackPkgZip", where=asNamespace("utils"), quote(Sys.sleep(2.5)), at=14L, print=FALSE)

Installing package - cannot open file - permission denied

I'm working in RStudio and am attempting to install the dplyr package. I have installed various other packages without problem but have hit a problem with this.
It seems there are various parts to the install, some of these worked but the problem happens when I get 'the dependency BH'. This is the error:
>Installing package into ‘\\xxxxxxxx.local/Desktops/jagnew/My Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
also installing the dependency ‘BH’
>trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/BH_1.62.0-1.zip'
Content type 'application/zip' length 16150075 bytes (15.4 MB)
downloaded 15.4 MB
>trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/dplyr_0.5.0.zip'
Content type 'application/zip' length 2556205 bytes (2.4 MB)
downloaded 2.4 MB
>Error in install.packages : cannot open file '\\xxxxxxx.local/Desktops/jagnew/My Documents/R/win-library/3.3/file142032c9327b/BH/include/boost/function/detail/gen_maybe_include.pl': Permission denied
I have changed the directory/libpath as it did not appear that the file was downloading to the correct folder. file142032c9327b is now in the correct path, but path specified in the error is only correct up to /boost, there is no function folder here..?
I'm not sure if this missing folder is the issue, as the error says 'Permission denied', but it seems odd.
I had the same issue. Tried doing the following and worked for me:
Run the RStudio as administrator
Under the Packages tab, click Install and change Install to Library option to C:/Program...../R/../library and select the desired package to install.
Hope it works.
I had the same problem. R gave me an error message whenever I tried to install a new, or update an existing package. I don't remember what the message said exactly, but it was saying "Cannot open file (...) access denied". I tried all the following. Not sure what exactly fixed the problem, but now I can update and/or install new packages:
Open R/RStudio as administrator;
Change the R library folder (where packages are installed) security settings, and grant full access to my computer user account. Link1, link2;
(I think this was what fixed the problem) Follow instructions on this link. It prompted me to install another package, "devtools". Then it worked.
Well, I think my problem was a special case, but it might benefit someone. I had the Windows Defender Ransomware Protection set to ON. That was blocking rsession.exe by default. Allowing rsession.exe solved the problem.
TL;DR
The "Documents" (or "My Documents") directory is a special location in Windows. I don't know if the system itself processes its permissions differently or if antiviruses target operations inside this directory more strictly, but many R users have issues installing packages in the personal library inside this folder (even if running R as administrator). Other answers haven't worked.
For me, what solved the problem was to put the personal library directly under X:\\Users\username\ instead of under Documents, which is the R default on Windows. To make it permanent, I set a user environment variable R_USER to %USERPROFILE%. Here is a nice guide of how to set environment variables in Windows.
Note: after this change, you may need to move your .Rprofile, .Renviron, etc. files from Documents to the user profile directory.
Details
The default location for R's user "home" directory on Windows is X:\\Users\username\Documents. This is because there is no concept of HOME in Windows, just of a "personal" directory (Documents): https://cran.r-project.org/bin/windows/base/rw-FAQ.html#What-are-HOME-and-working-directories_003f
Therefore, by default, the personal library location is under X:\\Users\username\Documents\R\win-library\X.Y\. You can get the exact location on your machine with this command in the R console:
Sys.getenv('R_LIBS_USER')
I was getting this same cannot open file error when trying to install or update packages, even when running as administrator. I suspected of directory permissions, checked it within the directories' "properties" without luck. Removed the whole R\win-library tree and recreated it and nothing... Finally, I tried to move the personal library location to my users' directory:
.libPaths('X://Users/username/R/win-library/X.Y/')
And it worked!
Warning in install.packages :
cannot create file '/usr/local/Cellar/r/3.6.2/lib/R/doc/html/packages.html', reason 'Permission denied'
Warning in install.packages :
cannot update HTML package index
I had the same permission issue when trying to download a pkg--ISLR. Fixed it after following the above answers.
In case, some are new to R studio like me. These were my steps to install a pkg.
Click Terminal next to Console in R studio
Type sudo r, to run r as an administrator
install.packages("ISLR") to install your package
--- Please select a CRAN mirror for use in this session ---
https://cran.rstudio.com/src/contrib/ISLR_1.2.tar.gz
Secure CRAN mirrors
1: 0-Cloud [https] 2: Australia (Canberra) [https]
3: Australia (Melbourne 1) [https] 4: Australia (Melbourne 2) [https]
Pick a number -- a mirror site, then click enter.
Voilà! Package installed.
I had faced also this issue. The one and only solution that helped me was to turn off my firewall. Then I was able to download all packages.
The problem solved for me after running R in admin mode and disabling Antivirus.
Translating #Shubham Yadav's answer to code mode would be something like this: install.packages("your_package", lib = "C:/Program Files/R/R-4.0.3/library")
It's working for me (running RStudio as admin, course).
This procedure worked for me.
Removed existing package with remove.packages()
ran RStudio as an admin
Installed by specifying the libpath: devtools::install_github('https://github.com/Rdatatable/data.table/tree/frollmax', lib=.libPaths()[2])
For me what worked was manually deleting within the library directory the folder that I had problem with updating. And then install.package() again.
I had faced the same issue.
I tried below steps to resolve this issue:
Launch RGui application.
Go to Packages section and select Install Packages.
Select the Package that you want to install from the Packages pop up window.
And click OK, that's it package will get successfully installed.
After following above steps, you can run use your package from RStudio.
I ran into this issue today where rlang couldn't install the newest version and so tidyverse wouldn't work. I tried running as admin, changing install location, running as admin, permitting rstudio through Windows Defender Randsomware Protection, and installing DevTools. The only thing that worked was to uninstall RStudio, reboot, reinstall.

Error while installing VIM package in R-2.15.3 [duplicate]

I am using R 2.13.0 with windows 7, after giving my user full privileges to the R folder (as described here).
This allows me to install new packages just fine.
However, when using update.packages(), to update existing packages, I keep getting the following error (for example, when updating the MASS package):
package 'MASS' successfully unpacked and MD5 sums checked
Warning: unable to move temporary installation
'C:\Program
Files\R\R-2.13.0\library\file6cae3bcf\MASS'
to 'C:\Program
Files\R\R-2.13.0\library\MASS'
Any suggestions on how to fix this?
p.s: Running R as an administrator or shifting the library location out of Program Files is not a solution (it's a hack - but I am looking for a solution)
I found that the problem indeed is the antivirus "real time file system protection". I do the following to fix the problem:
trace(utils:::unpackPkgZip, edit=TRUE)
I edit line 140 (line 142 in R 3.4.4):
Sys.sleep(0.5)
to:
Sys.sleep(2)
I seems like the antivirus stalls the creation of the package tmp dir. After changing it to 2 seconds the error is gone.
EDIT: to do this programmatically execute
trace(utils:::unpackPkgZip, quote(Sys.sleep(2)), at = which(grepl("Sys.sleep", body(utils:::unpackPkgZip), fixed = TRUE)))
(credits #DavidArenburg)
Just to update everyone, I (think that I) found out the source of the problem: antivirus.
The "real time file system protection" was blocking R from copying the files between folders once they were downloaded.
Upon adding the R directory to the exception list (coupled with adding user permission and installing R on D:\R), and the problem went away. With all of this work, I might as well switch to Linux (I should, really...)
(I updated my post with the above information: http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/)
I hope it will help someone in the future,
Tal
If you cannot turn off your antivirus, due to corporate policy for example, here is a workaround that I found. Debugging the unzip package function and then stepping through it gives the antivirus enough time to do its job without interfering. Use this command:
debug(utils:::unpackPkgZip)
install.packages("packageName")
and then step through the code (by pressing enter many times) when R starts debugging during the installation.
I found this solution here.
If you can just download the binary straight from CRAN. On windows when downloaded it will be a zip file. Now manually unzip this into the ..library/ folder of your R (.libPaths()). It worked for me on some packages.
I had this problem installing both swirl and dplyr. I am working on Windows 64-bit.
Warning: unable to move temporary installation
What I did is I accessed my temporary files on the C: drive, and opened my file extractor program and I extracted the files from the temp file in the C: drive to my R program files in the C: drive, by manually copying them. THIS WORKED FOR BOTH dpylr and swirl. Stoked!
Cheers,
Peach
Can you not use the lib.loc parameter to only update packages in your personal library (in user)?
There should be no way to enable a normal, non-augmented user to change files in the program files folder, so the only thing you can do (if you don't want to augment the user) is to have R not updating packages there.
A workaround is to avoid installing R in the program files folder (which may be more or less of a hack than just shifting the library location out of it, depending on your point of view).
Finally, if lib.loc doesn't cut it, you can look at the source code for update.packages and create your own customized version that will always avoid the common library location in program files.
I just met the same question, and the solution I found out was that you should install packages using the original R software (plus, you should choose the right mirror site, some of them are blocked). At first I used Rstudio to install packages and I got the same problem as you met. Hope this is helpful.
I have run into this error several times. In my own case, it is because our admins want us to use remote virtual disks (on Windows 7) for our files and everything is locked up tight as a drum. The only way I can use R packages is in a lib directory on that remote virtual disk. This wouldn't be a problem except that the network isn't always smooth and fast. Thus, when I need a package, especially one with several other packages in tow (e.g., MBESS), I either have to go through the get.packages() process multiple times until it finally finishes or make it IT's headache to do quick like the bunny for me. I can't always wait for IT.
I just went to the library folder (Windows XP) and deleted all fileXXXX folders. Reran the install an it is worked.
I had the same problem. Since the issue seems to be the antivirus blocking the transf of a downloaded file, I tried a different download method in the install.packages and it worked.
For example:
install.packages("stringr", method = "curl")
You must go into the properties of the R folder and change the security parameters. You can enable the option to write and modify for all users.
The error : "unable to move temporary installation" is basically arising due to any of the antivirus running on your system.
Try unzipping the downloaded file from the Temp folder into the default library path (you can get it by running .libPaths() in R session).
I'm using a MRAN and I was having so many versioning issues. Trying to work with tidyverse and ggplot2 and by upgrading to the latest version from Microsoft it solved all of my R-Studio versioning issues.
Version info:
Microsoft R Open 3.5.1
The enhanced R distribution from Microsoft
Default CRAN mirror snapshot taken on 2018-08-01.
Download Microsoft R Open 3.5.1

How do I get Rtools 3.0 working for R 3.0? R can't find the installation

I'm trying to get R to recognize that I have installed Rtools.exe. I've tried installing it in several different locations. However, whenever I restart R and load devtools I get the same error:
> library(devtools)
WARNING: Rtools is required to build R packages, but is not currently installed.
Please download and install Rtools 3.0 from http://cran.r-project.org/bin/windows
/Rtools/ and then run find_rtools().
Naturally, whenever I try the function find_rtools() I get the same error message. I'm done trying to figure this out with help files, as the devtools help doesn't offer much. I've tried installing in several of the locations returned by get_path() but the problem persists.
FYI, currently my R is installed at D:/R.
Has anyone else had this problem, and more importantly, can anyone help me?
I'm sorry if this is a duplicate, and I've tried to include as many relevant details as possible so if you need any clarification please let me know.
Thanks,
Nick
Grab the batch file Rpathset.bat from batchfiles, edit the SET statements in it appropriately and then run R like this from the Windows console:
Rpathset
Rgui
I ran into this issue running a Windows 7 machine without admin rights. I leveraged G. Grothendieck's response, with a few additional steps.
Get Rpathset.bat from https://code.google.com/p/batchfiles/
Edit the Set statements in Rpathset.bat to your paths
Run CMD and change directories to where Rpathset.bat is stored
In the command prompt, run rpathset.bat > mypath.txt
Open mypath.txt with a text editor
Click Windows Start and search for environment
Click Edit environment variables for your account
Click path and then edit
Copy and paste the entire path from mypath.txt into the Windows path (everything after the path statement)
Restart RStudio and check that devtools::find_rtools() is TRUE
This file rtools.r contains the code for find_rtools(). It looks like it is trying to find ls and gcc in your system path (and then does some more checks based on the version) and if that fails it tries to look up SOFTWARE\R-core\Rtools in the the Windows registry.
As Thomas mentioned here, "Rtools is not a package." This is what I did to install Rtools. My RStudio is running R version 3.1.3. So I downloaded Rtools31.exe from https://cran.r-project.org/bin/windows/Rtools/. I executed the exe file, selected all the default options in the Setup Wizard and installed. (I had admin privilege on the computer I was using but I am not sure if that makes any difference.) To check that it was properly installed, you can enter find_rtools() in the R prompt which should return TRUE if Rtools installed properly.
For R 3.0, you probably just need to download Rtools30.exe and follow the same steps above.
I ran into this problem trying to install Rtools33 to use Hadley Wickham's lineprof package. I got that error multiple times. I'm running Windows 7 on a laptop.
I was able to fix the problem by running the Rtools installation file as the windows Admin (i.e. right-click the Rtools33.exe and choose "Run as administrator")
I also made sure to point the path to the R source directory, which I kept in C:\Rtools\ (which contains C:\Rtools\bin\ and C:\Rtools\gcc-4.6.3\).
This solved the problem for me and I am now able to install lineprof from GitHub and make use of it.

Windows 7, update.packages problem: "unable to move temporary installation"?

I am using R 2.13.0 with windows 7, after giving my user full privileges to the R folder (as described here).
This allows me to install new packages just fine.
However, when using update.packages(), to update existing packages, I keep getting the following error (for example, when updating the MASS package):
package 'MASS' successfully unpacked and MD5 sums checked
Warning: unable to move temporary installation
'C:\Program
Files\R\R-2.13.0\library\file6cae3bcf\MASS'
to 'C:\Program
Files\R\R-2.13.0\library\MASS'
Any suggestions on how to fix this?
p.s: Running R as an administrator or shifting the library location out of Program Files is not a solution (it's a hack - but I am looking for a solution)
I found that the problem indeed is the antivirus "real time file system protection". I do the following to fix the problem:
trace(utils:::unpackPkgZip, edit=TRUE)
I edit line 140 (line 142 in R 3.4.4):
Sys.sleep(0.5)
to:
Sys.sleep(2)
I seems like the antivirus stalls the creation of the package tmp dir. After changing it to 2 seconds the error is gone.
EDIT: to do this programmatically execute
trace(utils:::unpackPkgZip, quote(Sys.sleep(2)), at = which(grepl("Sys.sleep", body(utils:::unpackPkgZip), fixed = TRUE)))
(credits #DavidArenburg)
Just to update everyone, I (think that I) found out the source of the problem: antivirus.
The "real time file system protection" was blocking R from copying the files between folders once they were downloaded.
Upon adding the R directory to the exception list (coupled with adding user permission and installing R on D:\R), and the problem went away. With all of this work, I might as well switch to Linux (I should, really...)
(I updated my post with the above information: http://www.r-statistics.com/2011/04/how-to-upgrade-r-on-windows-7/)
I hope it will help someone in the future,
Tal
If you cannot turn off your antivirus, due to corporate policy for example, here is a workaround that I found. Debugging the unzip package function and then stepping through it gives the antivirus enough time to do its job without interfering. Use this command:
debug(utils:::unpackPkgZip)
install.packages("packageName")
and then step through the code (by pressing enter many times) when R starts debugging during the installation.
I found this solution here.
If you can just download the binary straight from CRAN. On windows when downloaded it will be a zip file. Now manually unzip this into the ..library/ folder of your R (.libPaths()). It worked for me on some packages.
I had this problem installing both swirl and dplyr. I am working on Windows 64-bit.
Warning: unable to move temporary installation
What I did is I accessed my temporary files on the C: drive, and opened my file extractor program and I extracted the files from the temp file in the C: drive to my R program files in the C: drive, by manually copying them. THIS WORKED FOR BOTH dpylr and swirl. Stoked!
Cheers,
Peach
Can you not use the lib.loc parameter to only update packages in your personal library (in user)?
There should be no way to enable a normal, non-augmented user to change files in the program files folder, so the only thing you can do (if you don't want to augment the user) is to have R not updating packages there.
A workaround is to avoid installing R in the program files folder (which may be more or less of a hack than just shifting the library location out of it, depending on your point of view).
Finally, if lib.loc doesn't cut it, you can look at the source code for update.packages and create your own customized version that will always avoid the common library location in program files.
I just met the same question, and the solution I found out was that you should install packages using the original R software (plus, you should choose the right mirror site, some of them are blocked). At first I used Rstudio to install packages and I got the same problem as you met. Hope this is helpful.
I have run into this error several times. In my own case, it is because our admins want us to use remote virtual disks (on Windows 7) for our files and everything is locked up tight as a drum. The only way I can use R packages is in a lib directory on that remote virtual disk. This wouldn't be a problem except that the network isn't always smooth and fast. Thus, when I need a package, especially one with several other packages in tow (e.g., MBESS), I either have to go through the get.packages() process multiple times until it finally finishes or make it IT's headache to do quick like the bunny for me. I can't always wait for IT.
I just went to the library folder (Windows XP) and deleted all fileXXXX folders. Reran the install an it is worked.
I had the same problem. Since the issue seems to be the antivirus blocking the transf of a downloaded file, I tried a different download method in the install.packages and it worked.
For example:
install.packages("stringr", method = "curl")
You must go into the properties of the R folder and change the security parameters. You can enable the option to write and modify for all users.
The error : "unable to move temporary installation" is basically arising due to any of the antivirus running on your system.
Try unzipping the downloaded file from the Temp folder into the default library path (you can get it by running .libPaths() in R session).
I'm using a MRAN and I was having so many versioning issues. Trying to work with tidyverse and ggplot2 and by upgrading to the latest version from Microsoft it solved all of my R-Studio versioning issues.
Version info:
Microsoft R Open 3.5.1
The enhanced R distribution from Microsoft
Default CRAN mirror snapshot taken on 2018-08-01.
Download Microsoft R Open 3.5.1

Resources