# Reasons that trigger precompilation?

**URL:** <https://discourse.julialang.org/t/reasons-that-trigger-precompilation/82625>\
**Category:** General Usage\
**Tags:** precompilation\
**Created:** [June 12, 2022, 8:33am UTC](https://discourse.julialang.org/t/reasons-that-trigger-precompilation/82625 "2022-06-12T08:33:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcpabst](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@marcpabst](https://discourse.julialang.org/u/marcpabst)\
**Post date:** [June 12, 2022, 8:33am UTC](https://discourse.julialang.org/t/reasons-that-trigger-precompilation/82625/1 "2022-06-12T08:33:43Z")

</div>

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:

```julia
using DrWatson
cd("/home/.../.../repos/project_name/")
@quickactivate "project_name"
println(gethostname())

```

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

---

<div class="post-metadata">

**Author:** ![cdawg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cdawg/32/9811_2.png) [@cdawg](https://discourse.julialang.org/u/cdawg)\
**Post date:** [June 17, 2022, 9:33am UTC](https://discourse.julialang.org/t/reasons-that-trigger-precompilation/82625/2 "2022-06-17T09:33:34Z")

</div>

I came looking for this question as well. I read [here](https://discourse.julialang.org/t/precompile-why/78770) 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?”
