How to install PyPlot.jl on Windows 10 behind a firewall

I am behind a firewall and have to use a proxy server. This works for normal Julia packages, but not for Python/ Conda. The following command fails:

(v1.2) pkg> build PyCall
  Building Conda ─→ `C:\Users\NLUWFEC\.julia\packages\Conda\kLXeC\deps\build.log`
  Building PyCall → `C:\Users\NLUWFEC\.julia\packages\PyCall\ttONZ\deps\build.log`
┌ Error: Error building `PyCall`:
│ Solving environment: ...working... failed
│ 
│ # >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
│ 
│ `$ C:\Users\NLUWFEC\.julia\conda\3\Scripts\conda install -y numpy`
│ 
│   environment variables:
│                  CIO_TEST=<not set>
│                   CONDARC=C:\Users\NLUWFEC\.julia\conda\3\condarc-julia.yml
│              CONDA_PREFIX=C:\Users\NLUWFEC\.julia\conda\3
│                CONDA_ROOT=C:\Users\NLUWFEC\.julia\conda\3
│                  HOMEPATH=\Users\NLUWFEC
│                   IWBPATH=C:\Program Files (x86)\SAP\FrontEnd\iwb
│           JULIA_LOAD_PATH=@;C:\Users\NLUWFEC\AppData\Local\Temp\jl_w8kLsR
│                      PATH=C:\Users\NLUWFEC\.julia\conda\3\Library\bin;C:\Program Files
│                           (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS
│                           ;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;
│                           C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common
│                           Files\Intel\WirelessCommon\;C:\Program Files
│                           (x86)\Sennheiser\SoftphoneSDK\;C:\Program Files\Git\cmd;C:\Users\NLUWF
│                           EC\AppData\Local\Microsoft\WindowsApps;C:\Users\NLUWFEC\AppData\Local\
│                           Programs\Microsoft VS
│                           Code\bin;C:\Users\NLUWFEC\AppData\Local\Julia-1.2.0\bin;
│              PSMODULEPATH=C:\Users\NLUWFEC\Documents\WindowsPowerShell\Modules;C:\Program Files\
│                           WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\M
│                           odules;C:\Program Files (x86)\Microsoft Azure Information
│                           Protection\Powershell
│          PYTHONIOENCODING=UTF-8
│        REQUESTS_CA_BUNDLE=<not set>
│             SSL_CERT_FILE=<not set>
│     VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
│ 
│      active environment : base
│     active env location : C:\Users\NLUWFEC\.julia\conda\3
│        user config file : C:\Users\NLUWFEC\.condarc
│  populated config files : C:\Users\NLUWFEC\.julia\conda\3\condarc-julia.yml
│           conda version : 4.5.4
│     conda-build version : not installed
│          python version : 3.6.5.final.0
│        base environment : C:\Users\NLUWFEC\.julia\conda\3  (writable)
│            channel URLs : https://repo.anaconda.com/pkgs/main/win-64
│                           https://repo.anaconda.com/pkgs/main/noarch
│                           https://repo.anaconda.com/pkgs/free/win-64
│                           https://repo.anaconda.com/pkgs/free/noarch
│                           https://repo.anaconda.com/pkgs/r/win-64
│                           https://repo.anaconda.com/pkgs/r/noarch
│                           https://repo.anaconda.com/pkgs/pro/win-64
│                           https://repo.anaconda.com/pkgs/pro/noarch
│                           https://repo.anaconda.com/pkgs/msys2/win-64
│                           https://repo.anaconda.com/pkgs/msys2/noarch
│           package cache : C:\Users\NLUWFEC\.julia\conda\3\pkgs
│                           C:\Users\NLUWFEC\AppData\Local\conda\conda\pkgs
│        envs directories : C:\Users\NLUWFEC\.julia\conda\3\envs
│                           C:\Users\NLUWFEC\AppData\Local\conda\conda\envs
│                           C:\Users\NLUWFEC\.conda\envs
│                platform : win-64
│              user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Windows/10 Windows/10.0.16299
│           administrator : False
│              netrc file : None
│            offline mode : False
│ 
│ 
│ V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V
│ 
│ CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/free/win-64/repodata.json.bz2>
│ Elapsed: -
│ 
│ An HTTP error occurred when trying to retrieve this URL.
│ HTTP errors are often intermittent, and a simple retry will get you on your way.
│ 
│ If your current network has https://www.anaconda.com blocked, please file
│ a support request with your network engineering team.
│ 
│ ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000002AA0171A400>, 'Connection to repo.anaconda.com timed out. (connect timeout=9.15)'))",),)
│ 
│ A reportable application error has occurred. Conda has prepared the above report.
│ Upload did not complete.┌ 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: Running `conda install -y numpy` in root environment
│ ERROR: LoadError: failed process: Process(setenv(`'C:\Users\NLUWFEC\.julia\conda\3\Scripts\conda.exe' install -y numpy`,["PATH=C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files (x86)\\Sennheiser\\SoftphoneSDK\\;C:\\Program Files\\Git\\cmd;C:\\Users\\NLUWFEC\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\NLUWFEC\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\NLUWFEC\\AppData\\Local\\Julia-1.2.0\\bin;", "USERDOMAIN_ROAMINGPROFILE=EUROPE", "HOMEPATH=\\Users\\NLUWFEC", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL", "SESSIONNAME=Console", "SYSTEMROOT=C:\\WINDOWS", "APPDATA=C:\\Users\\NLUWFEC\\AppData\\Roaming", "PSMODULEPATH=C:\\Users\\NLUWFEC\\Documents\\WindowsPowerShell\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files (x86)\\Microsoft Azure Information Protection\\Powershell", "COMMONPROGRAMW6432=C:\\Program Files\\Common Files", "PROGRAMDATA=C:\\ProgramData"  …  "TERM_PROGRAM=vscode", "PROGRAMFILES(X86)=C:\\Program Files (x86)", "OPENBLAS_NUM_THREADS=8", "PROGRAMFILES=C:\\Program Files", "LOGONSERVER=\\\\IT-S-EUR0080", "CONDA_PREFIX=C:\\Users\\NLUWFEC\\.julia\\conda\\3", "JULIA_LOAD_PATH=@;C:\\Users\\NLUWFEC\\AppData\\Local\\Temp\\jl_w8kLsR", "SYSTEMDRIVE=C:", "PROCESSOR_ARCHITECTURE=AMD64", "OPENBLAS_MAIN_FREE=1"]), ProcessExited(1)) [1]
│ 
│ Stacktrace:
│  [1] pipeline_error at .\process.jl:813 [inlined]
│  [2] #run#536(::Bool, ::typeof(run), ::Cmd) at .\process.jl:728
│  [3] run at .\process.jl:726 [inlined]
│  [4] runconda(::Cmd, ::String) at C:\Users\NLUWFEC\.julia\packages\Conda\kLXeC\src\Conda.jl:113
│  [5] #add#1(::String, ::typeof(Conda.add), ::String, ::String) at C:\Users\NLUWFEC\.julia\packages\Conda\kLXeC\src\Conda.jl:184
│  [6] add at C:\Users\NLUWFEC\.julia\packages\Conda\kLXeC\src\Conda.jl:183 [inlined] (repeats 2 times)
│  [7] top-level scope at C:\Users\NLUWFEC\.julia\packages\PyCall\ttONZ\deps\build.jl:84
│  [8] include at .\boot.jl:328 [inlined]
│  [9] include_relative(::Module, ::String) at .\loading.jl:1094
│  [10] include(::Module, ::String) at .\Base.jl:31
│  [11] include(::String) at .\client.jl:431
│  [12] top-level scope at none:5
│ in expression starting at C:\Users\NLUWFEC\.julia\packages\PyCall\ttONZ\deps\build.jl:43
└ @ Pkg.Operations C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\Pkg\src\backwards_compatible_isolation.jl:647

(v1.2) pkg> 

Any idea where else I need to enter the proxy server?

A search for “CondaHTTPError proxy”
brought this
https://stackoverflow.com/questions/36729023/how-to-make-anaconda-work-behind-http-proxy-not-https
which may help as you seem to use Windows.
In short:
create a .condarc in your home and add

channels:
- defaults

# Show channel URLs when displaying what is going to be downloaded and
# in 'conda list'. The default is False.
show_channel_urls: True
allow_other_channels: True

proxy_servers:
    http: http://proxy.yourorg.org:port
    https: http://proxy.yourorg.org:port


ssl_verify: False

Can’t verify because currently not behind proxy.

Did it help?
Others would be happy if they knew that this is a solution. And I would consider to create a SO(=Stackoverflow) issue and solution for the Julia domain, as proposed here somewhere by someone with high reputation (can’t find the thread now).

No, it didn’t help. In the end I connected directly to the internet via my phone, and then I could install PyPlot.

Hello, I already have a.condarc file with the appropriate proxy settings. I can download packages with Anaconda, but I cant within Julia.

Any ideas would be cool!

What are you doing? Can you paste commands and errors?

1 Like

Thanks for the follow-up! By beginning pasting the command I just realized that I was no longer on Linux… Hence, the problem was typing this command

ENV["PYTHON"]="/c/Program/Anaconda3/python"

instead of (!):

ENV["PYTHON"]="c:\\Program\\Anaconda3\\python

So, that was the culprit. Writing the http and https proxy into the .condarc file in my home directory was enough in the end.

Thanks!

2 Likes