Failing to precompile Plots due to LoadError

I’m trying to set up Julia on my work computer and encounter a LoadError when I try to precompile Plots.jl. Help would be much appreciated!

I’m on Windows 10 and use Julia 1.7.2.

julia> import Pkg; Pkg.precompile()
Precompiling project...
  ✗ FFMPEG
  ✗ GR_jll
  ✗ Plots
  0 dependencies successfully precompiled in 5 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\frpa8185\.julia\compiled\v1.7\Plots\jl_4A62.tmp.
ERROR: LoadError: InitError: could not load library "C:\Users\frpa8185\.julia\artifacts\ecb81e6429c089c1da802644fae337754832d534\bin\avcodec-58.dll"
The specified module could not be found.
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl .\libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl .\libdl.jl:117
  [3] macro expansion
    @ C:\Users\frpa8185\.julia\packages\JLLWrappers\QpMQW\src\products\library_generators.jl:54 [inlined]
  [4] __init__()
    @ FFMPEG_jll C:\Users\frpa8185\.julia\packages\FFMPEG_jll\ECokx\src\wrappers\x86_64-w64-mingw32.jl:41
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base .\loading.jl:768
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base .\loading.jl:854
  [7] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1097
  [8] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:1013
  [9] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:997
 [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::String)
    @ 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
during initialization of module FFMPEG_jll
in expression starting at C:\Users\frpa8185\.julia\packages\FFMPEG\OUpap\src\FFMPEG.jl:1
ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to C:\Users\frpa8185\.julia\compiled\v1.7\FFMPEG\jl_4F21.tmp.
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
    @ .\Base.jl:418 [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::Nothing)
    @ Base .\loading.jl:1318
  [9] top-level scope
    @ none:1
 [10] eval
    @ .\boot.jl:373 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude .\client.jl:453
 [12] top-level scope
    @ none:1
in expression starting at C:\Users\frpa8185\.julia\packages\Plots\LI4FE\src\Plots.jl:1
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types C:\Users\frpa8185\AppData\Local\Programs\Julia-1.7.2\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 C:\Users\frpa8185\AppData\Local\Programs\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:1362
 [3] precompile
   @ C:\Users\frpa8185\AppData\Local\Programs\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:1013 [inlined]
 [4] #precompile#220
   @ C:\Users\frpa8185\AppData\Local\Programs\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:1011 [inlined]
 [5] precompile()
   @ Pkg.API C:\Users\frpa8185\AppData\Local\Programs\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:1011
 [6] top-level scope
   @ REPL[3]:1```

Try installing ffmpeg separately on Windows and then try installing the package again. The avcodec-58.dll file is provided by ffmpeg.

I have never heard of ffmpeg before this. Is this is?

That won’t help anything, avcodec-58.dll is already there as clearly shown by the error message.

@fredrikpaues what version of Windows do you have? Is it by any chances one of those versions without audio/video support?

I listened to Spotify through my headphones just an hour ago, so I would say no :slight_smile: It’s Windows 10 Enterprise N LTSC version 1809.

Try this:

]add https://github.com/giordano/DependencyWalker.jl
using Plots # this will result in an error, it's ok
using DependencyWalker
Library(raw"C:\Users\frpa8185\.julia\artifacts\ecb81e6429c089c1da802644fae337754832d534\bin\avcodec-58.dll")

The last command should show which library can’t be found.

I hope that I did it. I’m currently on the subway running my work computer over Remote Desktop from my cell phone :roll_eyes:

julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
ERROR: LoadError: InitError: could not load library "C:\Users\frpa8185\.julia\artifacts\ecb81e6429c089c1da802644fae337754832d534\bin\avcodec-58.dll"
The specified module could not be found.
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl .\libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl .\libdl.jl:117
  [3] macro expansion
    @ C:\Users\frpa8185\.julia\packages\JLLWrappers\QpMQW\src\products\library_generators.jl:54 [inlined]
  [4] __init__()
    @ FFMPEG_jll C:\Users\frpa8185\.julia\packages\FFMPEG_jll\ECokx\src\wrappers\x86_64-w64-mingw32.jl:41
  [5] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base .\loading.jl:768
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base .\loading.jl:854
  [7] _require(pkg::Base.PkgId)
    @ Base .\loading.jl:1097
  [8] require(uuidkey::Base.PkgId)
    @ Base .\loading.jl:1013
  [9] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:997
 [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::String)
    @ 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
during initialization of module FFMPEG_jll
in expression starting at C:\Users\frpa8185\.julia\packages\FFMPEG\OUpap\src\FFMPEG.jl:1
ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to C:\Users\frpa8185\.julia\compiled\v1.7\FFMPEG\jl_E282.tmp.
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
    @ .\Base.jl:418 [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::Nothing)
    @ Base .\loading.jl:1318
  [9] top-level scope
    @ none:1
 [10] eval
    @ .\boot.jl:373 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude .\client.jl:453
 [12] top-level scope
    @ none:1
in expression starting at C:\Users\frpa8185\.julia\packages\Plots\LI4FE\src\Plots.jl:1
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to C:\Users\frpa8185\.julia\compiled\v1.7\Plots\jl_DDC4.tmp.
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] eval
    @ .\boot.jl:373 [inlined]
  [8] eval
    @ .\Base.jl:68 [inlined]
  [9] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer c:\Users\frpa8185\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:157
 [10] (::VSCodeServer.var"#71#73"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer c:\Users\frpa8185\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:123
 [11] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:511
 [12] with_logger
    @ .\logging.jl:623 [inlined]
 [13] (::VSCodeServer.var"#70#72"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer c:\Users\frpa8185\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:124
 [14] #invokelatest#2
    @ .\essentials.jl:716 [inlined]
 [15] invokelatest(::Any)
    @ Base .\essentials.jl:714
 [16] macro expansion
    @ c:\Users\frpa8185\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
 [17] (::VSCodeServer.var"#55#56")()
    @ VSCodeServer .\task.jl:423

julia> using DependencyWalker

julia> Library(raw"C:\Users\frpa8185\.julia\artifacts\ecb81e6429c089c1da802644fae337754832d534\bin\avcodec-58.dll")
◼ C:\Users\frpa8185\.julia\artifacts\ecb81e6429c089c1da802644fae337754832d534\bin\avcodec-58.dll
  ◼ C:\Windows\System32\ole32.dll
    ◼ C:\Windows\System32\RPCRT4.dll
      ◼ C:\Windows\System32\KERNELBASE.dll
    ◼ C:\Windows\System32\combase.dll
      ◼ C:\Windows\System32\RPCRT4.dll
        ◼ C:\Windows\System32\KERNELBASE.dll
      ◼ C:\Windows\System32\bcryptPrimitives.dll
      ◼ C:\Windows\System32\KERNELBASE.dll
    ◼ C:\Windows\System32\GDI32.dll
    ◼ C:\Windows\System32\KERNEL32.DLL
      ◼ C:\Windows\System32\KERNELBASE.dll
    ◼ C:\Windows\System32\USER32.dll
      ◼ C:\Windows\System32\KERNELBASE.dll
      ◼ C:\Windows\System32\GDI32.dll
    ◼ C:\Windows\System32\KERNELBASE.dll
  ◼ C:\Users\frpa8185\AppData\Local\Programs\Julia-1.7.2\bin\libwinpthread-1.dll
    ◼ C:\Windows\System32\msvcrt.dll
      ◼ C:\Windows\System32\KERNELBASE.dll
    ◼ C:\Windows\System32\KERNEL32.DLL
      ◼ C:\Windows\System32\KERNELBASE.dll
  ✗ libx265.dll (NOT FOUND)
  ✗ libiconv-2.dll (NOT FOUND)
  ✗ libvorbisenc-2.dll (NOT FOUND)
  ◼ C:\Windows\System32\msvcrt.dll
    ◼ C:\Windows\System32\KERNELBASE.dll
  ✗ libvorbis-0.dll (NOT FOUND)
  ✗ libx264-163.dll (NOT FOUND)
  ◼ C:\Windows\System32\KERNEL32.DLL
    ◼ C:\Windows\System32\KERNELBASE.dll
  ✗ libmp3lame-0.dll (NOT FOUND)
  ✗ libopus-0.dll (NOT FOUND)
  ✗ libfdk-aac-2.dll (NOT FOUND)
  ✗ swresample-3.dll (NOT FOUND)
  ✗ MFPlat.DLL (NOT FOUND)
  ✗ avutil-56.dll (NOT FOUND)
  ◼ C:\Users\frpa8185\AppData\Local\Programs\Julia-1.7.2\bin\libz.dll
    ◼ C:\Windows\System32\msvcrt.dll
      ◼ C:\Windows\System32\KERNELBASE.dll
    ◼ C:\Windows\System32\KERNEL32.DLL
      ◼ C:\Windows\System32\KERNELBASE.dll

I’m moderately sure that means you’re missing some Windows package to play audio/video

1 Like

Looks like you’re indeed in the same situation.

1 Like

Success! Thank you!

1 Like