0

I have had recent issues, as have others in my company, trying to install packages behind our firewall. Now, I have a partial solution, but do not understand what's going on.

I get a message like this, every time I try to install a package:

> install.packages("ggthemes")
Installing package into ‘C:/Users/l2863/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file 'C:/PROGRA~1/R/R-43~1.0/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cran.case.edu/src/contrib:
  cannot open URL 'https://cran.case.edu/src/contrib/PACKAGES'
Warning: unable to access index for repository https://cran.case.edu/bin/windows/contrib/4.3:
  cannot open URL 'https://cran.case.edu/bin/windows/contrib/4.3/PACKAGES'
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
  URL 'https://cran.r-project.org/CRAN_mirrors.csv': status was 'SSL connect error'
2: package ‘ggthemes’ is not available for this version of R
A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages 

It's the same whether I use the base R Gui or Rstudio. The selection of mirrors also doesn't matter. I can access the mirrors just fine with a browser.

But if I use install.packages("some_package", method="wininet"), I still get warnings, but the package is installed:

> install.packages("ggthemes", method = "wininet")
Installing package into ‘C:/Users/l2863/AppData/Local/R/win-library/4.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.case.edu/bin/windows/contrib/4.3/ggthemes_4.2.4.zip'
Content type 'application/zip' length 443696 bytes (433 KB)
downloaded 433 KB

package ‘ggthemes’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
        C:\Users\l2863\AppData\Local\Temp\Rtmp6huydw\downloaded_packages
Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
  the 'wininet' method is deprecated for http:// and https:// URLs

Before discovering this method, thanks to my IT support, we tried adding a .Renviron file with web proxy information and Sys.setenv(... to accomplish the same thing, but nothing seems effective except for using the wininet method. The limitation is that this does not allow the Rstudio check for update packages, and if the method goes away (because it's currently deprecated), then I don't know what we can do. I have tried other methods in install.packages and none of them work.

Any suggestions?

markhogue
  • 1,056
  • 1
  • 6
  • 16
  • So how exactly did you configure your `.Renviron` file? Do you know your proxy server configuration information? Did you restart R after changing the `.Renviron` (the contents are only read at startup)? It's very hard to guess what's going on with out specific details about your particular network. – MrFlick May 16 '23 at 19:33
  • Yes, thanks, @MrFlick. Here's our `.Renviron`, slightly redacted: `options(internet.info = 0) http_proxy=http://webgatenew.xxx.xxx:8080/ https_proxy=http://webgatenew.xxxs.xxx:8080/ http_proxy_user=ask https_proxy_user=ask` Also, we put similar information in a command we ran right away: `Sys.setenv(http_proxy="http://webgatenew.xxx.xxx:8080/ http_proxy_user=ask") Sys.setenv(https_proxy="http://webgatenew.xxx.xxx:8080/ https_proxy_user=ask")`. – markhogue May 16 '23 at 20:22

1 Answers1

0

I'm using R-4.3.1 and work in a corporate network with SSL intercept. I encountered this 'SSL connect error' and also reverted to using install.packages("some_package", method="wininet"). While wininet works, it is a bit slow. Here's my new workaround:

  • Removed the wininet workaround to revert back to the default libcurl
  • Added the following line to my .Rprofile
    • Sys.setenv(R_LIBCURL_SSL_REVOKE_BEST_EFFORT=TRUE)

I learnt this via the following references:

starball
  • 20,030
  • 7
  • 43
  • 238
Kevin Woo
  • 101
  • 1
  • 4
  • That did not work for me. I tried entering in the console, `Sys.setenv(R_LIBCURL_SSL_REVOKE_BEST_EFFORT=TRUE)`. Also, from the link provided, tried `options(download.file.method="curl", download.file.extra="--ssl-revoke-best-effort")`. In both cases, I could not install packages without using the form, `install.packages("foo", method="wininet")` – markhogue Jul 17 '23 at 14:32