Pkg.add() through proxy fails on Julia 0.5, Windows

Just clarifying what works for me now:

For v0.4, I have .gitconfig in user directory.

For v0.5, I need to remove .gitconfig (so I don’t know where proxy info is coming from in this case, but having .gitconfig produces error as in previous post)

Strange, on Windows 7 I had to put a manually created .gitconfig in C:\Users\USERNAME and only then it worked. Environment variables seemed to have no effect, but I only tried setting them using ENV in Julia and then it may be too late.

I’m getting the exact same error, also on windows 7. Tried with and without .gitconfig files in ~ (H:/), as well as c:/Users/[user], and c:/opt/julia/. When I use command line, I can git clone just fine (proxy details in config file). But libgit2 isn’t grabbing the proxy info like it should. What to do?

On Windows 7, it seemed to me the .gitconfig worked. Are you sure it’s in the correct user home dir (C:/Users/Username by default) and that it is really .gitconfig and not .gitconfig.txt (like I managed to do on my first attempt)?

I’ve tried a few different places, including c:/Users/user, as well as H:/, which is where the command defaults to when I type cd ~ in command line. H is actually a network drive, setup as default home drive for my user on corporate network. Maybe that is contributing to the problem?

bump…anyone able to replicate / have any further ideas? Would be nice if you could do something like cygwin, eg “Copy Proxy Settings from Internet Explorer”

For me .gitconfig in the home directory works on the win7 machine at work, but it has a local home directory. One possibility I see is that libgit2 doesn’t read a .gitconfig on a network drive, but I found no confirmation about that on the web. I agree that the proper solution for this is to read system proxy settings on systems that support this notion, but I think that would require patching libgit2 and/or any lower-level libraries it uses for http access.

i have determined that libgit2 is looking at the config files in c:/Users/user and in c:/ProgramData/Git; when I make incorrectly formatted edits in text editor, I get a different error with Pkg.init() (failed to parse file…). What then is causing errors with proxy in libgit?

  1. possibly another gitconfig file that is overriding these two? I can’t find one though.
  2. some kind of problem with special characters? I’ve tried encoding th…works fine with git from cmd prompt or powershell, but maybe libgit is different?

My error at Pkg.init() still reads the same:

GitError(Code:ERROR, Class:OS, Failsd to set proxy: the parameter is incorrect.)…

I think libgit2 might not parse user credentials in the proxy setting properly.

Specifying username and password does not work for me on Julia v0.5 (libgit2). It did work on Julia v0.4 (git).

proxy = http://username:password@server:port

results in the following error on Julia v0.5:

ERROR: GitError(Code:ERROR, Class:OS, Failed to set proxy: The parameter is incorrect.)

Omitting the username and password seems to work:

proxy = http://server:port

So this is what I have now in .gitconfig in home directory. It seems to work for both Julia v0.4 and v0.5:

[url "https://github.com/"]
	insteadOf = git://github.com/
[http]
	proxy = http://server:port

Note that [https] does not seem necessary.

I think the libgit2 version included in 0.5 just missed the libgit2 commit adding support for parsing credentials from .gitconfig. So there’s a fairly good chance this will work on master/0.6.

1 Like

A post was merged into an existing topic: Troubleshooting libgit2

Ok, so I wait for the new version. Nevertheless - since this is a discussion group - I’m a little bit disappointed, that something this essential and important causes so much errors (if I follow the google hits). Especially when Julia is installed out of the box without any modification. Since the environment variables HTTP_PROXY, ... works for many years perfectly with PYTHON and R, this should be no problem for Julia! I’m 95% pythonic and with the remaining 5% on R. I wanted to give Julia a chance but now I’m not sure, wether it’s worth or not. It took me hours to search the web an test all suggested solutions - whithout success. Why is it necessary to fiddle with files like .gitconfig when set HTTP_PROXY can do all the work? Why does IJulia not come with the basic installation (this was may initial problem) as Jupyter comes with PYTHON?

At the moment Julia seems to be very young.

Julia is very young :smile: I hope it’s still worth giving it a shot :slight_smile:

Did you try on 0.5.1 and 0.6-alpha, both of which recently got released? My understanding is that some of the work on libgit2 could have fixed some cases of this problem

Using environment variables without .gitconfig should now work with 0.6 https://github.com/JuliaLang/julia/issues/20948#issuecomment-287305414

Hi guys, thanks for this post. I am new to Julia and and I am very excited about it. For the moment I intend to use Julia via the R package convexjlr and that seem to only work correctly with Julia 0.5.
installing packages with julia 0.6 worked after doing the git config to the corporate proxy. but with julia 0.5 it does not work and it gives me the same error as in this post.

So the consensus here is that there is no other solution but to use Julia 0.6? is there any way to make the 0.5 version work? For my purpose, I need the packages Convex and SCS to load. Any way to do manual install even? I tried to do manual install of SCS and that didn’t work.

I am using 0.5.2 and get the same issue

Pkg commands (Pkg.update(), Pkg.add()) have been failing for me for the last few days.
Failure is from behind corporate firewall, everything works fine from home.
Nothing that I’m aware of has changed in work environment, so maybe something’s up at the server end?

I’m not totally sure, but I suspect I’ve seen this before, and after a while the problem mysteriously goes away.

For the record, here’s the error messages:

Julia-0.5.2> Pkg.update()
INFO: Updating METADATA...
ERROR: METADATA cannot be updated. Resolve problems manually in C:\Users\plowman\.julia\v0.5\METADATA.
GitError(Code:ERROR, Class:OS, failed to send request: The operation timed out
)
 in macro expansion at .\libgit2\error.jl:99 [inlined]
 in #fetch#55(::Base.LibGit2.FetchOptions, ::String, ::Function, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at .\libgit2\remote.jl:70
 in (::Base.LibGit2.#kw##fetch)(::Array{Any,1}, ::Base.LibGit2.#fetch, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at .\<missing>:0
 in #fetch#96(::String, ::String, ::Array{AbstractString,1}, ::Nullable{Base.LibGit2.AbstractCredentials}, ::Function, ::Base.LibGit2.GitRepo) at .\libgit2\libgit2.jl:164
 in (::Base.Pkg.Entry.##35#41)(::Base.LibGit2.GitRepo) at .\pkg\entry.jl:370
 in with(::Base.Pkg.Entry.##35#41, ::Base.LibGit2.GitRepo) at .\libgit2\types.jl:701
 in update(::String, ::Set{String}) at .\pkg\entry.jl:353
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at .\pkg\dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at .\file.jl:48
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at .\pkg\dir.jl:31
 in update() at .\pkg\pkg.jl:210
 in eval(::Module, ::Any) at .\boot.jl:234
 in eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:64
 in macro expansion at .\REPL.jl:95 [inlined]
 in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at .\event.jl:68
 in (::Base.Pkg.Entry.##35#41)(::Base.LibGit2.GitRepo) at .\pkg\entry.jl:377
 in with(::Base.Pkg.Entry.##35#41, ::Base.LibGit2.GitRepo) at .\libgit2\types.jl:701
 in update(::String, ::Set{String}) at .\pkg\entry.jl:353
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at .\pkg\dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at .\file.jl:48
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at .\pkg\dir.jl:31
 in update() at .\pkg\pkg.jl:210
Julia-0.6.0> Pkg.update()
INFO: Updating METADATA...
ERROR: METADATA cannot be updated. Resolve problems manually in C:\Users\plowman\.julia\v0.6\METADATA.
GitError(Code:ERROR, Class:OS, failed to send request: The operation timed out
)
macro expansion at .\libgit2\error.jl:99 [inlined]
#fetch#41(::Base.LibGit2.FetchOptions, ::String, ::Function, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at .\libgit2\remote.jl:226
(::Base.LibGit2.#kw##fetch)(::Array{Any,1}, ::Base.LibGit2.#fetch, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at .\<missing>:0
#fetch#84(::String, ::String, ::Array{AbstractString,1}, ::Nullable{Base.LibGit2.AbstractCredentials}, ::Function, ::Base.LibGit2.GitRepo) at .\libgit2\libgit2.jl:312
(::Base.Pkg.Entry.##33#39)(::Base.LibGit2.GitRepo) at .\pkg\entry.jl:371
with(::Base.Pkg.Entry.##33#39, ::Base.LibGit2.GitRepo) at .\libgit2\types.jl:608
update(::String, ::Set{String}) at .\pkg\entry.jl:354
(::Base.Pkg.Dir.##3#6{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at .\pkg\dir.jl:33
cd(::Base.Pkg.Dir.##3#6{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at .\file.jl:59
withenv(::Base.Pkg.Dir.##2#5{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}},String}, ::Pair{String,String}, ::Vararg{Pair{String,String},N} where N) at .\env.jl:157
#cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N} where N) at .\pkg\dir.jl:32
update() at .\pkg\pkg.jl:228
eval(::Module, ::Any) at .\boot.jl:235
eval_user_input(::Any, ::Base.REPL.REPLBackend) at .\REPL.jl:66
macro expansion at .\REPL.jl:97 [inlined]
(::Base.REPL.##1#2{Base.REPL.REPLBackend})() at .\event.jl:73
Stacktrace:
 [1] (::Base.Pkg.Entry.##33#39)(::Base.LibGit2.GitRepo) at .\pkg\entry.jl:378
 [2] with(::Base.Pkg.Entry.##33#39, ::Base.LibGit2.GitRepo) at .\libgit2\types.jl:608
 [3] update(::String, ::Set{String}) at .\pkg\entry.jl:354
 [4] (::Base.Pkg.Dir.##3#6{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at .\pkg\dir.jl:33
 [5] cd(::Base.Pkg.Dir.##3#6{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at .\file.jl:59
 [6] withenv(::Base.Pkg.Dir.##2#5{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}},String}, ::Pair{String,String}, ::Vararg{Pair{String,String},N} where N) at .\env.jl:157
 [7] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N} where N) at .\pkg\dir.jl:32
 [8] update() at .\pkg\pkg.jl:228

Just download the git repos and put them in your .julia/v0.5 folder.

Right answer right here. Thanks!

I am on windows 10 and using Julia 1.0. When I try to add a package through REPL behind a proxy I can not do that. However, I am able to add packages through jupyter notebook even behind a proxy. I have not done any special configuration on my system.