2

I am having trouble updating and installing R packages. I was able to do this until very recently, but suddenly I am getting the following error message when I try to connect to the CRAN mirror:

*--- 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-33~1.1/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
  cannot open URL 'https://cloud.r-project.org/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'
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) : 
  no packages were specified
   In addition: Warning message:
   In download.file(url, destfile = f, quiet = TRUE) :
      InternetOpenUrl failed: ''*
  • I have tried to install packages using both base R and RStudio but neither works.
  • I have checked my firewall/proxy settings and they are fine.
  • I've opened both R and RStudio as administrator but it did not work
  • I checked that the entire R folder and all subfolders in Program Files are writable.
  • I am currently using R i386 3.3.1 but have tried to install packages in R 3.2.5 with the same results.
  • I'm currently using Windows 7.

Can anyone suggest alternative solutions? I have no idea what to do next.

Updated to include sessionInfo() output:

R version 3.3.1 (2016-06-21)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_South Africa.1252  LC_CTYPE=English_South Africa.1252   
[3] LC_MONETARY=English_South Africa.1252 LC_NUMERIC=C                         
[5] LC_TIME=English_South Africa.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_3.3.1
  • What does `library(RCurl); url.exists("google.com")` return? – Roland Sep 09 '16 at 07:26
  • > library(RCurl); url.exists("google.com") return the following: _Error in library(RCurl) : there is no package called ‘RCurl’_ – Christine Kraamwinkel Sep 09 '16 at 07:40
  • Obviously you need to install that package first ... and you can't. My bad. Can you try to send a ping request? http://stackoverflow.com/a/7013503/1412059 – Roland Sep 09 '16 at 07:41
  • I tried that and the output was _"True"_ This is what I typed: > ping <- function(x, stderr = FALSE, stdout = FALSE, ...){ + pingvec <- system2("ping", x, + stderr = FALSE, + stdout = FALSE,...) + if (pingvec == 0) TRUE else FALSE + } > ping("google.com") [1] TRUE – Christine Kraamwinkel Sep 09 '16 at 07:58
  • 1
    Try using an `http://` mirror, instead of `https://`. For example: `options(repos = c(CRAN = "http://cloud.r-project.org")); available.packages()`. – Andrie Sep 09 '16 at 08:06
  • Update your post with `sessionInfo()`, maybe irrelevant, but which packages are you trying to install, and can you add code you used for installation? Also, [here is good list](http://stackoverflow.com/questions/25721884) of problems with installation. – zx8754 Sep 09 '16 at 08:07
  • @Andrie Tried using the code you suggested. Got the following warning: `Warning: unable to access index for repository http://cloud.r-project.org/src/contrib: cannot open URL 'http://cloud.r-project.org/src/contrib/PACKAGES' Package Version Priority Depends Imports LinkingTo Suggests Enhances License License_is_FOSS License_restricts_use OS_type Archs MD5sum NeedsCompilation File Repository` – Christine Kraamwinkel Sep 09 '16 at 08:09
  • @Andrie That was my first idea, but `cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'` indicates that there seems to be a problem with accessing http mirrors too. I suspect the problem is a proxy setup. – Roland Sep 09 '16 at 08:10
  • What is the result of: `contrib.url(getOption("repos"))`? And also `getOption("pkgType")` ? There is something suspicious about your setup. You seem to downloading source packages, not windows binaries. – Andrie Sep 09 '16 at 08:13
  • 2
    @zx8754 I have updated my post with the requested information. I am trying to install the package 'lgcp'. – Christine Kraamwinkel Sep 09 '16 at 08:14
  • @Andrie Results as follows: `> contrib.url(getOption("repos")) [1] "http://cloud.r-project.org/src/contrib"` and `> getOption("pkgType") [1] "both"` – Christine Kraamwinkel Sep 09 '16 at 08:16
  • I'm sorry but I have run out of ideas. Good luck. – Andrie Sep 09 '16 at 08:24
  • In Rstudio go the the preferences and navigate to packages, what does it say after CRAN Mirror (note I'm on a mac so the workflow will may be slightly different)? – Cyrus Mohammadian Sep 09 '16 at 08:43
  • This is really a shot in the dark, but are you using RStudio Install feature, or are you calling it from the console like `install.packages("package_name")`? If you did `install.packages('package_name', dependencies=TRUE, repos='http://cran.rstudio.com/')` what would it do? It [worked before for somebody](http://stackoverflow.com/a/33283585/2416535). – jakub Sep 09 '16 at 08:50
  • would you please try to install this package in R (not RStudio). same command. Works sometime. – abhiieor Sep 09 '16 at 09:00
  • @CyrusMohammadian No preferences option, I assume _Global Options_ is equivalent? Current CRAN Mirror is _Global (CDN) - RStudio_. Packages pane and secure downloads are enabled (also tried with secure downloads disabled). The _Use Internet Explorer library/proxy for HTTP_ option is disabled. – Christine Kraamwinkel Sep 09 '16 at 09:04
  • @jakub Tried installing in RStudio and directly from the console in base R - result to console call: `Installing package into ‘C:/Users/User/Documents/R/win-library/3.3’ (as ‘lib’ is unspecified) Warning: unable to access index for repository http://cran.rstudio.com/src/contrib: cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES' Warning: unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.3: cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.3/PACKAGES' Warning message: package ‘lgcp’ is not available (for R version 3.3.1)` – Christine Kraamwinkel Sep 09 '16 at 09:09
  • Can you install the binary zip packages? Download from CRAN and install from zip. Not a long term solution, but will get you there now. – NJBurgo Sep 09 '16 at 09:20
  • @NJBurgo I was unable to do this before but I can now again install from the binary packages. No idea why it is suddenly working! Still unable to install from the repository. – Christine Kraamwinkel Sep 09 '16 at 09:24
  • Interesting. Does the binary package install all its dependencies? Doesn't *that* fail when they need to be downloaded? – jakub Sep 09 '16 at 09:26
  • @jakub No, the dependencies did not install. I had to download their binary packages manually and install them one by one. No error messages while installing, when I tried to load the library I was told which packages were missing. – Christine Kraamwinkel Sep 09 '16 at 09:29

0 Answers0