本文介绍了安装包时非零退出,只有 tidyverse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've set up hosted RStudio on Ubunto and have loaded several packages already with no issues, including caret and lubridate.

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

However, when I tried to install tidyverse I get:

> 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 后,我按照控制台消息执行了此操作.

After installing r and rstudio on Ubuntu I also installed r-base-dev, libcurl4-openssl-dev, libssl-dev and libxml2-dev. I did this following console messages after initially trying to install tidyverse.

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

How can I overcome this error and install 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

推荐答案

看起来像 readr 的问题...

Looks like an issue with readr...

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

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

Use the code below to check if the package is installed. If not, it will be installed

#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 it is installed, the file may be locked...

#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)

这篇关于安装包时非零退出,只有 tidyverse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 06:23