Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing tidyverse on Ubuntu 18.x & R 3.4.4/3.5.1

I attempted to install tidyverse (and the packages that make up tidyverse) and got the following output:

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

Afterwards, tidyverse is not installed, and is not recognized. Is there a suggested way to install tidyverse under these conditions? Yes? No? Alternatives that have worked?

like image 805
Bucephalus Avatar asked Oct 20 '18 01:10

Bucephalus


2 Answers

Edit

There is an easier way: use already compiled binaries. See this link (mirror) for more information

From your Linux terminal, run

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

or for R 3.5.x

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

Then add this key to your system with the command

$> sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

After that

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

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

Search if the tidyverse is available

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

Installation

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

Done !!!


I've recently installed the tidyverse package on my Linux Mint 19 which is based on Ubuntu 18.04 Bionic. This is what I did:

From your Linux terminal, run

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

If you encounter The following packages have unmet dependencies error, try running the following to fix it

$> sudo apt-get install -f

Then in R/RStudio terminal

R> install.packages("tidyverse", dependencies = TRUE)
like image 109
Tung Avatar answered Sep 28 '22 08:09

Tung


Have you installed the system dependencies before installing tidyverse? If not, run

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

in terminal before you proceed with install.packages("tidyverse").

For more details, read this post.

like image 21
NickZeng Avatar answered Sep 28 '22 06:09

NickZeng