Avoiding recompilation with multiple projects?

I’ve been using a project based workflow where I have multiple projects that use different versions of the same packages: some use tagged versions, some use global dev versions, and some use local dev versions. This works very well with Atom’s notion of a project: I have my startup script automatically activate the open project.

The issue seems to be that anytime I switch between projects it seems to need to recompile everything. Worse, I get lots of errors like:

┌ Warning: Module Compat with build ID 1247947941331623 is missing from the cache.
│ This may mean Compat [34da2185-b29b-5c13-b0c7-acf172513d20] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:947

I was under the impression that Pkg3 could work with multiple versions of the same package and cache the results. Is there something I should change in my workflow to avoid the constant recompilation?

1 Like

Not an answer to your question - but how do you have Julia activate the open project in Atom?

See also How precompile files are loaded need to change if using multiple projects are going to be pleasant · Issue #27418 · JuliaLang/julia · GitHub, although that Compat error is probably another issue, see e.g. Precompilation Errors · Issue #636 · JuliaLang/Compat.jl · GitHub

Here’s my startup file:

try # avoid bug in building packages
	using LinearAlgebra, Pkg, SparseArrays, SpecialFunctions, Random, Test
	isfile("Project.toml") && Pkg.activate(".") # auto-activate Project in Juno

It works because Atom initialises the path to be the package folder.

1 Like

great tip - thanks!