【问题标题】:non zero exit when installing package, only tidyverse安装包时非零退出,仅 tidyverse
【发布时间】:2019-03-03 18:45:21
【问题描述】:

我已经在 Ubunto 上设置了托管 RStudio,并且已经加载了几个没有问题的包,包括 caret 和 lubridate。

但是,当我尝试安装 tidyverse 时,我得到:

> install.packages("tidyverse", dependencies = T)
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/tidyverse_1.2.1.tar.gz'
Content type 'application/x-gzip' length 61647 bytes (60 KB)
==================================================
downloaded 60 KB

* installing *source* package ‘tidyverse’ ...
** package ‘tidyverse’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Warning: S3 methods ‘as.col_spec.NULL’, ‘as.col_spec.character’, ‘as.col_spec.col_spec’, ‘as.col_spec.default’, ‘as.col_spec.list’, ‘format.col_spec’, ‘output_column.POSIXt’, ‘output_column.default’, ‘output_column.double’, ‘print.col_spec’, ‘print.collector’, ‘print.date_names’, ‘print.locale’ were declared in NAMESPACE but not found
Error in library.dynam(lib, package, package.lib) : 
  shared object ‘readr.so’ not found
ERROR: lazy loading failed for package ‘tidyverse’
* removing ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmpv6cOap/downloaded_packages’

在 Ubuntu 上安装 r 和 rstudio 后,我还安装了 r-base-dev、libcurl4-openssl-dev、libssl-dev 和 libxml2-dev。在最初尝试安装 tidyverse 后,我按照控制台消息执行了此操作。

如何克服这个错误并安装 tidyverse?

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

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

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

other attached packages:
[1] caret_6.0-80    ggplot2_3.0.0   lattice_0.20-35 lubridate_1.7.4 dplyr_0.7.6    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.18       tidyr_0.8.1        class_7.3-14       assertthat_0.2.0   ipred_0.9-7       
 [6] foreach_1.4.4      R6_2.2.2           plyr_1.8.4         backports_1.1.2    magic_1.5-9       
[11] stats4_3.4.4       pillar_1.3.0       rlang_0.2.2        lazyeval_0.2.1     rstudioapi_0.7    
[16] data.table_1.11.6  kernlab_0.9-27     rpart_4.1-13       Matrix_1.2-12      splines_3.4.4     
[21] CVST_0.2-2         ddalpha_1.3.4      gower_0.1.2        stringr_1.3.1      munsell_0.5.0     
[26] broom_0.5.0        compiler_3.4.4     pkgconfig_2.0.2    dimRed_0.1.0       nnet_7.3-12       
[31] tidyselect_0.2.4   tibble_1.4.2       prodlim_2018.04.18 DRR_0.0.3          codetools_0.2-15  
[36] RcppRoll_0.3.0     crayon_1.3.4       withr_2.1.2        MASS_7.3-49        recipes_0.1.3     
[41] ModelMetrics_1.2.0 grid_3.4.4         nlme_3.1-131       gtable_0.2.0       magrittr_1.5      
[46] scales_1.0.0       stringi_1.2.4      reshape2_1.4.3     bindrcpp_0.2.2     timeDate_3043.102 
[51] robustbase_0.93-3  geometry_0.3-6     pls_2.7-0          lava_1.6.3         iterators_1.0.10  
[56] tools_3.4.4        glue_1.3.0         DEoptimR_1.0-8     purrr_0.2.5        sfsmisc_1.1-2     
[61] abind_1.4-5        survival_2.41-3    yaml_2.2.0         colorspace_1.3-2   bindr_0.1.1  

【问题讨论】:

    标签: r tidyverse


    【解决方案1】:

    readr 似乎有问题...

    Error in library.dynam(lib, package, package.lib) : 
      shared object ‘readr.so’ not found
    

    使用下面的代码检查软件包是否已安装。如果没有,它将被安装

    #Specify packages
    packages = c("readr")
    
    package.check <- lapply(packages, FUN = function(x) {
      if (!require(x, character.only = TRUE)) {
        install.packages(x, dependencies = TRUE)
        library(x, character.only = TRUE)
      }
    })
    
    #Verify they are loaded
    search()
    

    如果安装了,文件可能会被锁定...

    #If "failed to create lock" is the returned error, install with the below code;
    install.packages("readr", dependencies=TRUE, INSTALL_opts = c('--no-lock'))
    

    (https://github.com/tidyverse/tidyverse/issues/99)

    【讨论】:

    • 很好的研究,但你可能应该引用the GitHub issue你引用的最后两行代码
    • @duckmayr,抱歉,忘记添加了!谢谢
    • 没问题,+1 既然引用就在那里
    • 'failed to create lock' with your first sn-p 所以我运行了你的第二个 sn-p。自从您提供答案后,控制台一直以红点运行。似乎控制台没有响应或什么的。我已经重新启动了一次。它只是徘徊在```* 安装 source 包'readr' ... ** 包'readr' 成功解包并检查 MD5 和 ** libs g++ -I/usr/share/R/include -DNDEBUG -I"/home/rstudio/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include"-I"/home/rstudio/R/x86_64-pc-linux-gnu-library/.. . [这里有很多输出...]``
    • @DougFir 是的。看起来您没有足够的 RAM 来编译 readr(请参阅 this Stack Overflow questionthis GitHub issue)。如果您按照我链接的 Stack Overflow 问题的最佳答案的说明进行操作,我认为您应该没问题。
    猜你喜欢
    • 1970-01-01
    • 2019-01-14
    • 2020-02-08
    • 1970-01-01
    • 2017-09-21
    • 1970-01-01
    • 2020-08-24
    • 2014-11-03
    • 2021-04-17
    相关资源
    最近更新 更多