如何将 R Rcpp 更新到版本 > 1.7

how to update R Rcpp to versions > 1.7

我正在尝试将 Rcpp 从 1.0.6 更新到 1.0.7 或 1.0.8。 Rcpp 更新对于我打算使用的主要 R 库来说是必不可少的。

我查看了文档并尝试使用以下方法安装 Rcpp:

install.packages("Rcpp", repos="https://RcppCore.github.io/drat")

安装完成但未进行更新。我在下面附上了命令和 sessionInfo() 信息:

library(Seurat)
 Error: package or namespace load failed for ‘Seurat’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘Rcpp’ 1.0.6 is already loaded, but >= 1.0.7 is required

> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.7 (Santiago)

Matrix products: default
BLAS:   /usr/lib64/libblas.so.3.2.1
LAPACK: /usr/lib64/liblapack.so.3.2.1

Random number generation:
RNG:     Mersenne-Twister 
Normal:  Inversion 
Sample:  Rounding 

 locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
[5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
[7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
[9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

  other attached packages:
 [1] Rcpp_1.0.6

 loaded via a namespace (and not attached):
[1] MASS_7.3-54        compiler_4.0.2     Matrix_1.2-18      tools_4.0.2       
[5] RColorBrewer_1.1-2 RANN_2.6.1         KernSmooth_2.23-17 grid_4.0.2        
[9] lattice_0.20-44    ROCR_1.0-11   

所以您正在使用 Seurat。那是一个有很多递归依赖的大包:

> db <- tools::CRAN_package_db()
> tools::package_dependencies("Seurat", recursive=TRUE, db=db)
$Seurat
  [1] "methods"         "cluster"         "cowplot"        
  [4] "fitdistrplus"    "future"          "future.apply"   
  [7] "ggplot2"         "ggrepel"         "ggridges"       
 [10] "graphics"        "grDevices"       "grid"           
 [13] "httr"            "ica"             "igraph"         
 [16] "irlba"           "jsonlite"        "KernSmooth"     
 [19] "leiden"          "lmtest"          "MASS"           
 [22] "Matrix"          "matrixStats"     "miniUI"         
 [25] "patchwork"       "pbapply"         "plotly"         
 [28] "png"             "RANN"            "RColorBrewer"   
 [31] "Rcpp"            "RcppAnnoy"       "reticulate"     
 [34] "rlang"           "ROCR"            "Rtsne"          
 [37] "scales"          "scattermore"     "sctransform"    
 [40] "SeuratObject"    "shiny"           "spatstat.core"  
 [43] "spatstat.geom"   "stats"           "tibble"         
 [46] "tools"           "utils"           "uwot"           
 [49] "RcppEigen"       "RcppProgress"    "gtable"         
 [52] "survival"        "digest"          "globals"        
 [55] "listenv"         "parallel"        "parallelly"     
 [58] "glue"            "isoband"         "mgcv"           
 [61] "withr"           "plyr"            "curl"           
 [64] "mime"            "openssl"         "R6"             
 [67] "magrittr"        "pkgconfig"       "zoo"            
 [70] "lattice"         "htmltools"       "viridisLite"    
 [73] "base64enc"       "htmlwidgets"     "tidyr"          
 [76] "dplyr"           "vctrs"           "lazyeval"       
 [79] "crosstalk"       "purrr"           "data.table"     
 [82] "promises"        "RcppTOML"        "here"           
 [85] "rappdirs"        "gplots"          "farver"         
 [88] "labeling"        "lifecycle"       "munsell"        
 [91] "reshape2"        "gridExtra"       "RcppArmadillo"  
 [94] "httpuv"          "xtable"          "fontawesome"    
 [97] "sourcetools"     "later"           "crayon"         
[100] "fastmap"         "commonmark"      "bslib"          
[103] "cachem"          "ellipsis"        "spatstat.data"  
[106] "nlme"            "rpart"           "spatstat.utils" 
[109] "spatstat.sparse" "abind"           "tensor"         
[112] "goftest"         "deldir"          "polyclip"       
[115] "fansi"           "pillar"          "FNN"            
[118] "RSpectra"        "dqrng"           "sass"           
[121] "jquerylib"       "generics"        "tidyselect"     
[124] "BH"              "sitmo"           "codetools"      
[127] "gtools"          "caTools"         "rprojroot"      
[130] "yaml"            "splines"         "colorspace"     
[133] "askpass"         "cli"             "utf8"           
[136] "stringr"         "cpp11"           "sys"            
[139] "bitops"          "fs"              "stringi"        

> 

并非所有这些都是编译包,但有些是。有些可能对 Rcpp 具有(递归)依赖性。我怀疑其中一个或多个是针对 Rcpp 版本 1.0.6 构建的,因此我尝试 运行 update.packages() 来获取您的软件包堆栈。然后再试一次。

物有所值,我的 Ubuntu 系统没有任何问题:

> sapply(c("Rcpp", "Seurat"), packageVersion)
$Rcpp
[1] 1 0 8

$Seurat
[1] 4 1 0

> 

编辑 其实,也许更简单。 Seurat 告诉您需要 1.0.7 或更新版本。您自己的日志显示

other attached packages:
[1] Rcpp_1.0.6

所以我建议退出你所在的会话(因为附加了 Rcpp),开始一个新的 session(确保 Rcpp 没有加载),更新 Rcpp 然后 尝试安装 Seurat.

另请注意,我们在 1.0.6 和 1.0.7 之间进行了更改,这使得混合变得困难。所以一旦你更新 Rcpp 你应该重建使用它的包。