How to Fix Failed to Precompile Plots: Required dependency Xorg_xcb_util_jll [2def613f-5ad1-5310-b15b-b15d46f528f5] failed to load from a cache file

I add FresnelIntegrals yesterday and then suddenly Plots can’t be compiled. (can’t believe this FresnelIntegrals package can cause so many damages)

I tried this but still not working:

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/browni/.julia/compiled/v1.7/Plots/jl_SfXygZ.
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for GR_jll [d2c73de3-f751-5644-a686-071e5b155ba9]
│ exception = Required dependency Xorg_xcb_util_jll [2def613f-5ad1-5310-b15b-b15d46f528f5] failed to load from a cache file.
└ @ Base loading.jl:1132
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71]
│ exception = Required dependency Xorg_xcb_util_jll [2def613f-5ad1-5310-b15b-b15d46f528f5] failed to load from a cache file.
└ @ Base loading.jl:1132
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for GR_jll [d2c73de3-f751-5644-a686-071e5b155ba9]
│ exception = Required dependency Xorg_xcb_util_jll [2def613f-5ad1-5310-b15b-b15d46f528f5] failed to load from a cache file.
└ @ Base loading.jl:1132
ERROR: LoadError: UndefRefError: access to undefined reference

Capture d’écran_2023-05-16_12-23-36

ERROR: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/browni/.julia/compiled/v1.7/Plots/jl_lbJMMi.
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

I tried a lot of things still not working.

I am thinking on deleting the whole .julia it took 32 GB after 1 year of usage. Hopefully new / fresh Julia won’t have Plots precompiling problem.

Firstly, make sure to work with projects and install only the packages you need for a project locally, e.g.

mkdir myproject
cd myproject
julia --project="."

and then

using Pkg
Pkg.add("Plots")

In this way you can avoid that dependencies of Plots get downgraded because you installed an autdated package somewhere for testing.

If the precompilation still fails you can also delete the folder:
.julia/compiled/v1.9/Plots

(replace v1.9 with the version you are using)

and try to install Plots again.

Does this help?

1 Like

I already delete the whole .julia but next time I will use your advice, thanks.

It might be useful for anyone using Linux and want to start Julia from fresh, starting with Plots precompiling problem. Especially later on for adding SymPy (for Calculus learning) with Conda and PyCall. Spend my afternoon for figuring out this again (refreshing memory how I did it months ago)

  1. Delete the whole .julia folder
  2. Replacing the old Julia with newer Julia (1.9.0) → make sure you edit the ~/.bashrc and adjust the path to new Julia. To make sure the path is correct check by open xterm / terminal and type:
vim ~/.bashrc

edit by typing i and then after finish press Esc and type :wq to save, or
!q to leave without saving

in terminal go to designated folder to test Julia:

cd ../Test/
julia --project="."

julia> ] 
Pkg> add Conda

julia> using Conda
julia> Conda.update()

go to terminal again and type

source /home/browni/.julia/conda/3/x86_64/bin/activate 
(adjust with your own path it should not be /home/browni at first)
conda create -y -p /home/browni/.julia/conda/3/x86_64/envs/lasthrimprojection
conda activate /home/browni/.julia/conda/3/x86_64/envs/lasthrimprojection/

conda install -y matplotlib
conda install -y pandas
conda install -y numpy
conda install -y scipy
conda install -y sympy

then go to the directory designated to test Julia and type in terminal / xterm:

julia --project="."
Pkg> add PyCall

julia> using PyCall

(if you get failed to Precompile PyCall)
julia> using Pkg
julia> Pkg.build("PyCall")

(to change the python that is used by PyCall)

julia> ENV["PYTHON"]="/home/browni/.julia/conda/3/x86_64/envs/lasthrimprojection/bin/python3"
julia> using Pkg
julia> Pkg.build("PyCall")

(to add SymPy)
julia> Conda.add("SymPy", "/home/browni/.julia/conda/3/x86_64/envs/lasthrimprojection")

julia> add SymPy
julia> using SymPy

with new Julia 1.9.0 (from 1.7.3), installing packages Conda with SymPy, then Plots and CairoMakie, then FresnelIntegrals and friends, after deleting 32 GB now I have 7.8 GB… all that static libraries and headers .

5