Install packages behind the proxy

question
#1

Hi everyone!
I try to use Julia in my current job. But have trouble with installing packages behind the proxy.
I use 1.1.0 binaries.
error massage:
julia> Pkg.add(“IJulia”)
Cloning default registries into ~/.julia
Cloning registry from “https://github.com/JuliaRegistries/General.git
ERROR: failed to clone from https://github.com/JuliaRegistries/General.git, error: GitError(Code:ERROR, Class:Net, curl error: Unsupported proxy ‘https://proxy.osmp.ru:3128’, libcurl is built without the HTTPS-proxy support.
)
Stacktrace:
[1] pkgerror(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:120
[2] #clone#3(::String, ::Base.Iterators.Pairs{Symbol,LibGit2.CachedCredentials,Tuple{Symbol},NamedTuple{(:credentials,),Tuple{LibGit2.CachedCredentials}}}, ::Function, ::String, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/GitTools.jl:111
[3] (::getfield(Pkg.GitTools, Symbol("#kw##clone")))(::NamedTuple{(:header, :credentials),Tuple{String,LibGit2.CachedCredentials}}, ::typeof(Pkg.GitTools.clone), ::String, ::String) at ./none:0
[4] (::getfield(Pkg.Types, Symbol("##87#89")))(::LibGit2.CachedCredentials) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:1103
[5] shred!(::getfield(Pkg.Types, Symbol("##87#89")), ::LibGit2.CachedCredentials) at ./secretbuffer.jl:184
[6] clone_or_cp_registries(::Pkg.Types.Context, ::Array{Pkg.Types.RegistrySpec,1}, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:1102
[7] clone_or_cp_registries at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:1087[inlined]
[8] clone_default_registries() at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:1037
[9] find_registered!(::Pkg.Types.EnvCache, ::Array{String,1}, ::Array{Base.UUID,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:1312
[10] registry_resolve!(::Pkg.Types.EnvCache, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:949
[11] #add_or_develop#15(::Symbol, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:47
[12] #add_or_develop at ./none:0 [inlined]
[13] #add_or_develop#14 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:31 [inlined]
[14] #add_or_develop at ./none:0 [inlined]
[15] #add_or_develop#13 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:29 [inlined]
[16] #add_or_develop at ./none:0 [inlined]
[17] #add_or_develop#12(::Base.Iterators.Pairs{Symbol,Symbol,Tuple{Symbol},NamedTuple{(:mode,),Tuple{Symbol}}}, ::Function, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:28
[18] #add_or_develop at ./none:0 [inlined]
[19] #add#20 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:59 [inlined]
[20] add(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:59
[21] top-level scope at none:0

#2

Many corporate proxies actually work over HTTP, not HTTPS; your communication is still secure because proxied https traffic uses the CONNECT method and the TLS handshake is still handled between the client and upstream server (i.e. without proxy interception).

So unless your employer has told you otherwise, it’s worth checking whether setting the https_proxy=http://proxy.osmp.ru:3128 works for you.

PS. If you have issues with command-line applications and proxies, this project may be for you.

#3

Yes, I agree with @tkluck.

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"
#4

Thanks for the fast reply. I have the opportunity to use a proxy without https. I try to use your advice with startup.jl, before that I erase all proxy env vars, but Julia still finds proxy https://proxy.osmp.ru:3128 somewhere. And error still the same.

#5

Can you execute this line just before trying to add a package and paste the result here?

println(ENV["HTTP_PROXY"]); println(ENV["HTTPS_PROXY"])
#6

I have a similar issue with installing packages behind a proxy. But in my case it’s not complaining about HTTPS proxies or whatever, it’s just trying to direct connect and failing (which is expected if it tries to direct connect)

I’m using the Debian testing packages: Julia 1.0.3+dfsg-4

I have all the right ENV settings:


julia> ENV["HTTP_PROXY"]
"http://pico.lan:3128"

julia> ENV["http_proxy"]
"http://pico.lan:3128"

julia> ENV["HTTPS_PROXY"]
"http://pico.lan:3128"

julia> ENV["https_proxy"]
"http://pico.lan:3128"

I try to Pkg.add(“StatsBase”) but rather than complaining about anything related to the proxy, it actually just tries to direct connect, which isn’t possible:

julia> Pkg.add("StatsBase")
   Cloning default registries into /home/dlakelan/.julia/registries
   Cloning registry General from "https://github.com/JuliaRegistries/General.git"
e[?25le[?25hERROR: failed to clone from https://github.com/JuliaRegistries/General.git, error: GitError(Code:ERROR, Class:OS, failed to connect to github.com: Connection timed out)
Stacktrace:
 [1] pkgerror(::String) at /build/julia-wJr69F/julia-1.0.3+dfsg/usr/share/julia/stdlib/v1.0/Pkg/src/Types.jl:120
...

Thoughts?

#7

I think you need to configure the proxy on the .gitconfig file

Try adding

[http]
        proxy = http://pico.lan:3128

In my case it works

EDIT

I just tried disabling both lines and the package manager is still working. I think there is some other issue. A colleague of mine is experiencing the same problem. I will try to dig deeper.

#8

Git works fine without that line, but I put it in anyway, and Julia has the same results… :face_with_raised_eyebrow:

Ok, I tried just git cloning the JuliaRegistries/General.git by hand, and then after that it seemed to work, so something about the initial getting of the registries is different from getting individual packages!

Further useful info: I installed the 1.1.0 binaries from julialang.org instead of the Debian packages, and they seem to behave better. So probably the solution is to use newer Julia.