# (very) Long compilation time when adding packages to Google Colab

**URL:** <https://discourse.julialang.org/t/very-long-compilation-time-when-adding-packages-to-google-colab/134166>\
**Category:** General Usage\
**Tags:** colab\
**Created:** [November 27, 2025, 4:48pm UTC](https://discourse.julialang.org/t/very-long-compilation-time-when-adding-packages-to-google-colab/134166 "2025-11-27T16:48:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SGSGSG](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sgsgsg/32/219568_2.png) [@SGSGSG](https://discourse.julialang.org/u/SGSGSG)\
**Post date:** [November 27, 2025, 4:48pm UTC](https://discourse.julialang.org/t/very-long-compilation-time-when-adding-packages-to-google-colab/134166/1 "2025-11-27T16:48:46Z")

</div>

I really enjoy Julia’s support on Google Colab!  
One annoying issue is that adding packages (even simple ones) leads to an endless (pre (?)-)compilation process.  
For instance:

`import Pkg; Pkg.add(["Bootstrap"]);`

still running after 15 min of wait…

Is there a workaround?

Thanks!

---

<div class="post-metadata">

**Author:** ![f-fathurrahman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/f-fathurrahman/32/8847_2.png) [@f-fathurrahman](https://discourse.julialang.org/u/f-fathurrahman)\
**Post date:** [November 27, 2025, 10:35pm UTC](https://discourse.julialang.org/t/very-long-compilation-time-when-adding-packages-to-google-colab/134166/2 "2025-11-27T22:35:24Z")

</div>

I also encountered this problem several days ago. In my case adding a package from Github ended up taking more than 30 minutes (I gave up after around 30 minutes).

Probably you can try activating new environment before adding the packages.

```julia-auto
Pkg.activate("NewEnv", shared=true)
Pkg.add("Bootstrap")

```

I just tried this and in my case the precompilation time is faster.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [November 28, 2025, 10:36am UTC](https://discourse.julialang.org/t/very-long-compilation-time-when-adding-packages-to-google-colab/134166/3 "2025-11-28T10:36:27Z")

</div>

There are env variables you can set which control what packages are allowed to update when installing new ones. You can pick one of the more conservative ones which should avoid re-precompiling all the packages shipped with the default env. Quoting from Pkg.jl’s changelog:

> - To reduce the amount of time spent downloading and precompiling new package versions when working with multiple  
> environments, a new preserve strategy `PRESERVE_ALL_INSTALLED` has been added which will preserve all existing  
> dependencies and only add versions of the new packages that are already installed. i.e. `pkg> add --preserve=installed Foo`.  
> Also a new tiered resolve strategy `PRESERVE_TIERED_INSTALLED` that tries this first, which can be set to the default  
> strategy by setting the env var `JULIA_PKG_PRESERVE_TIERED_INSTALLED` to `true` ([#3378]).

---

<div class="post-metadata">

**Author:** ![pitsianis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pitsianis/32/26588_2.png) [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Post date:** [December 1, 2025, 10:39am UTC](https://discourse.julialang.org/t/very-long-compilation-time-when-adding-packages-to-google-colab/134166/4 "2025-12-01T10:39:16Z")

</div>

For the noobs among us, please provide explicit instructions or perhaps share the link to a couple preconfigured notebooks (one with CUDA and one without?) with the absolute minimal that we can copy and extend upon.

I am really happy that Google is providing this service. With a little extra attention we can make it very practical and useful in learning and exploration. Not all of us need `Lux` and `Enzyme` and `Rmath` etc, we could save a lot of time in compute and downloads by being able to extend an empty Project per notebook.
