Skip to content

download package on windows behind proxy does not work (easily) #45

@cderv

Description

@cderv

Hi,

Trying to solve this issue with devtools::install_github (r-lib/devtools#1403), I found that remotes package is probably the next thing for some functions in devtools. So I tried it.

However, I encountered an issue as I am on windows and behind a proxy. Trying to install a github package throws an error

remotes::install_github("hadley/lubridate")
#> Error in utils::download.file(url, path, method = download_method(), quiet = quiet,  :  
#> cannot download all files

and even crash R session if proxy is not configured correctly.

This issue is clearly proxy-related.

below is what I have done to make it work. See at the end for Suggestions

About proxy configuration

Proxy configuration is not the easy thing but I managed to deal with it most of the time. Configuring R to Use an HTTP or HTTPS Proxy by RStudio support team helps.

However, the easiest way on windows is to rely on wininet methods which is the default for download.file. see in windows help:

If method = "auto" is chosen (the default), on Windows the "wininet" method is used apart from for ftps:// URLs where "libcurl" is tried. The "wininet" method uses the WinINet functions (part of the OS).

wininet deals with proxy using the 'Internet Option' of the system. And it is used even if libcurl is available (capabilities("libcurl") is TRUE)

In remotes, by default remotes:::download calls remotes:::download_method in which the default is libcurl if it is available. Then, if not, it is wininet

At first, default behavior threw an error. With some efforts I manage to make it work by configuring proxy differently.

  • The way describe in Configuring R to Use an HTTP or HTTPS Proxy does not work anymore as it is correct for internal only.
  • For libcurl, the form to use is http[s]://[user:password@]machine[:port]. Downloading part of remotes package is now working correctly.
  • Forhttr package, I uses set_config and use_proxy to make it work. (Needed for devtools then as it is working with httr) but I think the http_proxy environnement variable is also working

Suggestion

At the end, I found how to deal with the issue. However, I think it could be useful to clarify all this about proxy configuration

  • By making wininet the default on windows before testing capabilities("libcurl") in remotes:::download_method
  • If libcurl stays the default, by adding some informations in a vignette or in help file to help those behind a proxy. And maybe try to prevent errors or crashes.

What do you think of all this ? I willing to help if you interested as I planned to write something about all this configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions