17

When I use

library(Hmisc)

I get the following error

    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called 'stringi'
    Error: package 'ggplot2' could not be loaded

As well, if I use

library(ggplot2)

I get the following error

    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called 'stringi'
    Error: package or namespace load failed for 'ggplot2'

I've tryed to install 'stringi' install.packages("stringi")

But at some point, during the installation, I get the following error message:

    configure: error: in `/private/var/folders/pr/wdr5dvjj24bb4wwnjpg1hndc0000gr/T/RtmpeQ5pXk/R.INSTALL10b94a012cab/stringi':
    configure: error: no acceptable C compiler found in $PATH
    See `config.log' for more details
    ERROR: configuration failed for package 'stringi'
    * removing '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/stringi'

I'm using RStudio (Version 0.99.447) and I have R version 3.2.1.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
Marta
  • 171
  • 1
  • 1
  • 3
  • 2
    It might help if you provided the output from `sessionInfo()`. – joran Jun 22 '15 at 14:51
  • `apt-get install build-essential` | `yum install gcc` | [download Xcode + run it once to accept license] `xcode-select --install` (OS X) – hrbrmstr Jun 22 '15 at 14:58
  • @hrbrmstr, out of curiosity, how can you tell that the OP is using OS X and not another flavor of *nix? Are the file paths OS X specific? – Richard Erickson Jun 22 '15 at 15:05
  • 2
    @RichardErickson I cannot. Hence providing Debian/Ubuntu | RedHat/CentOS | OS X solutions depending on OP's setup. – hrbrmstr Jun 22 '15 at 15:06
  • @hrbrmstr, okay. I understand your comment now. Thanks for answering my question. I agree that OS is needed to provide an answer to the OP's question. – Richard Erickson Jun 22 '15 at 15:09
  • 1
    ARGH! @RichardErickson, the OP is using OS X. The `/Library/Frameworks/R.framework/` gives that away. Marta: Grab Xcode from the Mac App Store and use that `xcode-select --install` to download the command line tools. You may need a (free) developer account. – hrbrmstr Jun 22 '15 at 15:19
  • I think this is exacly the same case as in http://stackoverflow.com/q/31038636/168747. R tries to install package from sources cause source is newer than binary (0.5-2 vs 0.4-1). Set `options(install.packages.check.source = "no")` and then `install.packages("stringi")`. (IMPORTANT: it's related to new releases of package, now everything should be ok) – Marek Jun 26 '15 at 21:41

2 Answers2

18

I got this error while trying to load the swirl package.

You can try to re install the package directly from cran and include an argument to ensure all the dependant packages are included.

install.packages("swirl", repos="http://cran.rstudio.com/", dependencies=TRUE)
4

Use this:

install.packages("package_name", repos=c("http://rstudio.org/_packages",
"http://cran.rstudio.com",dependencies=TRUE))

This works as it assigns from where to download the package.

Rafs
  • 614
  • 8
  • 19
  • 1
    While you may have solved this user's problem, code-only answers are not very helpful to users who come to this question in the future. Please edit your answer to explain why your code solves the original problem. – Joe C Mar 18 '17 at 22:26
  • Use this: `install.packages("package name", dependencies = TRUE)' – Prem S Oct 13 '17 at 17:56