9

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
Zombo
  • 1
  • 62
  • 391
  • 407
Sarah Supp
  • 93
  • 1
  • 4
  • Looks like an RCurl problem. Does this file actually exist: /Library/Frameworks/R.framework/Versions/3.0/Resources/library/RCurl/CurlSSL/cacert.pem? – Thomas Oct 30 '13 at 21:05
  • hmm, works for me on mac, 10.8.5. This comment on installing rcharts may be of use https://github.com/ramnathv/rCharts/issues/135#issuecomment-20140615 – sckott Oct 30 '13 at 21:05
  • Yeah, what @Thomas said, do you have libcurl installed? Try locate curl-config on the command line to see if it is installed, if not directions on installing here http://www.omegahat.org/RCurl/FAQ.html Though maybe you couldn't have installed RCurl without curl already installed... – sckott Oct 30 '13 at 21:06
  • Yes, I have RCurl installed, in exactly the place that you reference (/Library/Frameworks/R.framework/Versions/3.0/Resources/library/RCurl/CurlSSL/cacert.pem). There are 3 things in the directory: boost.pem, ca-bundle.crt, and cacert.pem. – Sarah Supp Oct 30 '13 at 21:16
  • 1
    This one suggests trying to reinstall RCurl http://stackoverflow.com/a/16547624/1091766 - Try re-installing RCurl – sckott Oct 30 '13 at 21:16
  • I think I have libcurl installed. When I try locate curl-config, I get – Sarah Supp Oct 30 '13 at 21:17
  • `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/bin/curl-config /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/bin/curl-config /usr/bin/curl-config /usr/share/man/man1/curl-config.1.gz` – Sarah Supp Oct 30 '13 at 21:18
  • Thanks @Thomas and @ScottChamberlain! Deleting and reinstalling RCurl fixed the problem! – Sarah Supp Oct 30 '13 at 21:33

3 Answers3

8

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

Mihai Chelaru
  • 7,614
  • 14
  • 45
  • 51
Terence Yang
  • 558
  • 6
  • 9
  • On ubuntu 18.04 server, I had to install libcurl4-openssl-dev before I could install curl. Then Sys.setenv(CURL_CA_BUNDLE="/opt/microsoft/ropen/3.5.1/lib64/R/lib/microsoft-r-cacert.pem") – rinzy kutex Jan 08 '19 at 19:57
2

This SO answer (R - devtools Github install fails) to a similar question suggests trying to reinstall RCurl - which (I'm guessing here) may fix the path to curl on your machine, in any case, try that.

Community
  • 1
  • 1
sckott
  • 5,755
  • 2
  • 26
  • 42
0

I got this error while pushing changes to github
git config --global http.sslverify "false" will solve the problem

here is original discussion going on
https://github.com/npm/npm/issues/1484

Lokesh Tiwari
  • 10,496
  • 3
  • 36
  • 45