error setting certificate verify locations, install_github

Sarah Supp picture Sarah Supp · Oct 30, 2013 · Viewed 8.3k times · Source

I am trying to install a package from github, but I keep getting an error when I use install_github.

library(devtools)
install_github(repo="swirl", username="ncarchedi")
Installing github repo(s) swirl/master from ncarchedi
Downloading swirl.zip from https://github.com/ncarchedi/swirl/archive/master.zip
Error in function (type, msg, asError = TRUE)  : 
  error setting certificate verify locations:
  CAfile: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RCurl/CurlSSL/cacert.pem
  CApath: none

I have tried to install several different packages (including an updated version of ggmap), and I always get the same error. It must have something to do with RCurl, but I don't understand what the problem is, or how to fix it. I have devtools (Version 1.3) and RCurl (Version 1.95-4.1). I am running R version 3.0.1 ("Good Sport") on mac.

Results from sessionInfo()

sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] RCurl_1.95-4.1 bitops_1.0-5   devtools_1.3  

loaded via a namespace (and not attached):
[1] digest_0.6.3   evaluate_0.4.3 httr_0.2       memoise_0.1    parallel_3.0.1  stringr_0.6.2 
[7] tools_3.0.1    whisker_0.3-2

Answer

Fan Yang picture Fan Yang · May 31, 2018

The problem is due to a change in the R package curl.

You can work around the issue as follows:

1). Open a new MRO session and remove the packages curl and httr:

remove.packages(c("curl","httr"))

2). Restart MRO and install the packages again, this time using install.packages() function:

install.packages(c("curl", "httr"))

3). Set the environment variable CURL_CA_BUNDLE:

Sys.setenv(CURL_CA_BUNDLE="/utils/microsoft-r-open-3.4.3/lib64/R/lib/microsoft-r-cacert.pem")

4). Try installing a package using install_github() from github(this should now work):

For example:

install_github("ropensci/tokenizer")

Reference:

rvest read_html function does not work