简体   繁体   中英

R: Problems with unloadNamespace(package) when installing a package

I made an R-package called TRIMmaps and tried to install it with the command

R CMD INSTALL TRIMmaps_v1.12.0

I received the following error message:

Error in unloadNamespace(package) : 
  namespace ‘Rcpp’ is imported by ‘plyr’ so cannot be unloaded
Error in library(pkg, character.only = TRUE, logical.return = TRUE, lib.loc = lib.loc) : 
  “Rcpp” version 0.11.2 cannot be unloaded.

I do need package plyr, however, because when I remove it I get the message:

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called ‘plyr’

I removed both packages plyr and Rcpp and installed them again. My current version of Rcpp now is 0.11.5, but when I try to install the TRIMmaps-package again, I get the same error message as above including the line “Rcpp” version 0.11.2 cannot be unloaded . Although I have removed the older Rcpp-version and replaces it by 0.11.5, here still a problem occurs with 0.11.2.

How do I solve this? Any hint is appreciated.

I get a similar error. Minimal conditions to reproduce it seem to be:

  1. Depend on a package x (in my case reshape )
  2. In your vignette load a packge y (in my case plyr ) that also imports or depends on x .

The vignette builds fine if you build it outside of the package building or checking process, but throws the error that you indicate otherwise. The error is also R version and maybe site specific, since it goes away with R 3.2.0 when trying to build the package on a different machine.

最简单的方法是关闭(R-Studio),或打开一个新的(GUI),并完成工作,您可以复制代码并重复使用它们。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM