josevnz
josevnz

Reputation: 55

How to check if R network proxy settings work?

I have no practical experience with the R language itself but I've been tasked to install it behind a corporate firewall. Basic installation seems sane but when my user tries to install a custom library like this:

install.packages("ggplot2")
Installing package into '/home/myuser/rlibs'
(as 'lib' is unspecified)
Warning: unable to access index for repository http://cran.us.r-project.org/src/contrib
Warning message:
package 'ggplot2' is not available (for R version 3.1.2) 

I see no progress and eventually nothing gets downloaded into my custom directory. My question is, there is a way to add verbosity to R to see if the network proxy setting are working correctly (I can get files with wget without problems under the same account)?

More details about my installation

Contents of my ~/.Renviron

R_LIBS=/home/myuser/rlibs

Contents of ~/.Rprofile

r <- getOption("repos") # hard code the US repo for CRAN
r["CRAN"] <- "http://cran.us.r-project.org"
options(repos = r)
rm(r)

Http proxy is set (like http_proxy=XXXXproxy.XXXX.com. I can see it if I do Sys.getenv("http_proxy") from inside the R prompt)

Upvotes: 2

Views: 3318

Answers (2)

josevnz
josevnz

Reputation: 55

I figured out the issue, the problem was the format of the http_proxy variable.

Incorrect: http_proxy="servername"

Correct: http_proxy="http://servername:80"

Thanks to all who took the time to check this issue.

Upvotes: 1

RUser
RUser

Reputation: 598

Try setting this in your script as well, e.g.

Sys.setenv(http_proxy="http://servername:80")

Sometimes I have to do this as well for some API's to work, even though it is set in Rprofile.

Upvotes: 3

Related Questions