Overriding default proxy setup in Julia for Windows

I am a Mac user, but need to test Julia on Windows for my work at the job. During pkg> add PyCall, I get the following error message during the build procedure (reproduced by pkg> build PyCall):

pkg> build PyCall                                                                                                  
Building Conda ─→ `C:\Users\<my user name>\.julia\packages\Conda\tJJuN\deps\build.log`                                         
Building PyCall → `C:\Users\<my user name>\.julia\packages\PyCall\tqyST\deps\build.log`
┌ Error: Error building `PyCall`:                                                                                      
│ ┌ Info: Using the Python distribution in the Conda package by default.                                                
│ └ To use a different Python version, set ENV["PYTHON"]="pythoncommand" and re-run Pkg.build("PyCall").                
│ [ Info: Downloading miniconda installer ...                                                                           
│ ┌ Error: Download failed: curl: (4) Unsupported proxy 'https://<my job's proxy URL and port number>', libcurl is built without the HTTPS-proxy support.                                                                                               
│ └ @ Base download.jl:43                                                                                              
│ ERROR: LoadError: failed process: Process(`'C:\WINDOWS\System32\curl.exe' -s -S -g -L -f -o 'C:\Users\<my user name>\.julia\conda\3\installer.exe' https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe`, ProcessExited(4)) [4]  
(rest of error messages omitted)

From the error messages, it seems that the error could be eliminated if the proxy setup is changed from HTTPS to HTTP. I know how to do this on Mac, but how can I override the proxy setup used in Julia on Windows? I installed Julia using the installer downloaded from https://julialang.org/downloads/.

Setting environment variables seem to be the solution:

But this is a problem which pops up regularily, so perhaps it is something more complex than just setting environment variables and depends on other things too. Just give it a try and report back.

In above thread this has worked:

You can add these lines to ~/.julia/config/startup.jl , which will execute on each new Julia session:

ENV["HTTP_PROXY"] = "http://proxy.osmp.ru:3128"
ENV["HTTPS_PROXY"] = "http://proxy.osmp.ru:3128"

Credits go to @felipenoris

2 Likes

Thanks for the hints, @oheil. I was able to solve the issue by setting the environmental variables HTTP_PROXY and HTTPS_PROXY by following the instructions shown in https://julialang.org/downloads/platform/#adding_julia_to_path_on_windows_10. For now, this is the easiest way for me to set those environment variables, because I am not even familiar with the text editors on Windows. (I failed to figure out how to eliminate the default text file extension .txt from startup.jl.txt.)

After setting those environment variables, pkg> build PyCall worked fine. Hope this solution is useful for other people experiencing similar problems.

2 Likes