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

Mdh*_*ale 2 r rcpp

我正在尝试将 Rcpp 从 1.0.6 更新到 1.0.7 或 1.0.8。Rcpp 更新对于我打算使用的主要 R 库至关重要。

\n

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

\n
install.packages("Rcpp", repos="https://RcppCore.github.io/drat")\n
Run Code Online (Sandbox Code Playgroud)\n

安装已完成,但更新未发生。我附上了以下命令和sessionInfo()信息:

\n
library(Seurat)\n Error: package or namespace load failed for \xe2\x80\x98Seurat\xe2\x80\x99 in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):\nnamespace \xe2\x80\x98Rcpp\xe2\x80\x99 1.0.6 is already loaded, but >= 1.0.7 is required\n\n> sessionInfo()\nR version 4.0.2 (2020-06-22)\nPlatform: x86_64-pc-linux-gnu (64-bit)\nRunning under: Red Hat Enterprise Linux Server release 6.7 (Santiago)\n\nMatrix products: default\nBLAS:   /usr/lib64/libblas.so.3.2.1\nLAPACK: /usr/lib64/liblapack.so.3.2.1\n\nRandom number generation:\nRNG:     Mersenne-Twister \nNormal:  Inversion \nSample:  Rounding \n\n locale:\n[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              \n[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    \n[5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   \n[7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 \n[9] LC_ADDRESS=C               LC_TELEPHONE=C            \n[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       \n\nattached base packages:\n[1] stats     graphics  grDevices utils     datasets  methods   base     \n\n  other attached packages:\n [1] Rcpp_1.0.6\n\n loaded via a namespace (and not attached):\n[1] MASS_7.3-54        compiler_4.0.2     Matrix_1.2-18      tools_4.0.2       \n[5] RColorBrewer_1.1-2 RANN_2.6.1         KernSmooth_2.23-17 grid_4.0.2        \n[9] lattice_0.20-44    ROCR_1.0-11   \n
Run Code Online (Sandbox Code Playgroud)\n

Dir*_*tel 5

所以你正在使用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"        

> 
Run Code Online (Sandbox Code Playgroud)

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

无论如何,我的 Ubuntu 系统上没有任何问题:

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

$Seurat
[1] 4 1 0

> 
Run Code Online (Sandbox Code Playgroud)

编辑实际上,也许它要简单得多。 Seurat告诉您您需要 1.0.7 或更高版本。你自己的日志显示

other attached packages:
[1] Rcpp_1.0.6
Run Code Online (Sandbox Code Playgroud)

所以我建议退出您所在的会话(如Rcpp附件所示),启动一个新会话(确保Rcpp未加载),更新Rcpp,然后尝试安装Seurat。

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