JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.43k stars 5.45k forks source link

extreme stacktrace when adding a package from the REPL fails #46728

Open vtjnash opened 2 years ago

vtjnash commented 2 years ago

The error message printed when check_for_missing_packages_and_run_hooks fails is much too long. The Pkg perhaps should not be using errors for this from such a deep point in the code, and then the backtrace here also should be scrubbed, like from the Pkg REPL.

(@v1.8) pkg> add OptionalArgChecks
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package OptionalArgChecks [dfbeeb84]:
 OptionalArgChecks [dfbeeb84] log:
 ├─possible versions are: 0.1.0-0.3.1 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions 0.1.0-0.3.1
 └─restricted by julia compatibility requirements to versions: uninstalled — no versions left

julia> using OptionalArgChecks
 │ Package OptionalArgChecks not found, but a package named OptionalArgChecks is available from a registry. 
 │ Install package?
 │   (@v1.8) pkg> add OptionalArgChecks 
 └ (y/n/o) [y]: y
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package OptionalArgChecks [dfbeeb84]:
 OptionalArgChecks [dfbeeb84] log:
 ├─possible versions are: 0.1.0-0.3.1 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions 0.1.0-0.3.1
 └─restricted by julia compatibility requirements to versions: uninstalled — no versions left
Stacktrace:
  [1] propagate_constraints!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; log_events::Bool)
    @ Pkg.Resolve /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Resolve/graphtype.jl:1072
  [2] propagate_constraints! (repeats 2 times)
    @ /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Resolve/graphtype.jl:1008 [inlined]
  [3] simplify_graph!(graph::Pkg.Resolve.Graph, sources::Set{Int64}; clean_graph::Bool)
    @ Pkg.Resolve /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Resolve/graphtype.jl:1528
  [4] simplify_graph! (repeats 2 times)
    @ /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Resolve/graphtype.jl:1527 [inlined]
  [5] resolve_versions!(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber)
    @ Pkg.Operations /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:352
  [6] targeted_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
    @ Pkg.Operations /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1250
  [7] tiered_resolve(env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, julia_version::VersionNumber)
    @ Pkg.Operations /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1239
  [8] _resolve(io::Base.TTY, env::Pkg.Types.EnvCache, registries::Vector{Pkg.Registry.RegistryInstance}, pkgs::Vector{Pkg.Types.PackageSpec}, preserve::Pkg.Types.PreserveLevel, julia_version::VersionNumber)
    @ Pkg.Operations /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1256
  [9] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}, new_git::Set{Base.UUID}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform)
    @ Pkg.Operations /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/Operations.jl:1272
 [10] add(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; preserve::Pkg.Types.PreserveLevel, platform::Base.BinaryPlatforms.Platform, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, NamedTuple{(:io,), Tuple{Base.TTY}}})
    @ Pkg.API /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/API.jl:275
 [11] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/API.jl:156
 [12] add(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/API.jl:145
 [13] #add#27
    @ /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/API.jl:144 [inlined]
 [14] add
    @ /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/API.jl:144 [inlined]
 [15] try_prompt_pkg_add(pkgs::Vector{Symbol})
    @ Pkg.REPLMode /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/Pkg/src/REPLMode/REPLMode.jl:723
 [16] #invokelatest#2
    @ ./essentials.jl:805 [inlined]
 [17] invokelatest
    @ ./essentials.jl:802 [inlined]
 [18] check_for_missing_packages_and_run_hooks(ast::Any)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:176
 [19] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:147
 [20] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:248
 [21] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:233
 [22] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:372
 [23] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:357
 [24] (::Base.var"#1013#1015"{Bool, Bool, Bool})(REPL::Module)
    @ Base ./client.jl:421
 [25] #invokelatest#2
    @ ./essentials.jl:805 [inlined]
 [26] invokelatest
    @ ./essentials.jl:802 [inlined]
 [27] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
    @ Base ./client.jl:405
 [28] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:322
 [29] _start()
    @ Base ./client.jl:522
KristofferC commented 2 years ago

I mean, 33% of it has nothing to do with Pkg heh

 [19] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:147
 [20] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:248
 [21] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:233
 [22] run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_on_current_task::Bool)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:372
 [23] run_repl(repl::REPL.AbstractREPL, consumer::Any)
    @ REPL /data/vtjnash/julia/usr/share/julia/stdlib/v1.9/REPL/src/REPL.jl:357
 [24] (::Base.var"#1013#1015"{Bool, Bool, Bool})(REPL::Module)
    @ Base ./client.jl:421
 [25] #invokelatest#2
    @ ./essentials.jl:805 [inlined]
 [26] invokelatest
    @ ./essentials.jl:802 [inlined]
 [27] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)
    @ Base ./client.jl:405
 [28] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:322
 [29] _start()
    @ Base ./client.jl:522