Graph compile issue

I’m suddenly unable to graph without getting an error. when I try re-compiling GR.

When I run:

using Pkg; Pkg.build("GR")

I get:

 Building GR → `~/.julia/scratchspaces/44cfe95a-1eb2-52ea-b672-e2afdf69b78f/c98aea696662d09e215ef7cda5296024a9646c75/build.log`
Precompiling project...
  ✓ GR
  ✗ Plots
  1 dependency successfully precompiled in 11 seconds (236 already precompiled, 1 skipped during auto due to previous errors)
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

Running the command for a full report:

Precompiling project...
  ✗ Plots
Output exceeds the size limit. Open the full output data in a text editor
The following 2 direct dependencies failed to precompile:

StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd]

Failed to precompile StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd] to /Users/ellen/.julia/compiled/v1.7/StatsPlots/jl_QIJK9v.
┌ Warning: GR attempted to rebuild but failed due to ErrorException("Evaluation into the closed module `GR` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `GR` with `eval` during precompilation - don't do this."). Setting ENV["JULIA_GR_REBUILD"] = false.
└ @ GR ~/.julia/packages/GR/xhzFJ/src/GR.jl:378
ERROR: LoadError: InitError: GR was not built correctly and could not be automatically rebuilt.
get(ENV, "JULIA_GR_REBUILD", "true") == false
/Users/ellen/.julia/packages/GR/xhzFJ/src/../deps/gr is not a directory.
GR_jll could not be loaded.

Run the following commands:

ENV["GRDIR"] = ""
using Pkg; Pkg.build("GR")

Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] __init__()
    @ GR ~/.julia/packages/GR/xhzFJ/src/GR.jl:383
  [3] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:768
  [4] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
...
   @ In[9]:1
 [7] eval
   @ ./boot.jl:373 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196

Could you run this and report the output?

using InteractiveUtils
versioninfo()
using Pkg
pkg"status -m"
get(ENV, "LD_LIBRARY_PATH", "not set")
get(ENV, "DYLD_LIBRARY_PATH", "not set")

Already my sense is that the version of GR you are using is a bit old.

1 Like

Also try:

  1. The first troubleshooting step is to force GR to rebuild. This should reset GR to using GR_jll.

    ENV["JULIA_DEBUG"] = "GR" # Turn on debug statements    for the GR package
    ENV["GRDIR"] = "" # Force GR to rebuild from default settings
    import Pkg; Pkg.build("GR")
    using GR
    

    Check the generated build.log for errors.

  2. The second step is try binaries from GR tarballs which are provided directly by the GR developers as self-contained distributions for selected platforms - independent of the programming language

    ENV["JULIA_DEBUG"] = "GR" # Turn on debug statements for the GR package
    ENV["GRDIR"] = ""
    ENV["JULIA_GR_PROVIDER"] = "GR"
    # ENV["JULIA_GR_PROVIDER"] = "BinaryBuilder" # Alternatively, uncomment this
    import Pkg; Pkg.build("GR")
    using GR
    
  3. There might be an issue with GR_jll. Check if it can be loaded.

    import Pkg; Pkg.add("GR_jll")
    using GR_jll
    ccall( (:gr_initgr, "libGR",), Nothing, () )
    

This is extracted from GR.jl/README.md at v0.67.0 · jheinen/GR.jl · GitHub

1 Like

running this fixed it!