Feature #868

Updated by Sebastien Jacquot almost 5 years ago

R cannot access internet if there is a proxy during the "Check R packages" command. -> Rserve & R configuration

h3. Hypothesis1

R proxy configuration depends on the Operating System:
* Windows: R uses the "--internet2" option
* Mac OS X/Linux: R uses the "http_proxy" environment variable

- For Windows: the "--internet2" option can be added automatically. see: http://cran.r-project.org/bin/windows/base/rw-FAQ.html#The-Internet-download-functions-fail_002e
- For Mac OS X and Linux, we have to test the "http_proxy" R env variable is used

Currently R and RServe options are not configured by TXM StatEngine preferences.
(For runtime proxy options see also commands: setInternet2(use=TRUE) and Sys.setenv(http_proxy="http://user:password@proxy.example.com:8080/" ))
(We may also use .Rprofile system ? MD: I would rather not do this)

h3. Solution 0

Use .RProfile or .Renviron files to configure the R network.

h3. Solution 1

Match the R network configuration with the OS network configuration
Retrieve the OS proxy configuration: HOW TO (for each OS)

At TXM start up:
* Windows:
** run R with: R http_proxy="http_user:http_password@http_proxy:http_port"
** create the variable before running R: set http_proxy="http_user:http_password@http_proxy:http_port"
** or use the R command line: Sys.setenv(...). But it doesn't seem to work for this with Windows XP
* Linux/Mac:
** use a shell command as: export http_proxy="http_user:http_password@http_proxy:http_port"
** or use the R command line: Sys.setenv(http_proxy="http_user:http_password@http_proxy:http_port")

h3. Solution 2

Match the R network configuration with the RCP network configuration.
Retrieve the RCP proxy configuration: http://blog.vogella.com/2009/12/08/eclipse-rcp-proxy-preference/

At TXM start up: see Solution 1

Optionnaly, update R proxy when RCP preferences change:
* Windows: no good solution at this moment (actually one would be to restart R with: R http_proxy="http_user:http_password@http_proxy:http_port") (Sys.setenv() doesn't seems to work for this under Windows XP)
* Linux/Mac: call in R: Sys.setenv(http_proxy="http_user:http_password@http_proxy:http_port")

h3. Solution 3

Use OS download method instead of the R native download method. The OS download method uses the OS network configuration rather than the R network configuration.

* in R :
** set the "download.file.method" R option
** or use the "method" parameter of the "install.packages" function : install.packages(.., method = "wget")
* The download method depends on the OS :
** Linux: wget
** Mac OS X : curl
** Windows : no need to install packages

NOTE: Linux "export" and Windows "set" command create the variable in the local session scope, they are not permanently stored.

h3. Validation tests

* run TXM with a proxy connection
* run TBD: in a groovy script or .R file containing

<pre>
install.packages("textometry", dependencies=TRUE, repos="http://cran.rstudio.com/");
</pre>
install an R packages

Back