Devtools: 'install_github' gives timeout reached error

Created on 14 Jul 2015  ·  10Comments  ·  Source: r-lib/devtools

install_github('hadley/readr', host = "api.github.com")
Downloading github repo hadley/readr@master
Error in curl::curl_fetch_memory(url, handle = handle) :
Timeout was reached
Is this due to proxy/firewall? I tried the solution mentioned here, but did not work
http://stackoverflow.com/questions/17783686/solution-how-to-install-github-when-there-is-a-proxy

Most helpful comment

Trying this option worked for me.

library(httr)
with_config(use_proxy(...), install_github(...))

OR

library(httr)
set_config(use_proxy(url = "*_", port = "_"))
devtools::install_github("username/packagename")

Thanks to @hadley

All 10 comments

I am having the same issue, cannot install any package using devtools.

@hadley Any ideas?

> devtools::install_github('rstudio/shinyapps')
Downloading github repo rstudio/shinyapps@master
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Couldn't connect to server

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.4 (Yosemite)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] devtools_1.8.0  httr_1.0.0.9000 RCurl_1.95-4.7  bitops_1.0-6   

loaded via a namespace (and not attached):
 [1] R6_2.1.0         magrittr_1.5     rversions_1.0.2  tools_3.2.1      rstudioapi_0.3.1
 [6] curl_0.9.1       Rcpp_0.12.0      memoise_0.2.1    xml2_0.1.1       stringi_0.5-5   
[11] git2r_0.10.1     stringr_1.0.0    digest_0.6.8 

You might be behind firewall, need to use proxy settings from 'httr' package. I could solve the issue using proxy settings. Please check if you can access github and then use proxy settings.

On Mac, by using options(download.file.method = "libcurl") it works for public packages.
But I am getting the same error for private packages on Github.

You'll need to do something like

library(httr)
with_config(use_proxy(...), install_github(...))

Hi,
I'm having a similar issue and I'm sure I'm not using a proxy (I don't know a formal test to this, but every other service in my computer that would require a proxy config is not having any issue). Other people are reporting similar cases (see http://stackoverflow.com/questions/38263920/unable-to-install-r-package-from-github).

I tried a clean uninstall - reinstall of everything from r-base to libcurl and the problem persists. I'm running Ubuntu Mate 16.04.

> session_info()
Session info -------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.2.3 (2015-12-10)
 system   x86_64, linux-gnu           
 ui       RStudio (0.99.903)          
 language en_US                       
 collate  en_US.UTF-8                 
 tz       America/Sao_Paulo           
 date     2016-07-31                  

Packages -----------------------------------------------------------------------------------------
 package  * version date       source        
 curl       1.1     2016-07-26 CRAN (R 3.2.3)
 devtools * 1.12.0  2016-06-24 CRAN (R 3.2.3)
 digest     0.6.9   2016-01-08 CRAN (R 3.2.3)
 git2r      0.15.0  2016-05-11 CRAN (R 3.2.3)
 httr     * 1.2.1   2016-07-03 CRAN (R 3.2.3)
 knitr      1.13    2016-05-09 cran (@1.13)  
 memoise    1.0.0   2016-01-29 CRAN (R 3.2.3)
 R6         2.1.2   2016-01-26 CRAN (R 3.2.3)
 withr      1.0.2   2016-06-20 CRAN (R 3.2.3)

There seems to be a problem with curl in Ubuntu 16.04. I am facing similar problem with devtools::install_github, and also with xml2::read_html. I am not behind a proxy or firewall.

> library(devtools)
> library(rvest)
Loading required package: xml2
> read_html('https://github.com/hadley/devtools/issues/877')
Error in open.connection(x, "rb") : Timeout was reached
> session_info()
Session info ---------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.1 (2016-06-21)
 system   x86_64, linux-gnu           
 ui       RStudio (99.9.9)            
 language en_IN:en                    
 collate  en_US.UTF-8                 
 tz       Asia/Calcutta               
 date     2016-08-13                  

Packages -------------------------------------------------------------------------------------------------------
 package  * version date       source        
 curl       1.1     2016-07-26 CRAN (R 3.3.1)
 devtools * 1.12.0  2016-06-24 CRAN (R 3.3.1)
 digest     0.6.10  2016-08-02 CRAN (R 3.3.1)
 httr       1.2.1   2016-07-03 CRAN (R 3.3.1)
 magrittr   1.5     2014-11-22 CRAN (R 3.3.0)
 memoise    1.0.0   2016-01-29 CRAN (R 3.3.0)
 R6         2.1.2   2016-01-26 CRAN (R 3.3.0)
 Rcpp       0.12.6  2016-07-19 CRAN (R 3.3.1)
 rvest    * 0.3.2   2016-06-17 CRAN (R 3.3.1)
 withr      1.0.2   2016-06-20 CRAN (R 3.3.0)
 xml2     * 1.0.0   2016-06-24 CRAN (R 3.3.1)

Edit: There is now a open issue posted related to this- https://github.com/jeroenooms/curl/issues/72

In my case it was solved by mannually changing the DNS server to an OpenDNS or Google's.

Trying this option worked for me.

library(httr)
with_config(use_proxy(...), install_github(...))

OR

library(httr)
set_config(use_proxy(url = "*_", port = "_"))
devtools::install_github("username/packagename")

Thanks to @hadley

It would be helpful to know what arguments to use for use_proxy. All the replies are very vague on this point.

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

Was this page helpful?
0 / 5 - 0 ratings