R: error installing packages UBUNTU - Error in dyn

2019-02-24 13:30发布

问题:

I'm having problem installing any package, also from package archive. In this case showing error trying to install ggplot2:

* installing *source* package ‘ggplot2’ ...
** package ‘ggplot2’ successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/juanchi/R/x86_64-pc-linux-gnu-library/3.2/stringi/libs/stringi.so':
  libicui18n.so.52: no se puede abrir el archivo del objeto compartido: No existe el archivo o el directorio
ERROR: lazy loading failed for package ‘ggplot2’
* removing ‘/home/juanchi/R/x86_64-pc-linux-gnu-library/3.2/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

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

This is my session Info

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 15.10

locale:
 [1] LC_CTYPE=pt_BR.UTF-8       LC_NUMERIC=C               LC_TIME=pt_BR.UTF-8       
 [4] LC_COLLATE=es_ES.UTF-8     LC_MONETARY=pt_BR.UTF-8    LC_MESSAGES=es_ES.UTF-8   
 [7] LC_PAPER=pt_BR.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=pt_BR.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
[1] rsconnect_0.4.1.4 tools_3.2.2     

Thanks in advance!!

回答1:

Your upgrade to Ubuntu 15.10 meant that the ICU library went from version 52 to a newer version (55, if I recall). But the stringi package was built against 52, and is now broken. That can happen to your R packages when they are outside of the Ubuntu package management system.

So you need to re-install stringi, which is required by ggplot2, and then ggplot2 will install and also load, avoiding the erorr you.

You could avoid these upgrade problems by using the pre-built versions of ggplot2 and its dependencies: do sudo apt-get install r-cran-ggplot2.



回答2:

Thank you Dirk, your advice to install the package via the ubuntu terminal solved my problem as well: I had an almost identical error message when I was trying to install reshape2 on Ubuntu 15.10.

I just, 1) uninstalled the currently installed version of reshape2 through the R terminal (if you use R-Studio you can also do this in the "packages" window where the packages are listed), 2) run sudo apt-get install r-cran-reshape2 in the ubuntu terminal, 3) restarted the computer.



标签: r rstudio