GR build problems: "installation is incomplete"

Background: GR Binaries

There are two ways to provide binaries for GR which hinge on the environmental variable JULIA_GR_PROVIDER. You can evaluate that environmental variable by checking the value of ENV["JULIA_GR_PROVIDER"] within Julia or use operating system and shell specific means outside of Julia. The two methods are “BinaryBuilder” and “GR” with “BinaryBuilder” being preferred.

https://github.com/jheinen/GR.jl/blob/master/deps/build.jl#L70-L92

The BinaryBuilder binary provider method uses GR_jll which are binaries built via cross-compilation by the Julia’s BinaryBuilder.org ecosystem: GitHub - JuliaBinaryWrappers/GR_jll.jl

The GR method binary provider downloads tarballs from https://gr-framework.org/downloads/

Problems can occur if the binaries and the Julia package get out of sync. You may be trying to update GR_jll, but at the end of the day it will not matter because you are actually use the tarball. Going the other way, you might be trying to redownload the tarball, but perhaps the Julia package is using GR_jll.

Source of the Error

The error comes from GR.jl’s __init__ function (nb: GR.jl has an __init__ and an init function) when it cannot locate the directory of the GR install via the Julia variable grdir in that function. That Julia variable can modified via the environmental variable GRDIR.

Troubleshooting

I recommend working backwards in situations like this.

  1. What is the value of the local variable grdir in GR.__init__ ?
  2. What is the value of GR.gr_provider?
julia> GR.gr_provider
"BinaryBuilder"

BinaryBuilder

GR_jll.jl is a binary package created by Julia’s binary builder ecosystem. It is distinct from GR.jl. If you are having trouble with GR_jll.jl please make sure to indicate that when seeking help.

If the value of GR.gr_provider is “BinaryBuilder”, the continue troubleshooting down this path:

  1. What is the value of joinpath(dirname(GR_jll.libGR_path), "..")? You may need to manually load GR_jll via using GR_jll to evaluate this and may need to explicitly add it to your environment.
  2. What is located at the value of the expression above? Is it valid?
  3. What is the version of GR_jll in your manifest?

If you determine that GR_jll is the problem, please indicate that when seeking help.

GR or other values of GR.gr_provider

If the value of GR.gr_provider is not “BinaryBuilder”, then we may need to investigate how that came to be.

GR.gr_provider is a compile time constant which is contingent on deps.jl. Locate “deps.jl” by obtaining the value of the compile time constant GR.depsfile. You should then examine the content of deps.jl. deps.jl is not located in the GR.jl source tree, because it is generated by build.jl:

https://github.com/jheinen/GR.jl/blob/master/deps/build.jl#L78-L86

build.jl is invoked when you do “] build GR” in the package interface or do using Pkg; Pkg.build("GR").

Looking through build.jl there are two environmental variables that influence the selection of a binary provider:

  1. GRDIR
  2. JULIA_GR_PROVIDER

Further troubleshooting would thus involve clearing or manipulating these environmental variables and then invoking ] build GR. That should in turn influence the existence or contents of “deps.jl” and GR.gr_provider.

Troubleshooting Steps for non-BinaryBuilder binary provider install

The first step to fix this is just to do

That should look like this, first checking what the current value of the GRDIR environmental variable:

julia> ENV["GRDIR"]
"C:\\Users\\kittisopikulm\\.julia\\artifacts\\7d224ea2f9a0db864ae942e168f53343cb07aaa6\\bin\\.."

julia> ENV["GRDIR"] = ""
""

(@v1.6) pkg> build GR
    Building GR → `C:\Users\kittisopikulm\.julia\dev\GR\deps\build.log`
...

What does ENV["GRDIR"]=""; ] build GR do?

The first thing it does is looks for a “gr” folder in your home directory, “/opt”, “/usr/local”, or “/usr”. If you’re on Windows, you probably only have a home directory.

https://github.com/jheinen/GR.jl/blob/master/deps/build.jl#L16-L22

julia> homedir()
"C:\\Users\\kittisopikulm"

If that fails get_grdir returns Nothing. (It returns the type Nothing as opposed to an instance of nothing.)

Later, this in turn results in provider being set to "BinaryBuilder":

https://github.com/jheinen/GR.jl/blob/master/deps/build.jl#L72-L73

It’s important to check this, since a couple of weeks ago, that was not the case:

More directly you can also set the environmental variable ENV["JULIA_GR_PROVIDER"] explicitly to either “BinaryBuilder” or “GR” before rebuilding via “] build GR”.

Summary

  1. Collect information based on tracing the source of the error:
  2. What is the version of the GR and GR_jll packages?
  3. What is the value of GR.gr_provider?
  4. What are the values of the environmental variables JULIA_GR_PROVIDER and GRDIR?
  5. What happens when you clearr the environmental variable GRDIR?
julia> ENV["GRDIR"]
"C:\\Users\\kittisopikulm\\.julia\\artifacts\\7d224ea2f9a0db864ae942e168f53343cb07aaa6\\bin\\.."

julia> ENV["GRDIR"] = ""
""

(@v1.6) pkg> build GR
    Building GR → `C:\Users\kittisopikulm\.julia\dev\GR\deps\build.log`
...

Does any of the above variables and constants change?
6. What happens when you do ENV["JULIA_GR_PROVIDER"] = "BinaryBuilder" and then do using Pkg; pkg"build GR" ?
7. What happens when you do ENV["JULIA_GR_PROVIDER"] = "GR" and then do using Pkg; pkg"build GR" ?

I hope this expanded guide to troubleshooting GR helps you and your students. More generally when you get stuck like this I suggest tracing the source of the error and then walking through the process to debug. When you discover constants or environmental variables try evaluating to see what they are and then later see if modifying them changes the situation.

8 Likes