How to solve the problem of Plots.jl precompilation failure?

Previously, the Plots package worked fine. Don’t know what happened, running code today reported an error. How to solve this problem? Reinstall julia?

[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
Deps path: C:\Users\whkdi\.julia\packages\FFMPEG\guN1x\src\..\deps\deps.jl
ERROR: LoadError: FFMPEG not installed properly, run `] build FFMPEG`, restart Julia and try again
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] top-level scope
   @ C:\Users\whkdi\.julia\packages\FFMPEG\guN1x\src\FFMPEG.jl:23
 [3] include
   @ .\Base.jl:457 [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::String)
   @ Base .\loading.jl:2049
 [5] top-level scope
   @ stdin:3
in expression starting at C:\Users\whkdi\.julia\packages\FFMPEG\guN1x\src\FFMPEG.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to "C:\\Users\\whkdi\\.julia\\compiled\\v1.9\\FFMPEG\\jl_B3A7.tmp".
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:2294
  [3] compilecache
    @ .\loading.jl:2167 [inlined]
  [4] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1805
  [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1660
  [6] macro expansion
    @ .\loading.jl:1648 [inlined]
  [7] macro expansion
    @ .\lock.jl:267 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1611
  [9] include(mod::Module, _path::String)
    @ Base .\Base.jl:457
 [10] include(x::String)
    @ Plots C:\Users\whkdi\.julia\packages\Plots\sxUvK\src\Plots.jl:1
 [11] top-level scope
    @ C:\Users\whkdi\.julia\packages\Plots\sxUvK\src\Plots.jl:168
 [12] include
    @ .\Base.jl:457 [inlined]
 [13] 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::String)
    @ Base .\loading.jl:2049
 [14] top-level scope
    @ stdin:3
in expression starting at C:\Users\whkdi\.julia\packages\Plots\sxUvK\src\animation.jl:1
in expression starting at C:\Users\whkdi\.julia\packages\Plots\sxUvK\src\Plots.jl:1
in expression starting at stdin:3
ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to "C:\\Users\\whkdi\\.julia\\compiled\\v1.9\\Plots\\jl_9C27.tmp".
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:2294
  [3] compilecache
    @ .\loading.jl:2167 [inlined]
  [4] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1805
  [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1660
  [6] macro expansion
    @ .\loading.jl:1648 [inlined]
  [7] macro expansion
    @ .\lock.jl:267 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1611
  [9] eval
    @ .\boot.jl:370 [inlined]
 [10] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
    @ Base .\loading.jl:1903

Reinstalling Julia is usually really not necessary and (depending on how many package you have installed) a bit of work.

The error message says FFMPEG is not correctly installed;
Could you try to type ] build FFMPEG to rebuild that?

I tried ] build FFMPEG, but it failed.

…what was that error message then?

ERROR: Error building `FFMPEG`: 
ERROR: LoadError: Unable to open libLLVM!
Stacktrace:
  [1] error(s::String)
    @ Base .\error.jl:35
  [2] (::BinaryProvider.var"#open_libllvm#124")()
    @ BinaryProvider C:\Users\whkdi\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:652
  [3] detect_cxx11_string_abi()
    @ BinaryProvider C:\Users\whkdi\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:655
  [4] detect_compiler_abi()
    @ BinaryProvider C:\Users\whkdi\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:668
  [5] top-level scope
    @ C:\Users\whkdi\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:685
  [6] include(mod::Module, _path::String)
    @ Base .\Base.jl:457
  [7] include(x::String)
    @ BinaryProvider C:\Users\whkdi\.julia\packages\BinaryProvider\U2dKK\src\BinaryProvider.jl:1
  [8] top-level scope
    @ C:\Users\whkdi\.julia\packages\BinaryProvider\U2dKK\src\BinaryProvider.jl:12
  [9] include
    @ .\Base.jl:457 [inlined]
 [10] 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::String)  
    @ Base .\loading.jl:2049
 [11] top-level scope
    @ stdin:3
in expression starting at C:\Users\whkdi\.julia\packages\BinaryProvider\U2dKK\src\PlatformNames.jl:685
in expression starting at C:\Users\whkdi\.julia\packages\BinaryProvider\U2dKK\src\BinaryProvider.jl:1
in expression starting at stdin:3
ERROR: LoadError: Failed to precompile BinaryProvider [b99e7846-7c00-51b0-8f62-c81ae34c0232] to "C:\\Users\\whkdi\\.julia\\compiled\\v1.9\\BinaryProvider\\jl_7625.tmp".
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:2294
  [3] compilecache
    @ .\loading.jl:2167 [inlined]
  [4] _require(pkg::Base.PkgId, env::String)
    @ Base .\loading.jl:1805
  [5] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base .\loading.jl:1660
  [6] macro expansion
    @ .\loading.jl:1648 [inlined]
  [7] macro expansion
    @ .\lock.jl:267 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base .\loading.jl:1611
  [9] include(fname::String)
    @ Base.MainInclude .\client.jl:478
 [10] top-level scope
    @ none:5
in expression starting at C:\Users\whkdi\.julia\packages\FFMPEG\guN1x\deps\build.jl:1

BinaryProvider? That’s ancient. You most likely added something really old to your base environment that downgraded a bunch of packages.

What is the output of

using Pkg
Pkg.status()

Try this in a new Julia session as a temporary measure

using Pkg
Pkg.activate("plots"; shared = true)
Pkg.add("Plots")
using Plots
1 Like

Please read:

1 Like

@ufechner7 @mkitti
Good suggestions. I’ll pay more attention to package management, backing up toml files, and create new environments in larger code projects.
The problem I had this time was strange because I didn’t update any packages. Given that I usually just write scripts with some packages, I simply and brutally reinstalled Julia, and then the problem was solved. I’ve backed up the toml file and used the compat command to hopefully avoid this type of problem.

1 Like