R - when trying to install package: InternetOpenUrl failed

。_饼干妹妹 提交于 2019-11-28 07:36:35

The problem might be a failure to handle https properly by the underlying method used by R for downloading files. This can be verified by trying

fname <- tempfile()
download.file("https://cran.uni-muenster.de/", destfile=fname)
file.remove(fname)

If that does not work but replacing https with http does, this most likely means that the method used by R's download.file cannot deal with https at all or fails verifying SSL certificates.

You can try

  • using regular http mirrors instead of https
  • update your CA certificate bundle to allow proper certificate validation
  • setting the default download method to "libcurl" and see if that helps:

    options(download.file.method="libcurl")
    

IE 10 --> uncheck File-->Work Offline option. IE 11 --> click on "Working Offline" in the Status Bar and it will change to "Working Online".

I faced a similar problem while installing R packages on win8. It may happen that your "Internet Explorer" browser has connection problems. Change your default browser to "Internet Explorer" and make sure the browser handles http queries without any issues.

I faced a similar problem.

The issue was that the default CRAN server was down temporarily, which is rather unusual!

Worked around the issue by finding a nearby CRAN mirror, then updating the defaults:

options(repos = c(CRAN = "https://cran.ma.imperial.ac.uk/", 
                  CRANextra = "https://mirrors.ebi.ac.uk/CRAN/"))

Then this worked fine:

install.packages("ggplot2")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!