Compat bound violations with stacked environements

Every once in a while I run into annoying issues with invalidated pre-compilation (requiring re-generating these caching every-time I load Julia for the same project). This always turns out to be an issue with my base environment (e.g. 1.10) and my startup.jl file where I am loading, e.g. Infiltrator.jl or VimBindings.jl. Upgrading the packages in the base environment solves the problem. Usually I notice that the local project environment has some shared dependency that has an incompatible compat bound from the base environment. No such incampitbily is raised as an error/issue when adding a package. It seems like Pkg just ignores the compat bounds of the earlier environments in a stack. (But I don’t really know how stacked environments work).

I have never had good luck working out the exact steps to reproduce this problem exactly without some long complicated chain of dependencies, but it seems worth highlighting this problem to get a sense of how common it is among julia users. Have other folks run into this problem? Is this a known problem? If this is a known problem, is there any thinking on what a long-term fix would look like?

1 Like

I figured out a relatively simple way to reproduce something like this and made an issue Package extension loading issues in stacked environments · Issue #55033 · JuliaLang/julia · GitHub

Based on my understanding of Code Loading · The Julia Language this is sometimes useful because you may want to use your dev tools even if they are not fully compatible with the package you are developing.

I don’t know what a long term fix would be besides somehow detecting this issue and printing a warning message to update when it happens.

To mitigate these issues I try and keep my global evironment almost empty, and run julia scripts with: JULIA_LOAD_PATH="@" julia --project=<project dir> --startup-file=no <julia script> to disable stacking.