RStudio Proxy Configuration on Windows
Asked Answered
R

4

6

This question has been asked in: Configure proxy on Rstudio. However, it was never resolved.

I am a user of RStudio 0.99.486 version and R 3.2.2 version. I have tried 2 ways to configure proxy settings in the office without success after reading several suggestions:

FIRST TRY: Type in Rstudio as first line: Sys.setenv(http_proxy="http://user_name:[email protected]_domain.es:8080/")

Go to: -Tools, -Global Options, -Packages, and unmark option:

"Use internet library/proxy for HTTP"

I also unmarked the option: "Use secure download method for HTTP".

Besides, I right-clicked on the R x64 3.2.2 icon of the desktop and added after 1 space in the "Target" camp:

http_proxy=http://user_name:[email protected]_domain.es:8080/

It did not work as I received the message:

Warning in install.packages : cannot open: HTTP status was '407 Proxy Authentication Required'

SECOND TRY: Create a notepad file with the name:

.Renviron

Saved it in: "C:\Users\username\Documents".

The file contains inside the following 2 lines:

http_proxy=http://proxy.company_domain.es/
http_proxy_user=user_name:password

When I try installing a package I receive:

"Warning in install.packages : unable to connect to 'cran.rstudio.com' on port 80. Unable to access index for repository http://cran.rstudio.com/src/contrib"

After running code line: R.home() My R_HOME route is:

"C:/Program Files/R/R-32~1.2"

I appreciate before-hand for your advice and help.

Rotow answered 21/10, 2015 at 14:47 Comment(0)
Y
5

Thank you for your question. It helped me to resolve my issue. I had to unmark the option to use the settings from the Internet Explorer and restart.

Maybe your .Renviron does not contain the proxy port, you have to write

http_proxy=http://proxy.company_domain.es:8080/
http_proxy_user=user_name:password

If you specify

http_proxy_user=ask

it should prompt you for user name and password - then you know that the file is read

Yardley answered 17/11, 2015 at 12:20 Comment(0)
R
1

I struggled with this when I initially started working behind a proxy. Here's what I believe is to be the solution. Disclaimer, I am working on a Windows 7 Workstation.

Even though when you read through the documentation, R suggests that .Renviron and .Rprofile should be in R.home(), that is not the case for Windows.

By default (I believe), the R.home() for Windows is actually the Documents folder for your user. You can check that with

path.expand("~/")

which defaults to "My Documents" directory.

Therefore, do place the .Renviron file with the content you already have, disable the Internet Explorer option in RStudio, and make sure you place the file in "My Documents."

Hope it helps!

Rella answered 4/4, 2016 at 14:49 Comment(0)
S
1

I also nearly gave up on this problem until I found this simple solution (R3.3.1):

  1. specify the system environment variables (in Windows Advanced System Settings add the variables http_proxy and https_proxy and set it to http://user_name:[email protected]_domain.es:8080/ with your specific settings)

  2. in the R console type

update.packages(ask='graphics',method="libcurl",checkBuilt=TRUE)

Snubnosed answered 5/9, 2016 at 13:53 Comment(0)
C
0

I reached this question today (2024 Apr) when trying to assist a colleague in a behind-corporate-proxy-without-password environment. I think it deserves an updated answer after so many years.

  1. The ".Renviron" file seems to be the right place to put an environment configuration for R processes.
  2. R searches the file in the following order: (i) Sys.getenv("R_ENVIRON_USER"), (ii) ./.Renviron, and (iii) ~/.Renviron. As documented in https://cran.r-project.org/web/packages/startup/vignettes/startup-intro.html.
  3. As an example, these are the lines I have in my file:
    http_proxy=http://proxy.mycompany.dom.cn:3128
    https_proxy=http://proxy.mycompany.dom.cn:3128
    ftp_proxy=http://proxy.mycompany.dom.cn:3128
    no_proxy=*.mycompany.dom.cn;*.companyclodu.dom.cn

I hope it helps.

Crinose answered 24/4 at 19:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.