简体   繁体   中英

Cannot install ggplot2: “Error in library.dynam(lib, package, package.lib) : shared object ‘stringi.so’ not found”

Last week I upgraded from Ubuntu 14.04 to 14.10. The first time I've tried to use ggplot in RStudio since the update, I'm getting dependancy errors with my ggplot package and its no longer registered as installed (was working fine before). When I try to reinstal ggplot2:

install.packages("ggplot2",dep=TRUE)

The installation fails while trying to install the dependencies. Here's what the tail of the output looks like:

* installing *source* package ‘stringr’ ...
** package ‘stringr’ successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Error in library.dynam(lib, package, package.lib) : 
  shared object ‘stringi.so’ not found
ERROR: lazy loading failed for package ‘stringr’
* removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1/stringr’
Warning in install.packages :
  installation of package ‘stringr’ had non-zero exit status
ERROR: dependency ‘stringr’ is not available for package ‘reshape2’
* removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1/reshape2’
Warning in install.packages :
  installation of package ‘reshape2’ had non-zero exit status
ERROR: dependency ‘reshape2’ is not available for package ‘ggplot2’
* removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1/ggplot2’
Warning in install.packages :
  installation of package ‘ggplot2’ had non-zero exit status

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

I have a feeling this is the line (below) I should be looking at, but I'm not sure how to interprete this error, anyone have any suggestions for me? I really have no idea where to go from here, as I couldent find any other people experiencing the same error as me.

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

Not sure if the Ubuntu upgrade I did relates to this... but I thought'd I'd mention it just in case.

Following @Nick Kennedey's comment, I tried installing stringi like this:

> install.packages("stringi",dep=TRUE)

Which resulted in this error I hadn't seen before:

2015-08-07 10:26:35 (256 KB/s) - ‘/tmp/RtmpQI4Uau/downloaded_packages/stringi_0.5-5.tar.gz’ saved [3639183/3639183]

ERROR: failed to lock directory ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1’ for modifying
Try removing ‘/home/james/R/x86_64-pc-linux-gnu-library/3.1/00LOCK-stringi’
Warning in install.packages :
  installation of package ‘stringi’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpQI4Uau/downloaded_packages’
> install.packages("stringi",dep=TRUE)

So the I followed the suggestion in the error an removed the LOCK folder.

In the terminal: rm -r /home/james/R/x86_64-pc-linux-gnu-library/3.1/00LOCK-stringi'

Then tried installing the stringi package again, and it worked! This was the issue... now I've just finished installing with no issues.

I am still a little bit confused though... as to how this error can come about. Any ideas on what causes this so I can avoid it in the future? Is it possible it was a symptom of my recent upgrade to 14.10?

Got the same error while installing install.packages("knitr")

Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/usr/local/lib/R/site-library/stringi/libs/stringi.so'

I solved it by doing the below:

In Ubuntu 16.04 and above

sudo apt install r-cran-stringi

In earlier versions (which had apt-get)

sudo apt-get install r-cran-stringi

In my case I solved the problem through installing stringi and ggplot2 from the terminal of linux. The problem has some relation with RStudio.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM