Thursday, March 10, 2016

R: InternetOpenUrl failed: 'The date in the certificate is invalid or has expired'

Today the two-year-old TLS security certificate for cran.r-project.org expired, so suddenly in R you are getting errors running install.packages or update.packages.

The error looks like this:

> update.packages()
--- Please select a CRAN mirror for use in this session ---
Error in download.file(url, destfile = f, quiet = TRUE) : 
  cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
  InternetOpenUrl failed: 'The date in the certificate is invalid or has expired'

The workaround is simple: choose another repository! For example:

options("repos"="https://cran.revolutionanalytics.com/")
update.packages(ask=T)
install.packages('gbm')

This is bad timing with the release of R 3.2.4 today. If you need to download R using your web browser, visit a mirror, such as cran.revolutionanalytics.com.

Tested with R 3.2.3 on Windows 7 and Windows Server 2012.

3 comments:

  1. This appears to have stopped working again? We installed 3.3.3 on a new workstation and am getting an identical error.

    ReplyDelete
  2. Hi, this seems to be happening again - we installed 3.3.3 on a workstation and are getting an identical error. Tried selecting a mirror as per the example, but no go. Even the http mirrors produce the same error.

    Please advise.

    ReplyDelete
  3. Right now the host CRAN.r-project.org has a valid certificate.

    Make sure your system clock is correct.

    Also check that the DNS is pulling up the correct site. Assuming you are having trouble with cran.r-project.org, you can check by visiting it in a web browser. (The DNS could be wrong for various reasons including wifi captive portal or DNS-based security like OpenDNS.)

    ReplyDelete

Get HTML of iframes in Microsoft Playwright

Playwright is a powerful framework for web testing and automation. This article demonstrates how to extract the HTML content of child IFRAME...