Warnings upon loading a custom sysimage

I have a script (simplified a bit here) that I use to make a custom sysimage with over 100 packages, including Weave. It has been amazingly useful for speeding up development / tests and works great.

It parses the Manifest of the current package and making a new Project.toml with all those indirect dependencies now explicit. In practice, I also exclude locally dev’d packages from this, which is why I do not use the Project.toml directly.

My weekend problem, however, is trying to figure out why it throws warnings like this whenever I start julia:

Warning: Error requiring Plots from Weave:
LoadError: ArgumentError: Package Weave does not have Base64 in its dependencies:
If you have Weave checked out for development and have
added Base64 as a dependency but haven't updated your primary
environment's manifest file, try `Pkg.resolve()`. - Otherwise you may need to report an issue with Weave
  [1] require(::Module, ::Symbol) at ./loading.jl:906
  [2] include(::Function, ::Module, ::String) at ./Base.jl:380
  [3] include(::Module, ::String) at ./Base.jl:368
  [4] top-level scope at /root/.julia/packages/Requires/vyVBT/src/Requires.jl:22
  [5] eval at ./boot.jl:331 [inlined]
  [6] eval at /root/.julia/packages/Weave/BarbQ/src/Weave.jl:1 [inlined]
  [7] (::Weave.var"#3#9")() at /root/.julia/packages/Requires/vyVBT/src/require.jl:97
  [8] err(::Any, ::Module, ::String) at /root/.julia/packages/Requires/vyVBT/src/require.jl:42
  [9] (::Weave.var"#2#8")() at /root/.julia/packages/Requires/vyVBT/src/require.jl:96
  [10] withpath(::Any, ::String) at /root/.julia/packages/Requires/vyVBT/src/require.jl:32
  [11] (::Weave.var"#1#7")() at /root/.julia/packages/Requires/vyVBT/src/require.jl:95
  [12] listenpkg(::Any, ::Base.PkgId) at /root/.julia/packages/Requires/vyVBT/src/require.jl:15
  [13] macro expansion at /root/.julia/packages/Requires/vyVBT/src/require.jl:93 [inlined]
  [14] __init__() at /root/.julia/packages/Weave/BarbQ/src/Weave.jl:27
 in expression starting at /root/.julia/packages/Weave/BarbQ/src/plots.jl:3
 @ Requires ~/.julia/packages/Requires/vyVBT/src/require.jl:44

It’s harmless because Base64 is part of the image, but confusing because Base64 is part of Weave’s dependencies in my current Manifest.toml and has been forever.

I see the dreaded Requires in the stack trace, and Weave does indeed use Requires, but it uses it for Plots and Gadfly, not Base64.

Base64 is required without qualifications here, and this file is directly include()d in the main file.

My best guess at the moment is:

  1. PackageCompiler.jl is using some logic to untangle @requires calls and determine the order in which to compile things
  2. Weave does not depend on Plots, and it only includes Base64 when it knows it is needed (not by Plots, because that is hidden behind an @requires and not listed as a Weave dependency, but by Weave directly in run.jl)
  3. When the sysimage is deserialized, it correctly notes that Weave’s call to Plots cannot yet access Base64 because include("run.jl") is after @require Plots in the file.
  4. For some reason this is the error that is generated
  5. When I embed a Base64 .png Plot with Weave.jl, it works anyway because Base64 is available almost immediately after this warning is thrown by the time that run.jl is hit.

Because you are inevitably who this question will go to, @kristoffer.carlsson, what do you think?

After continuing to use the same process to generate sysimages for a month, I observe that occasionally the warnings change and the resulting sysimage is always functional.

Is there just some way to suppress this warning on load? It mostly just annoys me when I Control-F for “error” in my Jenkins logs.