Can't install packages from any mirror in RStudio; works in R

758 views Asked by At

I can install any package from the R executable. But from RStudio, I get

Warning in install.packages :
  unable to access index for repository http://cran.rstudio.com/src/contrib:
  cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
  unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
  cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'

Yes, these are warnings not errors, but nothing is installed anyway. I can change the repository e.g. with

install.packages('qgam', dependencies=TRUE, repos='http://cran.rstudio.com/')

or in the RStudio settings, but nothing makes any difference.

I have uninstalled R and Rstudio, deleted the Rstudio-desktop folder, deleted all .Renviron files, then reinstalled R and Rstudio. I have checked and unchecked "Use internet explorer library" and everything else I can find.

.libPaths() gives "C:/Users/User/Documents/R/win-library/3.4" "C:/Program Files/R/R-3.4.3/library" which seems fine, only the first is writeable to Rstudio, but that should be OK?

There are no firewalls in operation.

This is driving me nuts.

R and Rstudio are up to date, i.e. R is 3.4.3, Rstudio is 1.1.423

1

There are 1 answers

0
Steve Powell On

Fixed it. It was Bitdefender 2018 - not a problem in 2017. I had to add permissions for R and RStudio ("protection" screen, click Features, click the settings gear-wheel in the Firewall section, click "Add rule". And then same again for "Application Access" in the "safe files" section of the Features screen.