- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Description
I have this as my startup.jl file:
# This file should contain site-specific commands to be executed on Julia startup;
# Users may store their own personal commands in `~/.julia/config/startup.jl`.
using Downloads
Downloads.DOWNLOADER[] = nothing
Downloads.EASY_HOOK[] = (easy, info) -> begin
Downloads.Curl.setopt(easy, Downloads.Curl.CURLOPT_PROXY, "http://madeupproxy.com:8080")
Downloads.Curl.setopt(easy, Downloads.Curl.CURLOPT_PROXYUSERPWD, ":")
Downloads.Curl.setopt(easy, Downloads.Curl.CURLOPT_PROXYAUTH, Downloads.Curl.CURLAUTH_NTLM)
end
In 1.10.5 everything's fine:
julia> versioninfo()
Julia Version 1.10.5
Commit 6f3fdf7b36 (2024-08-27 14:19 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 4 × Intel(R) Xeon(R) Gold 6326 CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, cascadelake)
Threads: 4 default, 0 interactive, 2 GC (on 4 virtual cores)
Environment:
JULIA_DEPOT_PATH = E:\Program Files\JuliaDepot
JULIA_HISTORY = U:\julialog\julia_repl.jl
JULIA_NUM_THREADS = 4
(@v1.10) pkg> up
Updating registry at `E:\Program Files\JuliaDepot\registries\General.toml`
No Changes to `E:\Program Files\JuliaDepot\environments\v1.10\Project.toml`
No Changes to `E:\Program Files\JuliaDepot\environments\v1.10\Manifest.toml`
In 1.11.0, it's not, trying to add anything that has an artifact will fail.
julia> versioninfo()
Julia Version 1.11.0
Commit 501a4f25c2 (2024-10-07 11:40 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 4 × Intel(R) Xeon(R) Gold 6326 CPU @ 2.90GHz
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, cascadelake)
Threads: 4 default, 0 interactive, 2 GC (on 4 virtual cores)
Environment:
JULIA_DEPOT_PATH = E:\Program Files\JuliaDepot
JULIA_HISTORY = U:\julialog\julia_repl.jl
JULIA_NUM_THREADS = 4
(@v1.11) pkg> up
┌ Warning: could not download https://pkg.julialang.org/registries
│ exception = RequestError: HTTP/1.1 407 Proxy Authentication Required (CONNECT tunnel failed, response 407) while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry E:\Program Files\julia-1.11.0\share\julia\stdlib\v1.11\Pkg\src\Registry\Registry.jl:77
Updating registry at `E:\Program Files\JuliaDepot\registries\General.toml`
No Changes to `E:\Program Files\JuliaDepot\environments\v1.11\Project.toml`
No Changes to `E:\Program Files\JuliaDepot\environments\v1.11\Manifest.toml`
(@v1.11) pkg> add DuckDB
Resolving package versions...
┌ Warning: could not download https://pkg.julialang.org/registries
│ exception = RequestError: HTTP/1.1 407 Proxy Authentication Required (CONNECT tunnel failed, response 407) while requesting https://pkg.julialang.org/registries
└ @ Pkg.Registry E:\Program Files\julia-1.11.0\share\julia\stdlib\v1.11\Pkg\src\Registry\Registry.jl:77
Installed DuckDB_jll ─ v1.1.0+0
Installed DuckDB ───── v1.1.0
Failure artifact: DuckDB
Failure artifact: DuckDB
ERROR: Unable to automatically download/install artifact 'DuckDB' from sources listed in 'E:\Program Files\JuliaDepot\packages\DuckDB_jll\IFrj8\Artifacts.toml'.
Sources attempted:
- https://pkg.julialang.org/artifact/96856948f83b372315f21905a5e7fec7c380b2ad
Error: RequestError: HTTP/1.1 407 Proxy Authentication Required (CONNECT tunnel failed, response 407) while requesting https://pkg.julialang.org/artifact/96856948f83b372315f21905a5e7fec7c380b2ad
- https://github.com/JuliaBinaryWrappers/DuckDB_jll.jl/releases/download/DuckDB-v1.1.0+0/DuckDB.v1.1.0.x86_64-w64-mingw32-cxx11.tar.gz
Error: RequestError: HTTP/1.1 407 Proxy Authentication Required (CONNECT tunnel failed, response 407) while requesting https://github.com/JuliaBinaryWrappers/DuckDB_jll.jl/releases/download/DuckDB-v1.1.0+0/DuckDB.v1.1.0.x86_64-w64-mingw32-cxx11.tar.gz
Activity
KristofferC commentedon Oct 10, 2024
Doing something like
I get
so the hook is at least running...
GhostOfElectric commentedon Oct 10, 2024
Changed it to:
[-]Downloads regression in v1.11.0?[/-][+]Downloads EASY_HOOK regression in v1.11.0?[/+]giordano commentedon Oct 10, 2024
Diff between Downloads.jl in v1.10.5 vs v1.11.0 is JuliaLang/Downloads.jl@ead289a...89d3c7d, it shouldn't be difficult to bisect (assuming the issue is there and not somewhere else).
KristofferC commentedon Oct 10, 2024
Can you try load Pkg, set the hook through
Pkg.Downloads
and use the Pkg commands (not the REPL mode) to add the package?GhostOfElectric commentedon Oct 11, 2024
@KristofferC It works fine if done like that:
In fact, it works fine, just going:
It's just going via the REPL where it gets upset.
IanButterworth commentedon Oct 17, 2024
So this seems to be a
require_stdlib
issue, but I've not been able to replicate itWith
~/.julia/config/startup.jl
oretc/julia/startup.jl
containing the above test code, the easy hook is run properly after a pkg repl switch (loading Pkg viarequire_stdlib
)Perhaps this is a windows-specific issue.
topolarity commentedon Oct 17, 2024
That's because whether
require_stdlib
loads a duplicate copy of a package or not depends on your compile cache stateOften a stdlib ends up pre-compiled for an unrelated project/workflow, and then the pre-compiled stdlib starts to load as a duplicate version everywhere
You have to check via
Base.loaded_modules_array()
whether a duplicate copy was loaded, in which case I expect you'll hit this MWE even on Linuxtopolarity commentedon Oct 17, 2024
The premise of
require_stdlib
is that normal code does not interact with any of the side-loaded stdlibs (they operate in isolation), which this kind of "public global" is incompatible withrequire_stdlib
makes it illegal for stdlibs to have "public globals" likeDOWNLOADER
IanButterworth commentedon Oct 17, 2024
I very much appreciate you being enlightened about this. So removing use of "public globals" is the fix?
topolarity commentedon Oct 17, 2024
One fix would be to move the globals in question into Base, where uniqueness is still a thing
topolarity commentedon Oct 17, 2024
Yeah.. I'm not happy about the restrictions either TBH. I think they're a rough combo of unintuitive, hard to enforce, and lead to rare bugs (that they are rare is worse, not better IMO) but it's the situation we have right now
Moving the globals to Base should fix the issue
FWIW, I don't really know why we added this behavior to require_stdlib in the first place.
It might be worth revisiting?
IanButterworth commentedon Oct 17, 2024
IIUC at least one of the reasons was to ensure that if the user wants to use a newer stdlib version than was bundled, say Pkg, we can still load the version that the repl expects, to avoid breakage.
It has been a bumpy road for sure..
topolarity commentedon Oct 17, 2024
Oof. Moving these into Base is going to be non-trivial..
default_downloader!
andDOWNLOADER[]
both use types from Curl.jlYou can't update
DOWNLOADER[]
for two copies of Downloads.jl at once if they have differentDownloader
types...KristofferC commentedon Oct 17, 2024
For Pkg, if you update it, I would want the repl to be the updated one. We just have to fix the common load failures from out of date manifests.
IanButterworth commentedon Oct 17, 2024
We should probably fork this discussion to a dedicated issue, or a call, but for completeness.
require_stdlib
was added in #53326 which focused on fixing #53365vtjnash commentedon Oct 17, 2024
This is fixed by #55908, which was marked for backporting to avoid this issue
topolarity commentedon Feb 12, 2025
This wasn't really fixed by #55908, just some of the ways it came about