microsoft / microsoft-r-open

Microsoft R Open Source
212 stars 69 forks source link

Packages that utilize built in Curl are not able to find a certificate bundle #6

Closed nathansoz closed 7 years ago

nathansoz commented 7 years ago

An example:

R install.packages("ctv") library(ctv) install.views("Econometrics")


I was faced with the error.
Error in url(paste(contriburl[i], "Views.rds", sep = "/"), open = "rb") : 
  cannot open connection
In addition: Warning message:
In url(paste(contriburl[i], "Views.rds", sep = "/"), open = "rb") :
  URL 'https://mran.revolutionanalytics.com/snapshot/2016-07-01/src/contrib/Views.rds': status was 'Problem with the SSL CA cert (path? access rights?)'

The issue was [reported here](https://social.msdn.microsoft.com/Forums/en-US/20c2667c-1518-4e74-8ba6-0d8ebb7da9f0/installing-views?forum=ropen&prof=required)

The solution is to modify the command to look like this:

``` R```
Sys.setenv(CURL_CA_BUNDLE = "/usr/lib64/microsoft-r/3.3/lib64/R/lib/microsoft-r-cacert.pem")
install.packages("ctv")
library(ctv)
install.views("Econometrics")
nathansoz commented 7 years ago

Fixed merged into internal repository. Will be fixed in 3.3.2 release.

andrie commented 6 years ago

I have found this issue recurs in MRO-3.3.3 as well as MRO-3.3.4. I tested on Ubuntu 16.04.

My workaround is to add this line of code to the Rprofile.site:

Sys.setenv(CURL_CA_BUNDLE = file.path(Sys.getenv("R_HOME"), "lib/microsoft-r-cacert.pem"))

Alternatively, you can add this line of code to Renviron:

CURL_CA_BUNDLE=${R_HOME/lib/microsoft-r-cacert.pem}