Canno't install any package (from url or from archive)

Hello,

Having an issue many of us seems to have had, but can't fix it so far.
I can't install any package in R (through RStudio), beeing from any url (tried different repositories : Global or France - Lyon 1 repository) or from a downloaded tar.gz.

This is what I get if I try to install from an url :

Notes :

  • I'm using R version 4.4.1 and RStudio 2024.04.2-764

  • I'm using my office's network, which is a mess of proxies, firewalls, on a computer with restrictions from the admin (I managed to install R and RStudio without beeing stopped by a request for an admin password, surprisingly)

Does that URL work from your browser?

Can you try using another CRAN mirror?

Yes I have access to the url from my web browser, and I can download .tar.gz packages from there.
I tried with ETH Zurich server and got the following error message after several minutes :

> install.packages("data.table")
Warning in install.packages :
  unable to access index for repository http://stat.ethz.ch/CRAN/src/contrib:
  cannot open URL 'http://stat.ethz.ch/CRAN/src/contrib/PACKAGES'
Warning in install.packages :
  package ‘data.table’ 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
Warning in install.packages :
  unable to access index for repository http://stat.ethz.ch/CRAN/bin/windows/contrib/4.4:
  cannot open URL 'http://stat.ethz.ch/CRAN/bin/windows/contrib/4.4/PACKAGES'

Out of curiosity, why are you using http mirrors, instead of a safe https mirror? E.g. can you try

options(repos = c(CRAN = "https://cran.rstudio.com"))

Also, can you try this from your R console?

download.file("https://cran.rstudio.com/src/contrib/PACKAGES.gz", tempfile())

Oh, I saw on another topic on this forum that unchecking "Use secure download method for HTTP" in the "package" section in my "Global Options" might solve the problem. That's probably the reason ?

I tried your link directly in the R console, it gives me the same output. I think it's a connexion/firewall/something like this issue

> download.file("https://cran.rstudio.com/src/contrib/PACKAGES.gz", tempfile())
trying URL 'https://cran.rstudio.com/src/contrib/PACKAGES.gz'
Error in download.file("https://cran.rstudio.com/src/contrib/PACKAGES.gz",  : 
  cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES.gz'
In addition: Warning message:
In download.file("https://cran.rstudio.com/src/contrib/PACKAGES.gz",  :
  URL 'https://cran.rstudio.com/src/contrib/PACKAGES.gz': Timeout of 60 seconds was reached

Just to make sure that the timeout is not real, but only a symptom , can you set a higher timeout, e.g. this is 10 minutes:

options(timeout = 600)

and then try the download.file() again?

This this fails as well (after 10 minutes), then it is indeed a firewall issue.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.