Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After update unable to install dplyr due to problems witk Rcpp-package and BH-package #2002

Closed
Marlein opened this issue Jul 6, 2016 · 13 comments

Comments

@Marlein
Copy link

Marlein commented Jul 6, 2016

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:
#1 (for Rcpp):

package ‘Rcpp’ successfully unpacked and MD5 sums checked 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’
#2 (for BH):

package ‘BH’ successfully unpacked and MD5 sums checkedWarning in install.packages :
unable to move temporary installation ‘C:\Program Files\R\R-3.3.1\library\file548c7b673dab\BH’ to ‘C:\Program Files\R\R-3.3.1\library\BH’

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

@hadley
Copy link
Member

hadley commented Jul 6, 2016

I'd recommend restarting in a clean R session and trying to install again.

@kevinushey
Copy link
Contributor

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

@Marlein
Copy link
Author

Marlein commented Jul 6, 2016

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?

@Marlein
Copy link
Author

Marlein commented Jul 6, 2016

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.

@kevinushey
Copy link
Contributor

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.

@Marlein
Copy link
Author

Marlein commented Jul 6, 2016

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:\Users\Marlein\Documents\R\win-library\3.3\file259827fa4933\Rcpp’ to ‘C:\Users\Marlein\Documents\R\win-library\3.3\Rcpp’

@thirdwing
Copy link

Just a random guess. This kind of error can also be caused by antivirus software on Windows.

@kevinushey
Copy link
Contributor

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

@Marlein
Copy link
Author

Marlein commented Jul 7, 2016

Shut McAfee down and that solved the problem!
Everyone, thanks a lot for helping me!!

@billdenney
Copy link
Contributor

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.

  1. Navigate in Windows Explorer to your library directory (e.g. C:\Users\Marlein\Documents\R\win-library\ in the example above)
  2. Right click on the directory for your current version of R (3.3 in the example above).
  3. Choose "Properties" from the menu.
  4. Uncheck "Read-only" next to "Attributes"
  5. Click "OK"
  6. Choose "Apply changes to this folder, subfolders and files" and click "OK"

@albreez
Copy link

albreez commented Feb 22, 2018

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:\R\Library:

    • Create the folder C:\R\Library
    • Click Start --> Control Panel --> User Accounts --> Change my environmental variables
    • The Environmental Variables window pops up. If you see R_LIBS_USER, highlight it and click Edit. Otherwise click New. Both actions open a window with fields for Variable and Value.
    • In my case, R_LIBS_USER was already there, and the value was a path to my desktop. I added to the path the folder that I created, separated by semicolon. No quotes: C:\R\Library;C:\Users\Eric.Krantz\Desktop\R stuff\Packages. NOTE: I could have removed the path to the Desktop location and simply left C:\R\Library.

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.

@SenshiKudo
Copy link

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 MB

package ‘Rcpp’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\Owner\AppData\Local\Temp\RtmpA1EPax\downloaded_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, lag

The following objects are masked from ‘package:base’:

intersect, setdiff, setequal, union

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

@lock
Copy link

lock bot commented Oct 10, 2018

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/

@lock lock bot locked and limited conversation to collaborators Oct 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants