简体   繁体   中英

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

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 eg 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, ie R is 3.4.3, Rstudio is 1.1.423

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM