Cache misses when 'using' packages since upgrading to 1.11

Here’s a proposal to change “invalid header” to “incompatible header”.

@Eliassj I suspect what’s happening in your case is indicated by wrong dep version loaded (1). It seems like you’ve loaded a package from within another environment before trying to load Verify in a different environment, which has a common dependency/ies that differ in version to the current environment.

A classic way this happens is

$ julia
# startup.jl runs loading, say Revise, from your default env
pkg> activate MyProject
julia> using Verify
# Julia precompiles Verify, but only considering the active env, not the 
# default env higher in the env stack, but some deps are already loaded by Revise
#
# Julia tries to load verify that it just precompiled but because different 
# dep versions are loaded it cannot, so has to precompile new versions with 
# those versions, which it does in the serial precompile process starting with
# [ Info: Precompiling

It’s an unfortunate limitation of stacked environments. Ways to avoid it:

  1. Always start up julia in the environment you are going to use, via --project, that way common dependencies will be the versions your env needs. i.e. avoid pkg> activate
  2. Avoid using startup.jl to load packages if you’re going to be switching project after launch, and only load once you’re in the main env.
  3. Use workspaces instead of the default env for common deps, which are coming in 1.12 10. Project.toml and Manifest.toml · Pkg.jl
  4. The ability to unload packages is added to julia… or something like that… There is some work around that ongoing.
6 Likes