Reasons that trigger precompilation?

I’m using Julia 1.7.2 mostly through Jupyter notebooks and I’m running into a weird thing. Often (but not always), restarting the kernel triggers a recompilations of some key packages (GLM, Flux, CUDA, PyCall, among others). This happens without any changes to the environment and I don’t understand what triggers it. It’s annoying because even on a powerful machine, it takes a few minutes until the notebook is ready.

The first cell in every notebook always looks like this:

using DrWatson
@quickactivate "project_name"

Any advice on what is happening or at least on how I can find out what triggers this?

1 Like

I came looking for this question as well. I read here that recompilation happens when methods are at risk of being invalidated (or julia version changes). So I guess maybe a more direct question is “How do I make sure that a big project or notebook never (or rarely) has invalidated methods?”