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?