# Failure to Precompile Plots

**URL:** https://discourse.julialang.org/t/failure-to-precompile-plots/106563
**Category:** General Usage
**Tags:** error, precompilation, plots
**Created:** [November 22, 2023, 9:14am UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563 "2023-11-22T09:14:01Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![AlexanderNenninger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexandernenninger/32/24602_2.png) [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)
#### Post date: [November 22, 2023, 9:14am UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/1 "2023-11-22T09:14:02Z")

</div>

Somehow my Plots installation is broken and I can’t figure out what’s going on. Plots compiles fine in my base environment, but if I switch to my project environment, it fails to precompile with the stack trace

```julia
using Plots

```

> [Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]  
> ERROR: LoadError: InitError: could not load library “/Users/alexander.nenninger/.julia/artifacts/bf37190b92ac2fc3dd5e7073ff7ec7bbfd10343f/lib/libavdevice.58.13.100.dylib”  
> dlopen(/Users/alexander.nenninger/.julia/artifacts/bf37190b92ac2fc3dd5e7073ff7ec7bbfd10343f/lib/libavdevice.58.13.100.dylib, 0x0001): Library not loaded: @rpath/libssl.1.1.dylib  
> Referenced from: /Users/alexander.nenninger/.julia/artifacts/bf37190b92ac2fc3dd5e7073ff7ec7bbfd10343f/lib/libavdevice.58.13.100.dylib  
> Reason: tried: ‘/Users/alexander.nenninger/.julia/artifacts/bf37190b92ac2fc3dd5e7073ff7ec7bbfd10343f/lib/./libssl.1.1.dylib’ (no such file), ‘/Users/alexander.nenninger/.julia/artifacts/bf37190b92ac2fc3dd5e7073ff7ec7bbfd10343f/lib/./libssl.1.1.dylib’ (no such file), ‘/Users/alexander.nenninger/.julia/juliaup/julia-1.9.4+0.aarch64.apple.darwin14/lib/julia/libssl.1.1.dylib’ (no such file), ‘/Users/alexander.nenninger/.julia/juliaup/julia-1.9.4+0.aarch64.apple.darwin14/lib/julia/…/libssl.1.1.dylib’ (no such file), ‘/Users/alexander.nenninger/.julia/juliaup/julia-1.9.4+0.aarch64.apple.darwin14/lib/libssl.1.1.dylib’ (no such file)  
> 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:116  
> [3] macro expansion  
> @ ~/.julia/packages/JLLWrappers/pG9bm/src/products/library\_generators.jl:63 [inlined]  
> [4] **init** ()  
> @ FFMPEG\_jll ~/.julia/packages/FFMPEG\_jll/OCtN5/src/wrappers/aarch64-apple-darwin.jl:39  
> [5] register\_restored\_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)  
> @ Base ./loading.jl:1115  
> [6] \_include\_from\_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})  
> @ Base ./loading.jl:1061  
> [7] \_require\_search\_from\_serialized(pkg::Base.PkgId, sourcepath::String, build\_id::UInt128)  
> @ Base ./loading.jl:1506  
> [8] \_require(pkg::Base.PkgId, env::String)  
> @ Base ./loading.jl:1783  
> [9] \_require\_prelocked(uuidkey::Base.PkgId, env::String)  
> @ Base ./loading.jl:1660  
> [10] macro expansion  
> @ ./loading.jl:1648 [inlined]  
> [11] macro expansion  
> @ ./lock.jl:267 [inlined]  
> [12] require(into::Module, mod::Symbol)  
> @ Base ./loading.jl:1611  
> [13] include  
> @ ./Base.jl:457 [inlined]  
> [14] 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  
> [15] top-level scope  
> @ stdin:3  
> during initialization of module FFMPEG\_jll  
> in expression starting at /Users/alexander.nenninger/.julia/packages/FFMPEG/OUpap/src/FFMPEG.jl:1  
> in expression starting at stdin:3  
> ERROR: LoadError: Failed to precompile FFMPEG [c87230d0-a227-11e9-1b43-d7ebe4e7570a] to “/Users/alexander.nenninger/.julia/compiled/v1.9/FFMPEG/jl\_CrOwxf”.  
> 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 ~/.julia/packages/Plots/sxUvK/src/Plots.jl:1  
> [11] top-level scope  
> @ ~/.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::Nothing)  
> @ Base ./loading.jl:2049  
> [14] top-level scope  
> @ stdin:3  
> in expression starting at /Users/alexander.nenninger/.julia/packages/Plots/sxUvK/src/animation.jl:1  
> in expression starting at /Users/alexander.nenninger/.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 “/Users/alexander.nenninger/.julia/compiled/v1.9/Plots/jl\_hwrhi6”.  
> 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

I did perform the trouble shooting steps suggested [here](https://discourse.julialang.org/t/failed-to-precompile-plots-jl/89802), but the situation is unchanged.

For reference, this is my `project.toml`:

```julia
name = "Redacted"
uuid = "98517a01-9b76-40a2-a15c-11e76e650aca"
authors = ["redacted"]
version = "1.0.0-DEV"

[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5"
IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
LowRankApprox = "898213cb-b102-5a47-900c-97e73b919f73"
Maxvol = "4cc553b9-be87-484b-81d9-b5ae2a4e3958"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Tullio = "bc48ee85-29a4-5162-ae0b-a64e1601d4bc"

[compat]
julia = "1.9, 1.8"

[extras]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
examples = ["BenchmarkTools", "JET", "DataFrames", "Plots", "Distributions"]
test = ["Test"]

```

> Julia Version 1.9.4  
> Commit 8e5136fa297 (2023-11-14 08:46 UTC)  
> Build Info:  
> Official [https://julialang.org/](https://julialang.org/) release  
> Platform Info:  
> OS: macOS (arm64-apple-darwin22.4.0)  
> CPU: 8 × Apple M1  
> WORD\_SIZE: 64  
> LIBM: libopenlibm  
> LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)  
> Threads: 1 on 4 virtual cores

---

<div class="post-metadata">

### Author: ![jd-foster](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jd-foster/32/35824_2.png) [@jd-foster](https://discourse.julialang.org/u/jd-foster)
#### Post date: [November 22, 2023, 11:34am UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/2 "2023-11-22T11:34:03Z")

</div>

This looks very similar to this issue

> <https://github.com/JuliaLang/julia/issues/51115>
>
> I have setup a small example at https://github.com/cossio/JuliaStackedEnvFFMPEGI…ssue, of a package failing to load from an environment higher up the stack, due to it not finding required libraries. In the \[linked repo\](https://github.com/cossio/JuliaStackedEnvFFMPEGIssue), there is a parent environment which has FFMPEG\_jll installed. Then the error is triggered by trying to load FFMPEG\_jll from the nested environment at the subdirectory child\_env. However FFMPEG\_jll loads fine if:
> 1. It is loaded from the parent environment.
> 2. It is installed as a direct dependency of the nested environment, and loaded there.
> 
> This issue originated from https://github.com/MakieOrg/Makie.jl/issues/3123, since a similar error is occurring when attempting to load Makie. But it seems the source of the error is not Makie, but some underlying issue with dependency resolution in stacked environments.
> 
> \`\`\`
> julia\> versioninfo()
> Julia Version 1.9.3
> Commit bed2cd540a1 (2023-08-24 14:43 UTC)
> Build Info:
> Official https://julialang.org/ release
> Platform Info:
> OS: macOS (arm64-apple-darwin22.4.0)
> CPU: 8 × Apple M2
> WORD\_SIZE: 64
> LIBM: libopenlibm
> LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
> Threads: 1 on 4 virtual cores
> Environment:
> JULIA\_EDITOR = mvim -R
> JULIA\_PKG\_USE\_CLI\_GIT = true
> JULIA\_PKG\_SERVER\_REGISTRY\_PREFERENCE = eager
> \`\`\`
> 
> Julia installed via \`juliaup\`.

that unfortunately doesn’t have a resolution yet.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [November 22, 2023, 2:06pm UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/3 "2023-11-22T14:06:05Z")

</div>

What’s the output of

```julia
]st -m FFMPEG_jll OpenSSL_jll

```

in your environment? I can already predict for FFMPEG\_jll you’re using version `4.4.2+2` because `bf37190b92ac2fc3dd5e7073ff7ec7bbfd10343f` corresponds to [https://github.com/JuliaBinaryWrappers/FFMPEG\_jll.jl/blob/998c0edb99c7f184a90fccd38c83dd6782a707db/Artifacts.toml#L3](https://github.com/JuliaBinaryWrappers/FFMPEG_jll.jl/blob/998c0edb99c7f184a90fccd38c83dd6782a707db/Artifacts.toml#L3) and that version required OpenSSL 1.1.x (as suggested by the error message). @jd-foster may be right that this is due to stacking conflicting environments. Updating FFMPEG\_jll to version 4.4.4 should fix your issue, if possible at all.

---

<div class="post-metadata">

### Author: ![AlexanderNenninger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexandernenninger/32/24602_2.png) [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)
#### Post date: [November 22, 2023, 3:24pm UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/4 "2023-11-22T15:24:34Z")

</div>

Thanks. Here are the infos:

#### Project environment

```julia-auto
]
activate .
st -m FFMPEG_jll OpenSSL_jll

```

> Project _REDACTED_ v1.0.0-DEV  
> Status `~/.julia/dev/*REDACTED*/Manifest.toml`  
> [458c3c95] OpenSSL\_jll v3.0.12+0

and

#### Base Environment

```julia-auto
activate 
st -m FFMPEG_jll OpenSSL_jll

```

> Status `~/.julia/environments/v1.9/Manifest.toml`  
> ⌃ [b22a6f82] FFMPEG\_jll v4.4.2+2  
> ⌅ [458c3c95] OpenSSL\_jll v1.1.23+0

Edit: Weirdly enough, `FFMPEG_jll` is marked with a little green arrow, but `] up` does not upgrade it to the latest version.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [November 22, 2023, 4:28pm UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/5 "2023-11-22T16:28:36Z")

</div>

> [@AlexanderNenninger](#):
>
> Edit: Weirdly enough, `FFMPEG_jll` is marked with a little green arrow, but `] up` does not upgrade it to the latest version.

```julia
]add FFMPEG_jll@4.4.4

```

to see what’s holding it back.

---

<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: [November 22, 2023, 4:51pm UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/6 "2023-11-22T16:51:37Z")

</div>

Just in case, what is the output of `versioninfo()` in the Julia REPL. I’m looking for any references to `LD_PRELOAD` or `LD_LIBRARY_PATH` in the environment.

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [November 22, 2023, 6:15pm UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/7 "2023-11-22T18:15:01Z")

</div>

The problem is that the two stacked environments try load two different versions of OpenSSL\_jll, but in practice only a single version of the library can be loaded. Other libraries trying to load the version which didn’t get loaded will fail to load themselves. This is precisely the issue mentioned above by James.

---

<div class="post-metadata">

### Author: ![AlexanderNenninger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexandernenninger/32/24602_2.png) [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)
#### Post date: [November 23, 2023, 8:21am UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/8 "2023-11-23T08:21:33Z")

</div>

Here

> [@AlexanderNenninger](#):
>
> Julia Version 1.9.4  
> Commit 8e5136fa297 (2023-11-14 08:46 UTC)  
> Build Info:  
> Official [https://julialang.org/](https://julialang.org/) release  
> Platform Info:  
> OS: macOS (arm64-apple-darwin22.4.0)  
> CPU: 8 × Apple M1  
> WORD\_SIZE: 64  
> LIBM: libopenlibm  
> LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)  
> Threads: 1 on 4 virtual cores

---

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [November 23, 2023, 11:41am UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/9 "2023-11-23T11:41:04Z")

</div>

> [@giordano](#):
>
> The problem is that the two stacked environments try load two different versions of OpenSSL\_jll,

Why are there two different versions of this file, isn’t the package stored in one place? Does the import statement in a different environment somehow retrieve a different copy of this file?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [November 23, 2023, 11:52am UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/10 "2023-11-23T11:52:39Z")

</div>

> [@Benny](#):
>
> Why are there two different versions of this file, isn’t the package stored in one place? Does the import statement in a different environment somehow retrieve a different copy of this file?

The same package is resolved to use two different versions in the two stacked environments, but in practice it’s loaded only once (presumably the outer one).

> [@giordano](#):
>
> ```julia
> ]add FFMPEG_jll@4.4.4
> 
> ```
> 
> to see what’s holding it back.

@AlexanderNenninger you haven’t answered to this question.

---

<div class="post-metadata">

### Author: ![VivMendes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vivmendes/32/16477_2.png) [@VivMendes](https://discourse.julialang.org/u/VivMendes)
#### Post date: [November 23, 2023, 2:18pm UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/11 "2023-11-23T14:18:33Z")

</div>

Hi,

I have a similar problem: my Plots installation does not precompile. The error I get is this:

```julia
ERROR: LoadError: InitError: could not load library "C:\Users\viv\.julia\artifacts\3ac49f33c861f2eb1afea813bec920729529c0e0\bin\avcodec-58.dll"

```

I have only one package in this environment: Pluto.jl.

I have checked and:

```Project
Status `C:\Users\viv\macroI\Manifest.toml`
  [b22a6f82] FFMPEG_jll v4.4.4+1
  [458c3c95] OpenSSL_jll v3.0.12+0

```

My system info is as follows:

```Julia
Commit bed2cd540a (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 4 × Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, haswell)
  Threads: 1 on 4 virtual cores

```

I do not know if this information is relevant or not, but at home I also have a Windows 10 machine, the same Julia version, and the same environment. I do not get any `FFMPEG_jll` installed, **and … Plots works very well**.

Thanks

---

<div class="post-metadata">

### Author: ![AlexanderNenninger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexandernenninger/32/24602_2.png) [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)
#### Post date: [November 24, 2023, 10:30am UTC](https://discourse.julialang.org/t/failure-to-precompile-plots/106563/12 "2023-11-24T10:30:09Z")

</div>

Sorry, for being slow to answer. I was able to add `FFMPEG_jll@4.4.4` in by base environment, there was a lot of recompiling, but no errors.

`Plots` seems to be fixed now, although I believe not due to me adding it. It started to work after I ran `update` on the base environment and `FFMPEG_jll` was upgraded to `4.4.2`.
