Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

precompile now hides errors (unhelpful!) #3444

Closed
vtjnash opened this issue Apr 20, 2023 · 5 comments · Fixed by #3536
Closed

precompile now hides errors (unhelpful!) #3444

vtjnash opened this issue Apr 20, 2023 · 5 comments · Fixed by #3536
Labels
precompile Pkg.precompile

Comments

@vtjnash
Copy link
Sponsor Member

vtjnash commented Apr 20, 2023

julia> using Zygote
Precompiling Zygote
  ✗ Zygote
  0 dependencies successfully precompiled in 38 seconds. 51 already precompiled.

This is useless info for the user. The actual error then finally gets printed a minute later, after it gets re-attempted without Pkg's involvement:

[ Info: Precompiling Zygote [e88e6eb3-aa80-5325-afca-941959d7151f]
ERROR: LoadError: MethodError: no method matching replace_code_newstyle!(::Core.CodeInfo, ::Core.Compiler.IRCode, ::Int64)

Closest candidates are:
  replace_code_newstyle!(::Core.CodeInfo, ::Core.Compiler.IRCode)
   @ Core compiler/ssair/legacy.jl:67

Stacktrace:
  [1] update!(ci::Core.CodeInfo, ir::Core.Compiler.IRCode)
    @ IRTools.Inner ~/.julia/packages/IRTools/WiQqY/src/reflection/utils.jl:140
  [2] update!(ci::Core.CodeInfo, ir::IRTools.Inner.IR)
    @ IRTools.Inner ~/.julia/packages/IRTools/WiQqY/src/reflection/utils.jl:155
  [3] #s86#1596
    @ ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:40 [inlined]
  [4] var"#s86#1596"(::Any, ctx::Any, f::Any, args::Any)
    @ Zygote ./none:0
  [5] (::Core.GeneratedFunctionStub)(::Any, ::Vararg{Any})
    @ Core ./boot.jl:604
  [6] pullback(::Function, ::Zygote.Context{false}, ::Int64, ::Vararg{Int64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface.jl:44
  [7] pullback(::Function, ::Int64, ::Int64)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface.jl:42
  [8] gradient(::Function, ::Int64, ::Vararg{Int64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface.jl:96
  [9] top-level scope
    @ ~/.julia/packages/Zygote/SuKWp/src/precompile.jl:17
 [10] include(mod::Module, _path::String)
    @ Base ./Base.jl:488
 [11] include
    @ ~/.julia/packages/Zygote/SuKWp/src/Zygote.jl:1 [inlined]
 [12] macro expansion
    @ ~/.julia/packages/Requires/Z8rfN/src/Requires.jl:40 [inlined]
 [13] precompile()
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/Zygote.jl:63
 [14] macro expansion
    @ ~/.julia/packages/SnoopPrecompile/1XXT1/src/SnoopPrecompile.jl:62 [inlined]
 [15] top-level scope
    @ ~/.julia/packages/Zygote/SuKWp/src/Zygote.jl:84
 [16] include
    @ ./Base.jl:488 [inlined]
 [17] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
    @ Base ./loading.jl:2052
 [18] top-level scope
    @ stdin:2
in expression starting at /Users/jameson/.julia/packages/Zygote/SuKWp/src/precompile.jl:17
in expression starting at /Users/jameson/.julia/packages/Zygote/SuKWp/src/Zygote.jl:1
in expression starting at stdin:2
ERROR: Failed to precompile Zygote [e88e6eb3-aa80-5325-afca-941959d7151f] to "/Users/jameson/.julia/compiled/v1.10/Zygote/jl_n1mTEH".
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:2304
 [3] compilecache
   @ ./loading.jl:2170 [inlined]
 [4] _require(pkg::Base.PkgId, env::String)
   @ Base ./loading.jl:1813
 [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
   @ Base ./loading.jl:1655
 [6] macro expansion
   @ ./loading.jl:1641 [inlined]
 [7] macro expansion
   @ ./lock.jl:267 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1604
@IanButterworth
Copy link
Sponsor Member

The first Precompiling Zygote stage should be reporting errors in full. That's a bug.

It's also a bug that it continues on to try the serial precompile process. Pkg.precompile should be throwing an error in the first case.

I have to say I'm looking forward to moving Pkg.precompile to Base and having more help maintaining it.

@IanButterworth IanButterworth added the precompile Pkg.precompile label May 3, 2023
@IanButterworth
Copy link
Sponsor Member

@vtjnash I can't reproduce the issue where the main package errors aren't shown

Here I added an error() to JLLWrappers

% ./julia --startup-file=no
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.0-DEV.1234 (2023-05-06)
 _/ |\__'_|_|_|\__'_|  |  Commit b69a417e74 (0 days old master)
|__/                   |

(@v1.10) pkg> dev /Users/ian/Documents/GitHub/JLLWrappers.jl
   Resolving package versions...
  No Changes to `~/.julia/environments/v1.10/Project.toml`
    Updating `~/.julia/environments/v1.10/Manifest.toml`
  [b27032c2] ↑ LibCURL v0.6.3 ⇒ v0.6.4

julia> using JLLWrappers
Precompiling JLLWrappers
  ✗ JLLWrappers
  1 dependency successfully precompiled in 3 seconds

ERROR: The following 1 direct dependency failed to precompile:

JLLWrappers [692b3bcd-3c85-4b1f-b108-f13ce0eb3210]

Failed to precompile JLLWrappers [692b3bcd-3c85-4b1f-b108-f13ce0eb3210] to "/Users/ian/.julia/compiled/v1.10/JLLWrappers/jl_jBsLBW".
ERROR: LoadError: 
Stacktrace:
 [1] error()
   @ Base ./error.jl:44
 [2] top-level scope
   @ ~/Documents/GitHub/JLLWrappers.jl/src/JLLWrappers.jl:31
 [3] include(mod::Module, _path::String)
   @ Base ./Base.jl:488 [inlined]
 [4] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
   @ Base ./loading.jl:2091
 [5] top-level scope
   @ stdin:2
in expression starting at /Users/ian/Documents/GitHub/JLLWrappers.jl/src/JLLWrappers.jl:1
in expression starting at stdin:2

Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.10/Pkg/src/Types.jl:69
  [2] precompile(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, kwargs::Base.Pairs{Symbol, Base.TTY, Tuple{Symbol}, @NamedTuple{io::Base.TTY}})
    @ Pkg.API ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:1598
  [3] precompile(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, @NamedTuple{_from_loading::Bool}})
    @ Pkg.API ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:156
  [4] precompile(pkgs::Vector{String}; kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, @NamedTuple{_from_loading::Bool}})
    @ Pkg.API ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:144 [inlined]
  [5] precompile(pkg::String; kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, @NamedTuple{_from_loading::Bool}})
    @ Pkg.API ~/Documents/GitHub/julia/usr/share/julia/stdlib/v1.10/Pkg/src/API.jl:143 [inlined]
  [6] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1845
  [7] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1694
  [8] macro expansion
    @ Base ./loading.jl:1680 [inlined]
  [9] macro expansion
    @ Base ./lock.jl:267 [inlined]
 [10] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1643

The same when the active environment is JLLWrappers itself.

@IanButterworth
Copy link
Sponsor Member

I just saw this, where 2 dependencies errored. but the ones that errored didn't get retained with x's.
So there's a bug.

Repro is to instantiate https://github.com/KristofferC/PkgEvalAnalysis in v1.10

(PkgEvalAnalysis) pkg> instantiate
┌ Warning: The active manifest file is an older format with no julia version entry. Dependencies may have been resolved with a different julia version.
└ @ ~/Documents/GitHub/PkgEvalAnalysis/Manifest.toml:0
     Cloning git-repo `https://github.com/KristofferC/JuliaRegistryAnalysis.jl`
   Installed QuickHeaps ────── v0.1.2
   Installed ZMQ ───────────── v1.2.2
   Installed SentinelArrays ── v1.3.17
   Installed StaticGraphs ──── v0.3.0
   Installed FlatBuffers ───── v0.6.1
   Installed IJulia ────────── v1.24.0
   Installed Parsers ───────── v2.5.2
   Installed Feather ───────── v0.5.10
   Installed LightOSM ──────── v0.2.8
   Installed SpatialIndexing ─ v0.1.3
   Installed ArrayTools ────── v0.2.5
   Installed HalfEdges ─────── v0.2.4
   Installed HTTP ──────────── v1.7.3
   Installed DataFrames ────── v1.4.4
   Installed ZeroMQ_jll ────── v4.3.4+0
   Installed MetaGraphs ────── v0.7.2
   Installed JLD2 ──────────── v0.4.30
   Installed Multivectors ──── v0.3.0
   Installed StaticArrays ──── v1.5.12
  Downloaded artifact: ZeroMQ
    Building IJulia → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/59e19713542dd9dd02f31d59edbada69530d6a14/build.log`
Precompiling project...
  69 dependencies successfully precompiled in 53 seconds. 34 already precompiled.
  2 dependencies errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the packages
  4 dependencies had warnings during precompilation:
┌ SimpleWeightedGraphs [47aef6b3-ad0c-573a-a1e2-d07658019622]
...

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Jul 12, 2023

This precompile behavior still seems borderline unusable for development. Note that ArrayLayouts is a dependency, not in the Project file, so we get actively prevented from seeing any useful information about with no way to work around that.

(OmniPackage) pkg> precompile ArrayLayouts
┌ Warning: The active manifest file has dependencies that were resolved with a different julia version (1.10.0-DEV). Unexpected behavior may occur.
└ @ ~/.julia/packages/OmniPackage/nsQc3/Manifest.toml:0
Precompiling ArrayLayouts
  ✗ ArrayLayouts
  0 dependencies successfully precompiled in 5 seconds. 4 already precompiled.

julia>

@IanButterworth
Copy link
Sponsor Member

Feedback on #3536 would help move a fix forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
precompile Pkg.precompile
Projects
None yet
2 participants