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

**URL:** <https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [June 21, 2024, 6:38am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964 "2024-06-21T06:38:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dk-zen](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dk-zen](https://discourse.julialang.org/u/dk-zen)\
**Post date:** [June 21, 2024, 6:38am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964/1 "2024-06-21T06:38:36Z")

</div>

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

```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

```

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [June 21, 2024, 6:46am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964/2 "2024-06-21T06:46:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dk-zen](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dk-zen](https://discourse.julialang.org/u/dk-zen)\
**Post date:** [June 21, 2024, 6:48am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964/3 "2024-06-21T06:48:14Z")

</div>

I tried `] build FFMPEG`, but it failed.

---

<div class="post-metadata">

**Author:** ![kellertuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kellertuer/32/220707_2.png) [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Post date:** [June 21, 2024, 6:55am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964/4 "2024-06-21T06:55:40Z")

</div>

…what was that error message then?

---

<div class="post-metadata">

**Author:** ![dk-zen](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dk-zen](https://discourse.julialang.org/u/dk-zen)\
**Post date:** [June 21, 2024, 6:59am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964/5 "2024-06-21T06:59:24Z")

</div>

```julia
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

```

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [June 22, 2024, 7:28am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964/6 "2024-06-22T07:28:21Z")

</div>

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

```julia
using Pkg
Pkg.status()

```

Try this in a new Julia session as a temporary measure

```julia
using Pkg
Pkg.activate("plots"; shared = true)
Pkg.add("Plots")
using Plots

```

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [June 22, 2024, 7:55am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964/7 "2024-06-22T07:55:34Z")

</div>

Please read:

> **[Julia programming notes](https://ufechner7.github.io/2022/08/16/julia-projects.html)**
>
> Introduction When you start to use Julia you might ask yourself: How shall I structure my code? There are different approaches for different use cases.

---

<div class="post-metadata">

**Author:** ![dk-zen](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dk-zen](https://discourse.julialang.org/u/dk-zen)\
**Post date:** [June 22, 2024, 10:59am UTC](https://discourse.julialang.org/t/how-to-solve-the-problem-of-plots-jl-precompilation-failure/115964/8 "2024-06-22T10:59:13Z")

</div>

@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.
