noaa-fisheries-integrated-toolbox / resources

Source code for the FIT software development resources
https://noaa-fisheries-integrated-toolbox.github.io/resources
The Unlicense
0 stars 5 forks source link

document github api issue and fix for noaa windows computers #63

Open k-doering-NOAA opened 3 months ago

k-doering-NOAA commented 3 months ago

A few weeks ago, NOAA windows computers ran into issues with access to the github api (see https://github.com/NOAA-EDAB/demos/issues/10)

This affects almost everyone within NOAA, so it's worth documenting the fix somewhere.

The fix:

TLDR:

Run write('CURL_SSL_BACKEND=openssl', file = "~/.Renviron", append = TRUE) in your R session. Restart your R session Run curl::curl_version()$ssl_version and confirm the return is OpenSSL/1.1.1m (Schannel) (note the numbers may be different) Try remotes::install_github() (e.g., devtools::install_github('tidyverse/dplyr') ) . It should work and continue to work in future R sessions. Full details: This curl R package vignette explains the 2 different backends for curl for windows users and how to switch between them. My computer defaulted to secure channel (called "Schannel"), which I discovered by calling curl::curl_version()$ssl_version

I then wrote to my .Renviron file to default to using SSL instead: write('CURL_SSL_BACKEND=openssl', file = "~/.Renviron", append = TRUE)

And then restarted my r session. I double-checked the backend being used by calling curl::curl_version()$ssl_version The return was "OpenSSL/1.1.1m (Schannel)", confirming OpenSSL was being used (the one not in parentheses). If you have a different version of OpenSSL, the numbers may be different for you in the return.

From there, I was able to use devtools::install_github(), and utils::download.file and jsonlite::fromJSON to download files/info from github.

I think the .Renviron file will mean the backend specified will be set as the backend to use the first time curl is used in a session, so running write('CURL_SSL_BACKEND=openssl', file = "~/.Renviron", append = TRUE) one time per computer should fix the issue.

If you wanted to switch back to the old backend, the line in the .Renviron file could be removed.

k-doering-NOAA commented 6 days ago

in this doc for now: https://docs.google.com/document/d/1vPFWBK8TrGjdXrrAlXhcq5f1B7Ap3ppnitnDIUMaS6g/edit