fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.92k stars 284 forks source link

Plots.jl precompilation fails and can't recover #1327

Open nilshg opened 3 years ago

nilshg commented 3 years ago

I'm sorry that this is a super unhelpful issue, but as reproducing this requires a "fresh" Julia install I haven't been able to actually create an MWE.

I recently shared a notebook that used Pluto's package manager with a colleague. My instructions to him were to just do Pkg.add("Pluto", version = 0.15); Pluto.run() at the REPL and then open the notebook, which he did. Unfortunately, Plots failed to precompile, with the error

Your GR installation is incomplete. Rerun build step for GR package.

ERROR: LoadError: LoadError: InitError: 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.

Now I've seen this a few times and indeed it's easy to fix with build GR, but of course it requires some sophistication on the part of the user to figure this out. In my case, the solution was to change my replication instructions to Pkg.add("Plots") first, then add Pluto - this way precompilation of Plots happens prior to starting Pluto, and (for another colleague) everything went smoothly.

While I appreciate that this issue will be hard to address given that Plots precompilation can be a bit... unpredictable, I hope it can at least serve as a starting point for thinking about how these types of issues can be dealt with in general, now that package management in notebooks happens "automagically".

fonsp commented 2 years ago

My hope is that Pluto simply wraps around Pkg, and the Pkg - together with the packages themselves - is responsible for making everything download, build and run correctly. This seems to work well for almost all packages, except Plots.

We could check for notebooks that import Plots and print that error message, and then call Pkg.build( "GR"). But why doesn't Plots do this automatically? It seems silly that we would have to create a workaround. I definitely don't feel motivated to do it ☹️

If this situation comes up with another package, then we have more reason to invest in a more general "rebuild and rerun" system.