readRDS(file) in R - r

Whenever I try to install a package in R, I get the following error:
Error in readRDS(file) : unknown input format
This just started occurring after I had a system crash. I am running 32 bit R 2.13.0 under windows 7. I tried removing and re-installing R, but continue to get the error. Is there any way I can fix this without deleting everything (i.e. all the packages I've installed) and starting over?
Thanks

These are suggestions I have come across:
Delete your .Rhistory and .RData files in the directory in which you are running R.
Run update.packages()
Try and detect "bad files" in your library directories. You can do this in R
# List the library paths
# The issue is likely to be in the first directory
paths = .libPaths()
## Try and detect bad files
list.files(paths,
pattern = "^00LOCK*|*\\.rds$|*\\.RDS$",
full.names = TRUE)
## List files of size 0
l = list.files(paths, full.names = TRUE)
l[sapply(l, file.size) == 0]
Delete any files/directories highlighted. You could use file.remove() if you really wanted to.
Delete the directory in which you have stored your downloaded packages.
Only solution 3 worked for me.
Ref:
R-sig-Debian mailing list
Option 3 was a combination of answers provided by different people over the last few years, including Chunxiao Xu, Larry Hunsicker and Frank Harrell

Run find /usr/local/lib/R/site-library/ /usr/lib/R/library/ /usr/lib/R/site-library/ ~/.local/lib/ -iname '*rds' -a -size 0 and then delete the files found.

Chunxiao Xu and Rando Hinn's solution above worked for me, with a minor tweak.
First, change directories to your personal R package directory, then run: find -iname '*rds' -a -size 0
Delete the directories containing any 0 length files in the above list. Then reopen R (or RStudio) and reinstall the deleted packages.
You should now be able to list the packages again.
Chunxiao Xu's original suggestion above lists ALL of the R package directories. But the exact locations of these directories will vary from installation to installation, and their addresses will have to be edited for your installation.
Larry Hunsicker

Something simple to try: if it is an .rda file use load instead of readRDS. You can then save the loaded file as an .rds and try readRDS again.

Here is what I had to do to solve this error:
Open your Rstudio, go to install tab under packages
Note your install to library path.(where your package will be saved)
Go to the install library path.And hard delete the recent packages
Refresh you package details in Rstudio

This happened to me after I had to reboot my machine in the middle of installing several R packages. I removed the latest installed packages by physically removing the files in the appropriate library directory, reinstalled them, and all was well. I also had to remove a 00LOCK directory in the library directory.

You might have some problem with R packages .
See if the problem has occurred after you installed some packed or did you copied the packages.
What you can do is Copy all the packages from Library and save it somewhere, then Copy some packages on the Library and restart the R test it and see how it works you have to try with all the packages one by one .
I has the same issue and it was due to package problem.

I also had several problems opening an .RDS file, either "error reading from connection" or "unknown input format". I tried with several R versions, with version 3.4.2. the following worked:
(I accidentally uninstalled rstudio and installed it again, also installed older R version 3.4.2, I don't know if that changes anything)
set up a new working directory
I opened the RDS file directly instead of downloading it (so only saved to temp files), then I was able to open it in R
I moved it from temp files to my new working directory and used the Data_Essay_Account <- readRDS("C:/.../newdirectory/Data_Essay_Account.RDS") command and it worked.
Somehow properly downloading it and then moving it did not work, only after I had it in the temp files. Hard deleting packages did not work for me as I tried that initially.

Unlike the top few answers here, my issue was resolved not by doing anything with my installation of RStudio or cleaning local files, but by re-writing the RDS file.
I could confirm this because the file was stored in the cloud, and reading it from a variety of windows and mac laptops all failed, but similar RDS files from the same S3 bucket worked without a problem.
When I re-wrote the RDS file, the problem went away.

I checked for this issue on several forums and then I tried this and it worked for me:
1) Remove the ggplot2 package first
remove.packages("ggplot2")
2) Then Install the package again
install.packages("ggplot2")
3) restart rstudio and install your package again, hope this helps
Seems that the issue was with the required package (ggplot2 in my case) got corrupt and was hampering the installation of any new dependent package.

I had the same problem as the OP, but in my case the problem .rds files were not 0 bytes but had file size >0 and were full of NULL characters (at least that's what I saw when I opened them in Notepad++)
By using debugonce(loadNamespace) before loading the library that was giving me the error (in my example it was the VIM package) I eventually traced my problem to corrupted .rds files in the META folder of the forcats package, which was installed as a 5th generation import when I installed VIM
(In the rstudio environment pane)
__NamesSpacesLoading__ chr[1:5] "forcats" "haven" "rio" "car" "VIM"
I then fixed by VIM problem simply by removing and reinstalling forcats
Adapting the code in #csgillespie accepted answer, I could have found this by trying to read all the rds files as below
paths = .libPaths()
l <- list.files(paths,
pattern = "*\\.rds$",
ignore.case = T,
recursive = T,
full.names = TRUE)
checkRDS <- function(file) {
tryCatch({
readRDS(file)
"OK"
},
error = function(cond) {
return("Error")
})
}
l[sapply(l,checkRDS)=="Error"]

I was able to fix it by using .libPaths() and finding the 4.1 folder (my version of R was 4.1, so may differ). From there I closed R studio and deleted all the folders for each package.
I reinstalled all packages and found the packages which wouldn't download through the error messages. When I located the packages that didn't download I installed them by using: install.packages("package", type = "binary").
A bit long but solved all my issues.

My mirror was misconfigured. My mirror is Oregon State University because that is what I am closest too. Here is a list of mirrors. Call this code before installing any packages. More information in ?options.
mirror <- "https://ftp.osuosl.org/pub/cran/"
local({
r <- getOption("repos")
r["CRAN"] <- mirror
options(repos = r)
})

The workaround
Execute this command in the R console:
options(pkgType = "source")
You're good to go.

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)

unzip() fails using install_github

A number of people in my team are having issues installing packages from Github using install_github on Windows 7 Enterprise. However, I do not have these issues on the same build. For example, when trying to install readr, they see the following:
> devtools::install_github("hadley/readr")
Using GitHub PAT from envvar GITHUB_PAT
Downloading GitHub repo hadley/readr#master
from URL https://api.github.com/repos/hadley/readr/zipball/master
Error in utils::unzip(src, exdir = target) :
cannot open file 'C:/Users/XXXXX/AppData/Local/Temp/RtmpYVS4zi/devtools23d42e596b7c/tidyverse-readr-b8c3ddb/R/POSIXct.R': No such file or directory
They have write access to the TMP folder into which these files are being extracted.
Interestingly enough when they download the zip directly from Github's website and try to extract into their user folder, they get the same behaviour from Winzip, but 7-zip can successfully unpack the file.
Does anyone know what might be causing this behaviour?
Try running
options(unzip = "internal")
before running devtools::install_github.
This has worked for me in the past, not sure why.

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

Install an R package temporarily, only for the current session

Sometimes on Stack Overflow, there's a question relative to a package which is not installed on my system, and which I don't plan to reuse later.
If I install the package with install.packages(), it will be put in one of my R install libraries, and then will take some storage space and be updated each time I run update.packages().
Is there a way to install a package only for the current R session ?
You can install a package temporarily with the following function :
tmp.install.packages <- function(pack, dependencies=TRUE, ...) {
path <- tempdir()
## Add 'path' to .libPaths, and be sure that it is not
## at the first position, otherwise any other package during
## this session would be installed into 'path'
firstpath <- .libPaths()[1]
.libPaths(c(firstpath, path))
install.packages(pack, dependencies=dependencies, lib=path, ...)
}
Which you can use simply this way :
tmp.install.packages("pkgname")
The package is installed in a temporary directory, and its files should be deleted at next system restart (at least on linux systems).
Another solution for this problem is devmode from devtools. Devmode allows you to install packages to a dev repository so your other packages are untouched if you install development versions. For example:
library(devtools)
devmode()
install_github('ggplot2', 'hadley')
devmode()
You'll notice that your version has not changed.
pacman deals with package management issues like this:
library(pacman)
Now you can use:
p_load("pkgname") #installs or loads package if already installed
#at end of session:
p_delete("pkgname") #deletes package from lib
This is a quick way to install in your directory and then delete it at the end (not really a temporary install)
As an addition to Tyler's answer a p_temp function was recently added to the pacman package which does exactly what the question asks for.
library(pacman)
p_temp(pkgname) # or p_temp("pkgname") either work...
This will install the package and any dependencies temporarily.
Disclosure: Tyler and I are co-authors of the pacman package...
The following is something in the middle between
juba
and
sebastian-c,
and is as simple as that:
.libPaths("/my/path")
Now and until the end of the current session,
you can install packages as you normally would, and they will end up in
/my/path.
Also package dependencies will go to /my/path.
If you want to have control over dependencies, you can specify them manually with:
install.packages(c("pack", "dep1", "dep2", ...), dependencies = FALSE)
This approach might be useful in two particular scenarios:
A so-to-say discovery session. You want to discover new packages and install them casually to see if something interesting pops up. Then, you use an OS provided tempdir in .libPaths(), to avoid messing your R setup, and the OS will take care of the cleaning.
Create, nowadays common, reproducible environments.
You install a base R, then add .libPaths("my/project/dir"). By looking at this dir, you have a clear picture of what are your project package requirements. Further, you can copy this folder to another PC to reproduce the same environment. Much like Python pipenv you can have more isolated environments: for each session, you call .libPaths() with the related project dir.

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