在Ubuntu 18.x和R 3.4.4 / 3.5.1

时间:2018-10-20 01:07:59

标签: r tidyverse ubuntu-18.04

我尝试安装tidyverse(以及组成tidyverse的软件包)并获得以下输出:

> install.packages('tidyverse', dependencies=TRUE, type="source")
Installing package into ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘dbplyr’, ‘modelr’

trying URL 'https://cloud.r-project.org/src/contrib/dbplyr_1.2.2.tar.gz'
Content type 'application/x-gzip' length 263687 bytes (257 KB)
==================================================
downloaded 257 KB

trying URL 'https://cloud.r-project.org/src/contrib/modelr_0.1.2.tar.gz'
Content type 'application/x-gzip' length 118432 bytes (115 KB)
==================================================
downloaded 115 KB

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 ‘dbplyr’ ...
** package ‘dbplyr’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Warning: S3 methods ‘[.fun_list’, ‘[.grouped_df’, ‘all.equal.tbl_df’, ‘anti_join.data.frame’, ‘anti_join.tbl_df’, ‘arrange.data.frame’, ‘arrange.default’, ‘arrange.grouped_df’, ‘arrange.tbl_df’, ‘arrange_.data.frame’, ‘arrange_.tbl_df’, ‘as.data.frame.grouped_df’, ‘as.data.frame.rowwise_df’, ‘as.data.frame.tbl_cube’, ‘as.data.frame.tbl_df’, ‘as.table.tbl_cube’, ‘as.tbl.data.frame’, ‘as.tbl.tbl’, ‘as.tbl_cube.array’, ‘as.tbl_cube.data.frame’, ‘as.tbl_cube.matrix’, ‘as.tbl_cube.table’, ‘as_data_frame.grouped_df’, ‘as_data_frame.tbl_cube’, ‘auto_copy.tbl_cube’, ‘auto_copy.tbl_df’, ‘cbind.grouped_df’, ‘collapse.data.frame’, ‘collect.data.frame’, ‘common_by.NULL’, ‘common_by.character’, ‘common_by.default’, ‘common_by.list’, ‘compute.data.frame’, ‘copy_to.DBIConnection’, ‘copy_to.src_local’, ‘default_missing.data.frame’, ‘default_missing.default’, �� [... truncated]
Error in library.dynam(lib, package, package.lib) : 
  shared object ‘dplyr.so’ not found
ERROR: lazy loading failed for package ‘dbplyr’
* removing ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.4/dbplyr’
Warning in install.packages :
  installation of package ‘dbplyr’ had non-zero exit status
* installing *source* package ‘modelr’ ...
** package ‘modelr’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** preparing package for lazy loading
Warning: S3 methods ‘[.fun_list’, ‘[.grouped_df’, ‘all.equal.tbl_df’, ‘anti_join.data.frame’, ‘anti_join.tbl_df’, ‘arrange.data.frame’, ‘arrange.default’, ‘arrange.grouped_df’, ‘arrange.tbl_df’, ‘arrange_.data.frame’, ‘arrange_.tbl_df’, ‘as.data.frame.grouped_df’, ‘as.data.frame.rowwise_df’, ‘as.data.frame.tbl_cube’, ‘as.data.frame.tbl_df’, ‘as.table.tbl_cube’, ‘as.tbl.data.frame’, ‘as.tbl.tbl’, ‘as.tbl_cube.array’, ‘as.tbl_cube.data.frame’, ‘as.tbl_cube.matrix’, ‘as.tbl_cube.table’, ‘as_data_frame.grouped_df’, ‘as_data_frame.tbl_cube’, ‘auto_copy.tbl_cube’, ‘auto_copy.tbl_df’, ‘cbind.grouped_df’, ‘collapse.data.frame’, ‘collect.data.frame’, ‘common_by.NULL’, ‘common_by.character’, ‘common_by.default’, ‘common_by.list’, ‘compute.data.frame’, ‘copy_to.DBIConnection’, ‘copy_to.src_local’, ‘default_missing.data.frame’, ‘default_missing.default’, �� [... truncated]
Error in library.dynam(lib, package, package.lib) : 
  shared object ‘dplyr.so’ not found
ERROR: lazy loading failed for package ‘modelr’
* removing ‘/home/aos11409/R/x86_64-pc-linux-gnu-library/3.4/modelr’
Warning in install.packages :
  installation of package ‘modelr’ had non-zero exit status
ERROR: dependencies ‘dbplyr’, ‘modelr’ are not available for package ‘tidyverse’
* removing ‘/home/aos11409/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/RtmpztQF5N/downloaded_packages’

之后,未安装tidyverse,因此无法识别。在这种情况下,是否有建议的方式安装tidyverse?是?没有?可行的替代方案吗?

2 个答案:

答案 0 :(得分:3)

修改

有一个更简单的方法:使用已经编译的二进制文件。有关更多信息,请参见此linkmirror

在Linux终端上运行

$> echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic/" | sudo tee -a /etc/apt/sources.list

R 3.5.x

$> echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/" | sudo tee -a /etc/apt/sources.list

然后使用命令

将此密钥添加到系统中
$> sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

之后

$> sudo apt-get update
$> sudo apt-get upgrade -y

$> sudo apt-get install -y r-base r-recommended r-base-dev

搜索tidyverse是否可用

$> apt search r-cran-tidyverse
p   r-cran-tidyverse                - GNU R package "Easily Install and Load the

安装

$> sudo apt-get install -y build-dep r-cran-tidyverse

完成!!!


我最近在基于Ubuntu 18.04 Bionic的Linux Mint 19上安装了tidyverse软件包。这就是我所做的:

在Linux终端上运行

$> sudo apt-get update

$> sudo apt-get install r-base r-base-dev r-recommended

$> sudo apt-get install libcurl4-openssl-dev libgit2-dev libxml2-dev libssl-dev libudunits2-dev libpoppler-cpp-dev

如果遇到The following packages have unmet dependencies错误,请尝试运行以下命令对其进行修复

$> sudo apt-get install -f

然后在R / RStudio终端中

R> install.packages("tidyverse", dependencies = TRUE)

答案 1 :(得分:1)

在安装tidyverse之前是否已安装系统依赖项?如果没有,请运行

sudo apt install libcurl4-openssl-dev libssl-dev libxml2-dev

在终端上继续操作install.packages("tidyverse")之前。

有关更多详细信息,请阅读this post