Proxy Blues

personal
R
Python
Author

Mitsuo Shiota

Published

January 21, 2021

They Say It Will Work

It Won’t Work

Don’t Be Noisy

Hate Proxy

I am writing this post from my Company PC (Panasonic notebook with Windows 10), which connects to the Internet via a proxy server with authentication. I am required to change my password every 3 month. I got the mail to do so today, so I just changed my password.

Then I must modify several setting files for data science tools, like R, Git, conda, and Jupyter Notebook. I will show you how I modify below.

Suppose my ID is MYID, my password is MYPW, and the proxy server (domain:port number, like xxx.xxx.xxx:xx) is PROXY. In my case, as the proxy server is set by .pac file, I have to ask IT Department to get the proxy server.

.Renviron in Documents

Don’t forget to URL encode MYPW.

# Proxy setting
http_proxy=http://MYID:MYPW@PROXY

https_proxy=http://MYID:MYPW@PROXY

.Rprofile in Documents

I have to set download.file.method as “libcurl”.

# Start-up options
options(internet.info = 0)

options(download.file.method = "libcurl")

.bash_profile in (a kind of) Home (in my case, one stage upper of Documents)

Don’ forget to escape special characters in MYPW, if any.

# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc

CONNECT_USER=MYID

CONNECT_PASSWORD=MYPW

export CONNECT_USER CONNECT_PASSWORD

.gitconfig in Home

URL encode MYPW.

[http]
    proxy = http://MYID:MYPW@PROXY
[https]
    proxy = http://MYID:MYPW@PROXY

.condarc in Home

URL encode MYPW.

channels:
  - defaults

proxy_servers:
  http: http://MYID:MYPW@PROXY
  https: http://MYID:MYPW@PROXY

ssl_verify: false
report_errors: false

00-startup.py in startup in profile_default in .ipython in Home

URL encode MYPW.

os.environ['HTTP_PROXY'] = "http://MYID:MYPW@PROXY" os.environ['HTTPS_PROXY'] = "http://MYID:MYPW@PROXY"

Is everything OK? Unfortunately no. In RStudio, Git Pull or Push button never works for me. I go around this issue by typing git commands in Tools > Shell. I just hate proxy.