microsoft / microsoft-r-open

Microsoft R Open Source
212 stars 69 forks source link

Installation of packages using Devtools Fails - error setting certificate #63

Closed paupereira closed 5 years ago

paupereira commented 6 years ago

Problem:

When I run

devtools::install_github('xuyiqing/gsynth')

I get the error

Installation failed: error setting certificate verify locations:
  CAfile: microsoft-r-cacert.pem
  CApath: none

System info:

Sys.info()
                                      sysname                                       release 
                                      "Linux"                              "4.4.0-1052-aws" 
                                      version                                      nodename 
"#61-Ubuntu SMP Mon Feb 12 23:05:58 UTC 2018"                            "ip-172-31-23-240" 
                                      machine                                         login 
                                     "x86_64"                                     "unknown" 
                                         user                                effective_user 
                                     "ubuntu"                                      "ubuntu" 

R version:

> R.version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          4.3                         
year           2017                        
month          11                          
day            30                          
svn rev        73796                       
language       R                           
version.string R version 3.4.3 (2017-11-30)
nickname       Kite-Eating Tree  
huangteng1220 commented 6 years ago

I had the same problem. Have you solved the problem?

jona-sassenhagen commented 6 years ago

Same problem.

elmstedt commented 6 years ago

EDIT: After some more searching I found this thread: https://social.technet.microsoft.com/Forums/ie/en-US/aec2c852-109a-4fc3-95f9-6fe61e779adf/rvest-readhtml-function-does-not-work?forum=ropen

The workaround, for now, seems to be uninstalling curl and httr, restarting R, reinstalling those packages, then setting the CURL_CA_BUNDLE system environment.

  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")

############################################################################ Original comment:

Same problem here.

sessionInfo() R version 3.4.3 (2017-11-30) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.4 LTS

Matrix products: default BLAS: /opt/microsoft/ropen/3.4.3/lib64/R/lib/libRblas.so LAPACK: /opt/microsoft/ropen/3.4.3/lib64/R/lib/libRlapack.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] curl_3.1 devtools_1.13.4 RevoUtils_10.0.7 RevoUtilsMath_10.0.1

loaded via a namespace (and not attached): [1] httr_1.3.1 compiler_3.4.3 R6_2.2.2 tools_3.4.3 withr_2.1.1 yaml_2.1.16 memoise_1.1.0 git2r_0.20.0 digest_0.6.13

##################################################################################

Sys.getenv("CURL_CA_BUNDLE") [1] "" ie_get_proxy_for_url("https://www.google.com") NULL ie_proxy_info() NULL Sys.getenv("https_proxy") [1] "" readLines(base::url("https://httpbin.org/get")) Error in readLines(base::url("https://httpbin.org/get")) : cannot open the connection to 'https://httpbin.org/get' In addition: Warning message: In readLines(base::url("https://httpbin.org/get")) : URL 'https://httpbin.org/get': status was 'Problem with the SSL CA cert (path? access rights?)' Sys.getenv("CURL_CA_BUNDLE") [1] ""

arisbw commented 6 years ago

Hi, I tried to set CURL_CA_BUNDLE to /opt/microsoft/ropen/3.4.4/lib64/R/lib/microsoft-r-cacert.pem since the certificate exists in that path for my case. And before that, I also uninstalled RCurl (since there is no package named curl in the first place so I assume RCurl still the same thing) and httr. But still, I failed to install package from GitHub.

> devtools::install_github('IRkernel/IRkernel')
Installation failed: error setting certificate verify locations:
  CAfile: microsoft-r-cacert.pem
  CApath: none

Any suggestion?

EDIT: Apparently it didn't work because before that I tried to edit Rprofile.site using this https://github.com/Microsoft/microsoft-r-open/issues/6#issuecomment-379533522 solution. After I undo that edit and then followed the solution provided by @jakekramer, now it works.

fanyang1997 commented 6 years ago

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

You can workaround 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")
bjungbogati commented 5 years ago

Go to your Renvironment location: /opt/microsoft/rclient/3.4.3/runtime/R/etc/Renviron

insert following line with sudo access: CURL_CA_BUNDLE=/opt/microsoft/rclient/3.4.3/runtime/R/lib/microsoft-r-cacert.pem

ShixiangWang commented 5 years ago
> file.edit('~/.Renviron')

then write:

CURL_CA_BUNDLE=/opt/microsoft/ropen/3.5.1/lib64/R/lib/microsoft-r-cacert.pem

This works for me.

ShawnMeng90s commented 5 years ago

don't have access to > file.edit('~/.Renviron')