juliaprecompile

Julia fails to precompile packages Plots


After I excute Pkg.precompile(), the REPL return the information like following:

julia> using Pkg

julia> Pkg.precompile()
Precompiling project...

  ✗ GR

  ✗ Plots

  0 dependencies successfully precompiled in 40 seconds (130 already precompiled)

ERROR: The following 1 direct dependency failed to precompile:

Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to C:\Users\Administrator\.julia\compiled\v1.6\Plots\jl_DB20.tmp.
ERROR: LoadError: ArgumentError: not a path: \`C:\Users\Administrator\.julia\packages\GR\xhzFJ\deps\deps.jl\`

ERROR: LoadError: ArgumentError: not a path: `C:\Users\Administrator\.julia\packages\GR\xhzFJ\deps\deps.jl`
Stacktrace:
 [1] RelocatableFolders.Path(mod::Module, dir::String, path::String)
   @ RelocatableFolders C:\Users\Administrator\.julia\packages\RelocatableFolders\PYUl8\src\RelocatableFolders.jl:51
 [2] top-level scope
   @ C:\Users\Administrator\.julia\packages\GR\xhzFJ\src\GR.jl:36
 [3] include
   @ .\Base.jl:384 [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, UInt64}}, source::String)
   @ Base .\loading.jl:1235
 [5] top-level scope
   @ none:1
 [6] eval
   @ .\boot.jl:360 [inlined]
 [7] eval(x::Expr)
   @ Base.MainInclude .\client.jl:446
 [8] top-level scope
   @ none:1
in expression starting at C:\Users\Administrator\.julia\packages\GR\xhzFJ\src\GR.jl:2
ERROR: LoadError: LoadError: Failed to precompile GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71] to C:\Users\Administrator\.julia\compiled\v1.6\GR\jl_B11E.tmp.
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IOContext{Base.PipeEndpoint}, internal_stdout::IOContext{IOStream}, ignore_loaded_modules::Bool)
    @ Base .\loading.jl:1385
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base .\loading.jl:1329
  [4] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1043
  [5] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:936
  [6] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:923
  [7] include(mod::Module, _path::String)
    @ Base .\Base.jl:384
  [8] include(x::String)
    @ Plots C:\Users\Administrator\.julia\packages\Plots\E2187\src\Plots.jl:1
  [9] top-level scope
    @ C:\Users\Administrator\.julia\packages\Plots\E2187\src\Plots.jl:227
 [10] include
    @ .\Base.jl:384 [inlined]
 [11] 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::Nothing)
    @ Base .\loading.jl:1235
 [12] top-level scope
    @ none:1
 [13] eval
    @ .\boot.jl:360 [inlined]
 [14] eval(x::Expr)
    @ Base.MainInclude .\client.jl:446
 [15] top-level scope
    @ none:1
in expression starting at C:\Users\Administrator\.julia\packages\Plots\E2187\src\backends\gr.jl:6
in expression starting at C:\Users\Administrator\.julia\packages\Plots\E2187\src\Plots.jl:1
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Types.jl:55
 [2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, warn_loaded::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:1265
 [3] precompile
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:921 [inlined]
 [4] #precompile#196
   @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:919 [inlined]
 [5] precompile()
   @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:919
 [6] top-level scope
   @ REPL[2]:1

Please help me!

More details:

I am a postgraduate majoring in physics. I am interested in computing and programming. From my classmates the julia lang is a programming language facing futrue because of its advanced programming philosophy. However, what I did not expect is that I meet the problem I can not resolve so soon. (This paragraph is for the prompt "Most is code, please add more details")


Solution

  • I do not even know what have happened till now. However I find the solution for my question and I have succeed in resolving it. Having excute Pkg.add("Plots"), just excute the following codes:

    using Pkg
    Pkg.add("GR")
    Pkg.build("GR")
    Pkg.precompile()
    

    The answer is from here