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

[BUG] Failed to precompile Plots #2886

Closed
joaogoliveira1 opened this issue Aug 3, 2020 · 13 comments
Closed

[BUG] Failed to precompile Plots #2886

joaogoliveira1 opened this issue Aug 3, 2020 · 13 comments
Labels

Comments

@joaogoliveira1
Copy link

Details

Hello. I have just installed julia 1.5 and when I run using Plots, I get the following message saying that precompilation has failed:

ERROR: LoadError: InitError: could not load library "C:\Users\Administrator.julia\artifacts\52d195e9e73e7321d06ad9980656174ac0464ed4\bin\avdevice-58.dll"
The specified module could not be found.
Stacktrace:
[1] dlopen(::String, ::UInt32; throw_error::Bool) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Libdl\src\Libdl.jl:109
[2] dlopen at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Libdl\src\Libdl.jl:109 [inlined] (repeats 2 times)
[3] init() at C:\Users\Administrator.julia\packages\FFMPEG_jll\tCUYA\src\wrappers\x86_64-w64-mingw32.jl:231
[4] _include_from_serialized(::String, ::Array{Any,1}) at .\loading.jl:697
[5] _require_search_from_serialized(::Base.PkgId, ::String) at .\loading.jl:782
[6] _require(::Base.PkgId) at .\loading.jl:1007
[7] require(::Base.PkgId) at .\loading.jl:928
[8] require(::Module, ::Symbol) at .\loading.jl:923
[9] include(::Function, ::Module, ::String) at .\Base.jl:380
[10] include(::Module, ::String) at .\Base.jl:368
[11] top-level scope at none:2
[12] eval at .\boot.jl:331 [inlined]
[13] eval(::Expr) at .\client.jl:467
[14] top-level scope at .\none:3
during initialization of module FFMPEG_jll
in expression starting at C:\Users\Administrator.julia\packages\FFMPEG\vocw2\src\FFMPEG.jl:3
ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to C:\Users\Administrator.julia\compiled\v1.5\FFMPEG\TGvga_4mW7P.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1290
[3] _require(::Base.PkgId) at .\loading.jl:1030
[4] require(::Base.PkgId) at .\loading.jl:928
[5] require(::Module, ::Symbol) at .\loading.jl:923
[6] include(::Function, ::Module, ::String) at .\Base.jl:380
[7] include(::Module, ::String) at .\Base.jl:368
[8] top-level scope at none:2
[9] eval at .\boot.jl:331 [inlined]
[10] eval(::Expr) at .\client.jl:467
[11] top-level scope at .\none:3
in expression starting at C:\Users\Administrator.julia\packages\Plots\LWw1t\src\Plots.jl:15
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to C:\Users\Administrator.julia\compiled\v1.5\Plots\ld3vC_4mW7P.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1290
[3] _require(::Base.PkgId) at .\loading.jl:1030
[4] require(::Base.PkgId) at .\loading.jl:928
[5] require(::Module, ::Symbol) at .\loading.jl:923

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) x
pyplot x
plotly x
plotlyjs x
pgfplotsx x
inspectdr x

Versions

Plots.jl version: 1.5.7
Backend version: GR v0.51.0
Output of :

Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = "C:\Users\Administrator\AppData\Local\atom\app-1.49.0\atom.exe" -a
JULIA_NUM_THREADS = 12

@adamhaber
Copy link

Same here:

(ergmjl) pkg> precompile
Precompiling project...
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
ERROR: LoadError: InitError: could not load library "/Users/adamhaber/.julia/artifacts/dbb254dca678145c7d79410e96da494cc94f8a13/lib/libavdevice.58.5.100.dylib"
dlopen(/Users/adamhaber/.julia/artifacts/dbb254dca678145c7d79410e96da494cc94f8a13/lib/libavdevice.58.5.100.dylib, 1): Library not loaded: @rpath/libx264.157.dylib
  Referenced from: /Users/adamhaber/.julia/artifacts/dbb254dca678145c7d79410e96da494cc94f8a13/lib/libavdevice.58.5.100.dylib
  Reason: image not found
Stacktrace:
 [1] dlopen(::String, ::UInt32; throw_error::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Libdl/src/Libdl.jl:109
 [2] dlopen at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Libdl/src/Libdl.jl:109 [inlined] (repeats 2 times)
 [3] __init__() at /Users/adamhaber/.julia/packages/FFMPEG_jll/tCUYA/src/wrappers/x86_64-apple-darwin14.jl:231
 [4] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:697
 [5] _require_search_from_serialized(::Base.PkgId, ::String) at ./loading.jl:781
 [6] _require(::Base.PkgId) at ./loading.jl:1006
 [7] require(::Base.PkgId) at ./loading.jl:927
 [8] require(::Module, ::Symbol) at ./loading.jl:922
 [9] include(::Module, ::String) at ./Base.jl:377
 [10] top-level scope at none:2
 [11] eval at ./boot.jl:331 [inlined]
 [12] eval(::Expr) at ./client.jl:449
 [13] top-level scope at ./none:3
during initialization of module FFMPEG_jll
in expression starting at /Users/adamhaber/.julia/packages/FFMPEG/vocw2/src/FFMPEG.jl:3
ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to /Users/adamhaber/.julia/compiled/v1.4/FFMPEG/TGvga_EvpPl.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
 [3] _require(::Base.PkgId) at ./loading.jl:1029
 [4] require(::Base.PkgId) at ./loading.jl:927
 [5] require(::Module, ::Symbol) at ./loading.jl:922
 [6] include(::Module, ::String) at ./Base.jl:377
 [7] top-level scope at none:2
 [8] eval at ./boot.jl:331 [inlined]
 [9] eval(::Expr) at ./client.jl:449
 [10] top-level scope at ./none:3
in expression starting at /Users/adamhaber/.julia/packages/Plots/LWw1t/src/Plots.jl:15

@mmikhasenko
Copy link
Contributor

mmikhasenko commented Aug 3, 2020

the same thing: Plots on windows 10

tried to re-built FFMPEG.jl, did not work

] add FFMPEG # works
using FFMPEG # throws the error "The specified module could not be found"
# ERROR: LoadError: InitError: could not load library
# .....\artifacts\52d195e9e73e7321d06ad9980656174ac0464ed4\bin\avdevice-58.dll"
# The specified module could not be found.

@joaogoliveira1
Copy link
Author

the same thing: Plots on windows 10

tried to re-built FFMPEG.jl, did not work

] add FFMPEG # works
using FFMPEG # throws the error "The specified module could not be found"
# ERROR: LoadError: InitError: could not load library
# .....\artifacts\52d195e9e73e7321d06ad9980656174ac0464ed4\bin\avdevice-58.dll"
# The specified module could not be found.

I also tried this, based on the comments from other threads, but it also did not work and I get basically the same error

@daschw
Copy link
Member

daschw commented Aug 3, 2020

cref JuliaIO/FFMPEG.jl#33

@joaogoliveira1
Copy link
Author

I tried the solution referenced here https://github.com/JuliaIO/FFMPEG.jl/issues/33#issuecomment-668002001, which is to do ]add x264_jll@v2019.5.25

I now get the error:

┌ Error: evaluation error starting at C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:9
│ mod = PlotThemes
│ ex =
│ quote
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:3 =#
│ if Juno.isactive()
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:4 =#
│ colors = Juno.syntaxcolors()
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:5 =#
│ colors = Dict((k => parse(Colorant, "#" * Base.hex(v, 6, false)) for (k, v) = colors))
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:7 =#
│ juno_palette = unique([colors[k] for k = keys(colors) if k ∉ ["background", "variable"]])
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:9 =#
│ colvec = sort(HSV.(juno_palette), lt = ((a, b)->begin
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:9 =#
│ a.h < b.h
│ end))
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:10 =#
│ filter!((c->begin
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:10 =#
│ c.s > 0.5 * mean((c->begin
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:10 =#
│ c.s
│ end), colvec)
│ end), colvec)
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:11 =#
│ grad = Vector{eltype(colvec)}()
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:12 =#
│ for i = 1:length(colvec) - 1
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:13 =#
│ append!(grad, range(colvec[i], stop = colvec[i + 1]))
│ end
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:16 =#
│ global _themes
│ #= C:\Users\Administrator.julia\packages\PlotThemes\4DCOG\src\juno_smart.jl:17 =#
│ _themes[:juno] = PlotTheme(bg = colors["background"], bginside = colors["background"], fg = colors["variable"], fgtext = colors["variable"], fgguide = colors["variable"], fglegend = colors["variable"], palette = expand_palette(colors["background"], juno_palette; lchoices = [57], cchoices = [100]), colorgradient = grad)
│ end
│ end
│ exception =
│ MethodError: Cannot convert an object of type Tuple{LineNumberNode,Expr} to an object of type Array{Tuple{LineNumberNode,Expr},1}
│ Closest candidates are:
│ convert(::Type{Array{T,N}}, ::StaticArrays.SizedArray{S,T,N,M} where M) where {T, S, N} at C:\Users\Administrator.julia\packages\StaticArrays\l7lu2\src\SizedArray.jl:72
│ convert(::Type{T}, ::AbstractArray) where T<:Array at array.jl:554
│ convert(::Type{T}, ::T) where T<:AbstractArray at abstractarray.jl:14
│ ...
│ Stacktrace:
│ [1] convert(::Type{Union{Missing, Array{Tuple{LineNumberNode,Expr},1}}}, ::Tuple{LineNumberNode,Expr}) at .\missing.jl:69
│ [2] setindex!(::IdDict{Type,Union{Missing, Array{Tuple{LineNumberNode,Expr},1}}}, ::Any, ::Any) at .\iddict.jl:74
│ [3] add_signature!(::Revise.CodeTrackingMethodInfo, ::Any, ::LineNumberNode) at C:\Users\Administrator.julia\packages\Revise\BqeJF\src\Revise.jl:501
└ @ Revise C:\Users\Administrator.julia\packages\Revise\BqeJF\src\lowered.jl:106
Revise.LogRecord(Error, evaluation error starting at C:\Users\Administrator.julia\packages\Plots\LWw1t\src\init.jl:89, lowered, Revise_e943ed8b, "C:\Users\Administrator.julia\packages\Revise\BqeJF\src\lowered.jl", 106, (mod=Plots, ex=begin
begin
#= C:\Users\Administrator.julia\packages\Plots\LWw1t\src\init.jl:89 =#
_show(io::IO, mime::MIME"image/png", plt::Plot{<:PDFBackends}) = begin
#= C:\Users\Administrator.julia\packages\Plots\LWw1t\src\init.jl:89 =#
_show_pdfbackends(io, mime, plt)
end
end
pkguuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
end)MethodError: Cannot convert an object of type Tuple{LineNumberNode,Expr} to an object of type Array{Tuple{LineNumberNode,Expr},1}
Closest candidates are:
convert(::Type{Array{T,N}}, ::StaticArrays.SizedArray{S,T,N,M} where M) where {T, S, N} at C:\Users\Administrator.julia\packages\StaticArrays\l7lu2\src\SizedArray.jl:72
convert(::Type{T}, ::AbstractArray) where T<:Array at array.jl:554
convert(::Type{T}, ::T) where T<:AbstractArray at abstractarray.jl:14
...
Stacktrace:
[1] convert(::Type{Union{Missing, Array{Tuple{LineNumberNode,Expr},1}}}, ::Tuple{LineNumberNode,Expr}) at .\missing.jl:69
[2] setindex!(::IdDict{Type,Union{Missing, Array{Tuple{LineNumberNode,Expr},1}}}, ::Any, ::Any) at .\iddict.jl:74
[3] add_signature!(::Revise.CodeTrackingMethodInfo, ::Any, ::LineNumberNode) at C:\Users\Administrator.julia\packages\Revise\BqeJF\src\Revise.jl:501)

@lewisl
Copy link

lewisl commented Aug 3, 2020

Same thing on MacOS with Plots v 1.5.7 and Julia 1.5 (same on Julia 1.4.2).

Easy to downgrade Plots:
] add Plots@1.5.6

Plots v1.5.6 works on both Julia 1.4.2 and Julia 1.5.

From below I confirm that mmikhasenko recommendation works, too.

Probably should fix this for everyone's convenience, but two quick work arounds let us get our work done with Plots.

@daschw
Copy link
Member

daschw commented Aug 3, 2020

The x264_jll issue should be fixed in JuliaRegistries/General#18881. No need to pin, just ]up. I can't reproduce the PlotThemes error in #2886 (comment).

@mmikhasenko
Copy link
Contributor

(@v1.5) pkg> up
  [1270edf5]  x264_jll v2020.7.14+0  v2019.5.25+2
(@v1.5) pkg> build FFMPEG 
julia> using FFMPEG
[ Info: Precompiling FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a]
# success
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
# success

👍

@Sceptwo
Copy link

Sceptwo commented Aug 3, 2020

The x264_jll issue should be fixed in JuliaRegistries/General#18881. No need to pin, just ]up. I can't reproduce the PlotThemes error in #2886 (comment).

This worked for me on Ubuntu on WSL2 with Julia v1.5

@joaogoliveira1
Copy link
Author

joaogoliveira1 commented Aug 3, 2020

(@v1.5) pkg> up
  [1270edf5]  x264_jll v2020.7.14+0  v2019.5.25+2
(@v1.5) pkg> build FFMPEG 
julia> using FFMPEG
[ Info: Precompiling FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a]
# success
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
# success

👍

Did clean install of Julia 1.5 (including deleting .julia).
Did these steps (+ add FFMPEG)
Success

@raamsa
Copy link

raamsa commented Feb 4, 2022

Hi everyone!
I am a beginner using Julia 1.7.1. I am using Ubuntu 20.04 LTS on the machine. I am trying to add package 'Plots', I tried this:

] add Plots

Output:
Precompiling project...
✗ GR
✗ Plots
13 dependencies successfully precompiled in 24 seconds (206 already precompiled)
2 dependencies errored. To see a full report either run import Pkg; Pkg.precompile() or load the packages

then I tried
julia> import Pkg; Pkg.precompile()

Output:
Precompiling project...
✗ GR
✗ Plots
0 dependencies successfully precompiled in 18 seconds (219 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 /home/rakesh/.julia/compiled/v1.7/Plots/jl_aBNei3.
ERROR: LoadError: ArgumentError: not a path: /home/rakesh/.julia/packages/GR/KPElO/deps/deps.jl
Stacktrace:
[1] RelocatableFolders.Path(mod::Module, dir::String, path::String)
@ RelocatableFolders ~/.julia/packages/RelocatableFolders/PYUl8/src/RelocatableFolders.jl:51
[2] top-level scope
@ ~/.julia/packages/GR/KPElO/src/GR.jl:36
[3] include
@ ./Base.jl:418 [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:1318
[5] top-level scope
@ none:1
[6] eval
@ ./boot.jl:373 [inlined]
[7] eval(x::Expr)
@ Base.MainInclude ./client.jl:453
[8] top-level scope
@ none:1
in expression starting at /home/rakesh/.julia/packages/GR/KPElO/src/GR.jl:2
ERROR: LoadError: Failed to precompile GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71] to /home/rakesh/.julia/compiled/v1.7/GR/jl_2iC9C8.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
@ Base ./loading.jl:1466
[3] compilecache(pkg::Base.PkgId, path::String)
@ Base ./loading.jl:1410
[4] _require(pkg::Base.PkgId)
@ Base ./loading.jl:1120
[5] require(uuidkey::Base.PkgId)
@ Base ./loading.jl:1013
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:997
[7] include(mod::Module, _path::String)
@ Base ./Base.jl:418
[8] include(x::String)
@ Plots ~/.julia/packages/Plots/YAlrZ/src/Plots.jl:1
[9] top-level scope
@ ~/.julia/packages/Plots/YAlrZ/src/Plots.jl:235
[10] include
@ ./Base.jl:418 [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:1318
[12] top-level scope
@ none:1
[13] eval
@ ./boot.jl:373 [inlined]
[14] eval(x::Expr)
@ Base.MainInclude ./client.jl:453
[15] top-level scope
@ none:1
in expression starting at /home/rakesh/.julia/packages/Plots/YAlrZ/src/backends/gr.jl:6
in expression starting at /home/rakesh/.julia/packages/Plots/YAlrZ/src/Plots.jl:1
Stacktrace:
[1] pkgerror(msg::String)
@ Pkg.Types ~/julia-1.7.1/share/julia/stdlib/v1.7/Pkg/src/Types.jl:68
[2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Pkg.API ~/julia-1.7.1/share/julia/stdlib/v1.7/Pkg/src/API.jl:1362
[3] precompile
@ ~/julia-1.7.1/share/julia/stdlib/v1.7/Pkg/src/API.jl:1013 [inlined]
[4] #precompile#220
@ ~/julia-1.7.1/share/julia/stdlib/v1.7/Pkg/src/API.jl:1011 [inlined]
[5] precompile()
@ Pkg.API ~/julia-1.7.1/share/julia/stdlib/v1.7/Pkg/src/API.jl:1011
[6] top-level scope
@ REPL[5]:1

After reviewing some comments on this platform, I tried:
using Pkg
Pkg.rm("Plots")
Pkg.gc()
Pkg.add("Plots")
Unfortunately, problem is not resolving.

Please help me to get out of this issue.

@BeastyBlacksmith
Copy link
Member

How did you install julia? What Plots version and what version of GR is that?

@mkborregaard
Copy link
Member

mkborregaard commented Feb 4, 2022

@raamsa just as a hint since you say you are a beginner - it's better to open a new issue, rather than commenting on a closed issue. Closed issues are history.

Another hint, - use triple "backticks" like this:
Screenshot 2022-02-04 at 09 48 58
above and below code to have it formatted correctly.

Finally, to install GR on ubuntu you might be missing some dependencies that GR does not download automatically. Could you try running

apt install libxt6 libxrender1 libxext6 libgl1-mesa-glx libqt5widgets5

That's not immediately apparent from the Plots website apparently - it's hidden away in the GR docs https://gr-framework.org/julia.html#installation

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

No branches or pull requests

9 participants