0

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

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’

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.

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  
Doug Fir
  • 19,971
  • 47
  • 169
  • 299

1 Answers1

1

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)

  • Good research, but you should probably cite [the GitHub issue](https://github.com/tidyverse/tidyverse/issues/99) you quote the last two lines of code from – duckmayr Sep 27 '18 at 20:05
  • @duckmayr, sorry, forgot to add! Thanks –  Sep 27 '18 at 20:07
  • No problem, +1 now that the cite's there – duckmayr Sep 27 '18 at 20:08
  • 'failed to create lock' with your first snippet so I ran your second snippet. The console has been running with the red dot since just after you provided your answer. Seems the console is not responding or something. I rebooted once already. It just lingers on ```* installing *source* package ‘readr’ ... ** package ‘readr’ successfully unpacked and MD5 sums checked ** 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/... [lots of output here...]`` – Doug Fir Sep 27 '18 at 20:36
  • @DougFir To clarify, there is a last line of "[lots of output here...]" that it has not gone past in some time? – duckmayr Sep 27 '18 at 20:42
  • @duckmayr yes that's correct. Here, I'll try to paste the rest (it's actually not a lot" ```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/3.4/BH/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Collector.cpp -o Collector.o``` – Doug Fir Sep 27 '18 at 20:47
  • @DougFir How much RAM do you have? – duckmayr Sep 27 '18 at 20:49
  • @duckmayr I tried to find out in AWS EC2 interface but could not see it. In the terminal I typed ```top | grep -i mem``` which gave 1007540. Does this indicate RAM? – Doug Fir Sep 27 '18 at 20:57
  • 1
    @DougFir Yeah. It looks like you don't have enough RAM to compile `readr` (see [this Stack Overflow question](https://stackoverflow.com/a/40949665/8386140) and [this GitHub issue](https://github.com/tidyverse/readr/issues/544)). If you follow the instructions of the top answer to the Stack Overflow question I linked, I think you should be alright. – duckmayr Sep 27 '18 at 21:02