PyPlot and PyCall precompile error WSL

I am using Julia 1.6.1 in WSL. I tried to precompile the project at https://github.com/cduck/VLQ. I got the following error


julia> Pkg.precompile
precompile (generic function with 2 methods)

(vlq) pkg> precompile
Precompiling project...
  ✗ PyCall
  ✗ PyPlot
  0 dependencies successfully precompiled in 9 seconds (22 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

PyPlot [d330b81b-6aea-500a-939a-2ce795aea3ee]

ERROR: LoadError: LoadError: LoadError: UndefVarError: dict not defined
Stacktrace:
  [1] combinedef(dict::Dict{Symbol, Any})
    @ MacroTools ~/.julia/packages/MacroTools/X77lQ/src/utils.jl:322
  [2] parse_pydef(expr::Expr)
    @ PyCall ~/.julia/packages/PyCall/zqDXB/src/pyclass.jl:112
  [3] var"@pydef_object"(__source__::LineNumberNode, __module__::Module, class_expr::Any)
    @ PyCall ~/.julia/packages/PyCall/zqDXB/src/pyclass.jl:183
  [4] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
  [5] include(x::String)
    @ PyCall ~/.julia/packages/PyCall/zqDXB/src/PyCall.jl:1
  [6] top-level scope
    @ ~/.julia/packages/PyCall/zqDXB/src/PyCall.jl:197
  [7] include
    @ ./Base.jl:386 [inlined]
  [8] 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, UInt64}}, source::String)
    @ Base ./loading.jl:1213
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:360 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [12] top-level scope
    @ none:1

I also encountered this problem when compiling, have you solved this problem?

[ Info: Precompiling Z3 [06b161dc-0161-11ea-0f74-41f836f4024b]
ERROR: LoadError: UndefVarError: dict not defined
Stacktrace:
  [1] combinedef(dict::Dict{Symbol, Any})
    @ MacroTools C:\Users\zhangyating\.julia\packages\MacroTools\juk9P\src\utils.jl:322
  [2] var"@cxxdereference"(__source__::LineNumberNode, __module__::Module, f::Any)
    @ CxxWrap.CxxWrapCore C:\Users\zhangyating\.julia\packages\CxxWrap\ptbgM\src\CxxWrap.jl:825
  [3] include(mod::Module, _path::String)
    @ Base .\Base.jl:418
  [4] include(x::String)
    @ CxxWrap C:\Users\zhangyating\.julia\packages\CxxWrap\ptbgM\src\CxxWrap.jl:1
  [5] top-level scope
    @ C:\Users\zhangyating\.julia\packages\CxxWrap\ptbgM\src\CxxWrap.jl:832
  [6] include
    @ .\Base.jl:418 [inlined]
  [7] 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, UInt64}}, source::String)
    @ Base .\loading.jl:1318
  [8] top-level scope
    @ none:1
  [9] eval
    @ .\boot.jl:373 [inlined]
 [10] eval(x::Expr)
    @ Base.MainInclude .\client.jl:453
 [11] top-level scope
    @ none:1

Sometimes Julia can get into a wonky state when precompiling if there are already some things loaded — a good first step in debugging issues like these is closing Julia and trying again.