18

From today, every time I try to install a new package on R (3.4.1) with Rstudio 1.0.143 I receive this error message:

Warning: unable to access index for repository https://www.stats.ox.ac.uk/pub/RWin/src/contrib: cannot open URL 'https://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'

I change the CRAN mirror in Global options>packages but it still shows this error. The packages have started downloading from a different server than stats.ox.ac.uk but there is huge delay while R tries to connect to stats.ox.ac.uk. Is this a global problem, or just happening to me? If global, is there a workaround to stop this serror message from showing?

Thanks. Deep (Dwaipayan Adhya)

  • If you run `getOption("repos")` does that repository show up under CRANExtras? – Dason Jul 14 '17 at 17:17
  • Yes it does.> getOption("repos") CRAN CRANextra "https://mirrors.ebi.ac.uk/CRAN/" "http://www.stats.ox.ac.uk/pub/RWin" attr(,"RStudio") [1] TRUE – Dwaipayan Adhya Deep Jul 14 '17 at 21:12
  • See following bug report, this is a few months old: https://support.rstudio.com/hc/en-us/community/posts/115007914708-Even-when-setting-another-repo-RStudio-post-warnings-about-stats-ox-ac-uk – Joris Meys Jul 15 '17 at 14:33
  • I don't think there should be a problem in downloading packages. this warning is just a bug. refer to this [question](https://stackoverflow.com/questions/45115975/problems-with-installation-r-packages/45116122#comment77203686_45116122) – samkart Jul 15 '17 at 14:35
  • @JouniHelske Thanks for the update. Much appreciated. – Dwaipayan Adhya Deep Jul 16 '17 at 10:42
  • @JouniHelske I no longer think temporary maintenance is a valid cause. This problem has been happening with this specific repo on and off every few weeks for over a year. Either that repo is incredibly unstable on an on-going basis or there's some other underlying problem. Incidentally I always set my mirror to the global cloud, but I still get this error when (for instance) re-installing `data.table` – Hack-R Apr 24 '18 at 19:29
  • Work around is to go to Rprofile in the "R-3.5.0\etc" folder and update the CRAN manually. – Ajay B Oct 19 '18 at 16:50
  • 1
    I am getting these errors: `Warning: unable to access index for repository https://cran.rstudio.com/src/contrib: cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES' Warning: 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'` and it actually prevents me from installing packages. I can install packages like normal on a different computer (work desktop with same internet). All the fixes mentioned here do not work. . Any ideas? – Tom Nov 14 '18 at 08:10

1 Answers1

20

I'm guessing this is a temporary issue (but an annoying one nonetheless and one that I dealt with this morning). That repository is most likely an additional one set alongside the "CRAN" repository as "CRANextra". The solution is to redefine the repos option to not include CRANextra. You can use the setRepositories() command and unselect "CRANextra". Alternatively you could just run the following code which will remove all repositories except the "CRAN" selection.

options(repos = getOption("repos")["CRAN"])
Dason
  • 60,663
  • 9
  • 131
  • 148
  • 2
    This is not a permanent solution. If you start a new session after running options(repos = getOption("repos")["CRAN"]), the CRANextra is reset.. even the setRepositories() option is not a permanent one. – Dwaipayan Adhya Deep Jul 14 '17 at 22:19
  • I never said it was. I'm assuming the issue with the repository is temporary. But how to run code at the beginning of every session automatically is something one can look up. But it boils down to using a .Rprofile – Dason Jul 14 '17 at 22:40
  • Annoying indeed (and frustrating, I was in the middle of something). Hope this gets fixed soon. Thanks for your suggestions. Some of the other CRAN mirrors are also affected now. – Dwaipayan Adhya Deep Jul 14 '17 at 22:45
  • 1
    I had this exact same problem running under Windows 10. The above fix works perfectly. Interestingly, my other computer, running Ubuntu but the same versions of R and RStudio, did not have this problem. I add my hopes that this issue is fixed soon. But at least I can update my packages now. – Larry Hunsicker Jul 15 '17 at 14:23
  • 2
    @LarryHunsicker That's because the extra repo that RStudio adds (and did so for quite a while now) is only for Windows. See also https://support.rstudio.com/hc/en-us/community/posts/115007914708-Even-when-setting-another-repo-RStudio-post-warnings-about-stats-ox-ac-uk – Joris Meys Jul 15 '17 at 14:32
  • @JorisMeys Are you sure this has anything to do with RStudio? On my windows machine the CRANextra repo is added to the repos option even if I'm not using RStudio... – Dason Jul 17 '17 at 14:06
  • @Dason You're absolutely right actually. It's a repo provided by Brian Ripley apparently, and I wasn't aware of it either. See the last paragraph of this R FAQ: http://stat.ethz.ch/CRAN/doc/FAQ/R-FAQ.html#Add_002don-packages-from-CRAN – Joris Meys Jul 17 '17 at 15:49
  • @JorisMeys Yeah other than when it's down for maintenance it's quite helpful for windows users. I don't know when it became part of the defaults for Windows but I know I've added it to my repos in the past to make life easier. – Dason Jul 17 '17 at 15:50
  • @Hack-R What is your output from `getOption("repos")` – Dason Apr 24 '18 at 20:35