I am very 'green' and using Windows 10, R version 3.3.1, R-Studio verion 0.99.491.
When I try to install the dplyr package, I keep getting these errors:
package ‘Rcpp’ successfully unpacked and MD5 sums checked Warning in install.packages :
unable to move temporary installation ‘C:Program FilesRR-3.3.1libraryfile548c25005671Rcpp’ to ‘C:Program FilesRR-3.3.1libraryRcpp’
package ‘BH’ successfully unpacked and MD5 sums checkedWarning in install.packages :
unable to move temporary installation ‘C:Program FilesRR-3.3.1libraryfile548c7b673dabBH’ to ‘C:Program FilesRR-3.3.1libraryBH’
I tried to run dplyr, but logically I get the error:
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
I hope this is the right place for my question. Any clues??
Thanking you in advance!!
I'd recommend restarting in a clean R session and trying to install again.
This error:
Warning in install.packages :
unable to move temporary installation ‘C:\Program Files\R\R-3.3.1\library\file548c25005671\Rcpp’ to ‘C:\Program Files\R\R-3.3.1\library\Rcpp’
usually occurs on Windows when attempting to install a package that is already loaded or attached. To confirm, you can check what packages are currently loaded with:
loadedNamespaces()
The easiest resolution would be to reinstall both Rcpp and dplyr in a clean R session, with e.g.
install.packages("Rcpp")
install.packages("dplyr")
I closed R-Studio, opened R Console, installed dplyr twice, first time the same problem with both Rcpp and BH. Third time, BH was installed!
Unfortunately Rcpp gives the same error. Tried to install it seperately (install.packages("Rcpp"), got the same error.
Hope you have an idea to solve it?
Kevin, saw your post too late, but thanx (and Hadley too of course!).
The packages were not loaded.
In a new R session (R Console) installed Rcpp twice. First from mirror USA (WA), next from mirror UK (Bristol). Got the same errors.
Ah, perhaps the issue is that R is attempting to install packages into the system R library (where you might not have write permissions). You probably want to force R to use a user library.
Try running this command in an R session:
dir.create("~/R/win-library/3.3", recursive = TRUE)
Then, in a clean R session, check the output of:
.libPaths()
You should see two paths; with the first one being the path we created in the first step. After that, you should be able to successfully install Rcpp and dplyr.
I did:
.libPaths()
[1] "C:/Users/Marlein/Documents/R/win-library/3.3"
[2] "C:/Program Files/R/R-3.3.1/library"
So the paths are correct, but got this error after trying to install Rcpp.
package ‘Rcpp’ successfully unpacked and MD5 sums checked
Warning: unable to move temporary installation ‘C:UsersMarleinDocumentsRwin-library3.3file259827fa4933Rcpp’ to ‘C:UsersMarleinDocumentsRwin-library3.3Rcpp’
Just a random guess. This kind of error can also be caused by antivirus software on Windows.
The only other thing I could think of would be manually removing the directory at:
C:\Users\Marlein\Documents\R\win-library\3.3\Rcpp
and trying again; alternatively, @thirdwing could be correct (maybe an antivirus scanner is acquiring a lock on these files that disallows the R process from moving them to the library folder after download?)
Shut McAfee down and that solved the problem!
Everyone, thanks a lot for helping me!!
For others who may find this, I had the same issue, and recursively removing a read-only property from the library directory fixed it for me.
In addition to the above, I found I still had issues writing to the library so I had to tell R Studio where I wanted the library. This meant changing the environment. Eric Krantz has provided some great instructions on how to do this in the R Community forum:
See the post here: [(https://support.rstudio.com/hc/en-us/community/posts/200698036-Changing-Default-packages-instalation-directory-in-R-studio)]
How to edit R_LIBS_USER to change where your package library resides:
Let's assume you want your packages to reside in C:RLibrary:
_Note: I did have to create the R_LIBS_USER entry and point it to the where the library files were on my computer. As soon as I started R Studio and ran the library() command, it recognised my new environment setting._
All I had to do then was make sure all the necessary packages were installed there. I couldn't install them by using the install command in R Studio as I couldn't get around the write lock on the directory, but I could unpack the zip files there manually.
To do this I just attempted to assign the packages I wanted to use using the library(package) command (e.g. library(dplyr)) and it would tell me which packages were missing.
e.g. Error: package or namespace load failed for ‘dplyr’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘rlang’ <--this is the part that tells you what package is missing.
I then went to the temporary directory location provided by the message, found the zip file and unpacked it to my library directory.
Eventually I got them all.
It's a round-about way but it seems to have worked.
I had a some-what similar problem:
Everytime I started R Studio, the following message appeared:
Error: package or namespace load failed for ‘lme4’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘Rcpp’
Error in .requirePackage(package) :
unable to find required package ‘lme4’
I tried many things, including loading the "dplyr" package, and I got this message:
Error: package or namespace load failed for ‘dplyr’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘Rcpp’
After reading this post, I tried installing the "Rcpp" package, and it worked:
Installing package into ‘C:/Users/Owner/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://mran.microsoft.com/snapshot/2018-01-01/bin/windows/contrib/3.4/Rcpp_0.12.14.zip'
Content type 'application/zip' length 4358936 bytes (4.2 MB)
downloaded 4.2 MBpackage ‘Rcpp’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:UsersOwnerAppDataLocalTempRtmpA1EPaxdownloaded_packages
Then when I tried loading the "dplyr" package, I got the following message:
library(dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lagThe following objects are masked from ‘package:base’:
intersect, setdiff, setequal, unionWarning message:
Installed Rcpp (0.12.14) different from Rcpp used to build dplyr (0.12.11).
Please reinstall dplyr to avoid random crashes or undefined behavior.
(the last part explains where the problem was, I think!)
Finally, I installed the latest version of the "dplyr" package. I was also able to load the "lme4" package.
I hope this helps..
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
Most helpful comment
For others who may find this, I had the same issue, and recursively removing a read-only property from the library directory fixed it for me.