Feature #868

Updated by Matthieu Decorde almost 6 years ago

R cannot access internet if there is a proxy proxy:
*
during TXM installation (Linux + Mac OS X) -> R configuration
* during
the "Check R packages" command. -> Rserve & R configuration

h3. Hypothesis1

*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 *Setup: solution1* :
* Embed R in all setups and provide the exact libraries for this version of R -> solve R packages installation but not "Check R packages" command

*Setup: solution2*:
* Windows: run R with "--internet2" argument
* Debian/Ubuntu: R automatically uses the "http_proxy" which is normally generated by the network manager. It means there is nothing more to do than running R et install the packages as with direct connection. But we may still test if "http_proxy" exists and do "something" if the variable doesn't exist because the tests have only been made on Ubuntu.
* Mac OS X Mavericks: Network manager does not create "http_proxy" environment variable so we need to create it once. The proxies settings can be retrieved using "networksetup -getwebproxy <Network service>" then we can create the variable before running R with "export"
or .Renviron files in R with Sys.setenv().

[SJ] It appears there is no easy cross-platform solution therefore the solution 1 seems
to configure be the better one.

For TXM RCP we need to define if we want that
R network. uses the operating system proxy/network configuration or the Eclipse RCP proxy/network configuration.
[SJ] I think the better feature would be to match the R network configuration to the Eclipse RCP network configuration. But it may be complex to implement, for example, changing the "Networking configuration" in RCP would run some R command as Sys.setenv("http_proxy=http://proxy.xxxxx.com").


h3. Solution *TXM RCP: solution 1* :
Do not match the RCP configuration but the OS configuration
* Windows: see Setup: solution
1
* Debian/Ubuntu: see Setup: solution 1
* Mac OS X Mavericks: see Setup: solution 1


*TXM RCP: solution 2* :
Match the R network configuration with the OS RCP network configuration
Retrieve the OS * add some proxy configuration: HOW TO (for each OS) properties in TBX (http_proxy, http_port, http_user, http_password)
* at RCP startup load these preferences into TBX preferences before running R/RServe


At TXM start up: R first run:
* Windows:
**
run R with: R http_proxy="http_user:http_password@http_proxy:http_port"
**
or 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
http_proxy="http_user:http_password@http_proxy:http_port". (Sys.setenv() doesn't seem seems to work for this with under Windows XP 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: in R: Sys.setenv(http_proxy="http_user:http_password@http_proxy:http_port")

h3. Solution 2

Match the R
At RCP 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
*Setup/TXM RCP: solution 3* :
* see
R native download method. The OS download method uses options download.file.method = "wget" or "lynx" or install.packages(method = "wget"). wget seems to use the OS network configuration rather than the R network configuration.

* in R :

** set the "download.file.method" R option The problem is under Mac OS X and Windows "wget" is not installed by default.
** 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

*Setup/TXM RCP: solution 4* :
* use .RProfile or .Renviron files to configure the R network


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

Back