Search code examples
rrcpp

how to update R Rcpp to versions > 1.7


I am trying to update Rcpp from 1.0.6 to 1.0.7 or 1.0.8. The Rcpp update is essential for a primary R library that I intend to use.

I looked at the documentation and tried to install Rcpp using:

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

The installation completes but the update does not happen. I attached the commands and the sessionInfo() information below:

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   

Solution

  • So you are using Seurat. That is a big package with many recursive dependencies:

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

    Not all of these will be compiled packages, but some are. And some may have a (recursive) dependency on Rcpp. I suspect that one or more of those where built against Rcpp versions 1.0.6 so I which try to run update.packages() to get your stack of packages forward. And then try again.

    For what it is worth, I have no issues here on my Ubuntu system:

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

    Edit Actually, maybe it is much simpler. Seurat tells you you need 1.0.7 or newer. Your own log shows

    other attached packages:
    [1] Rcpp_1.0.6
    

    so I suggest to quit the seession you are in (as Rcpp is attached), start a fresh session (make sure Rcpp is not loaded), updated Rcpp and then try to install Seurat.

    Also note that we made a change between 1.0.6 and 1.0.7 that made mixing difficult. So once you update Rcpp you should rebuild the packages that use it.