"ArgumentError: Package FooBarExt does not have Bar in its dependencies" when `dep` in extension (rather than `weakdep`)
This is an interesting one...
$ cat Foo/Project.toml
name = "Foo"
uuid = "9b094d01-e697-4a76-8fe8-871656a862e0"
authors = ["Cody Tapscott <[email protected]>"]
version = "0.1.0"
[deps]
Bar = "ed96e9dd-c367-45ab-9d59-befe4c57f37f"
[weakdeps]
Baz = "5796e38b-8bd2-4f06-8c98-e0a8826bb787"
[extensions]
FooBarExt = "Bar"
The presence of Baz in [weakdeps] seems to "revoke" FooBarExt's rights to using Bar somehow:
$ ./julia --project=testenv -q
julia> using Foo, Bar
Info Given FooBarExt was explicitly requested, output will be shown live
ERROR: LoadError: ArgumentError: Package FooBarExt does not have Bar in its dependencies:
- Note that the following manifests in the load path were resolved with a potentially
different DEV version of the current version, which may be the cause of the error.
Try to re-resolve them in the current version, or consider deleting them if that fails:
/home/topolarity/repos/julia/testenv/Manifest.toml
/home/topolarity/.julia/environments/v1.12/Manifest.toml
- You may have a partially installed environment. Try `Pkg.instantiate()`
to ensure all packages in the environment are installed.
- Or, if you have FooBarExt checked out for development and have
added Bar as a dependency but haven't updated your primary
environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with FooBarExt
Stacktrace:
[1] macro expansion
@ ./loading.jl:2262 [inlined]
[2] macro expansion
@ ./lock.jl:287 [inlined]
[3] __require(into::Module, mod::Symbol)
@ Base ./loading.jl:2234
[4] #invoke_in_world#2
@ ./essentials.jl:1082 [inlined]
[5] invoke_in_world
@ ./essentials.jl:1079 [inlined]
[6] require(into::Module, mod::Symbol)
@ Base ./loading.jl:2227
[7] include
@ ./Base.jl:582 [inlined]
[8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
@ Base ./loading.jl:2825
[9] top-level scope
@ stdin:5
[10] eval
@ ./boot.jl:439 [inlined]
[11] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
@ Base ./loading.jl:2678
[12] include_string
@ ./loading.jl:2688 [inlined]
[13] exec_options(opts::Base.JLOptions)
@ Base ./client.jl:327
[14] _start()
@ Base ./client.jl:558
in expression starting at /home/topolarity/repos/julia/Foo/ext/FooBarExt.jl:1
in expression starting at stdin:5
✗ Foo → FooBarExt
Precompiling FooBarExt finished.
0 dependencies successfully precompiled in 1 seconds. 2 already precompiled.
┌ Error: Error during loading of extension FooBarExt of Foo, use `Base.retry_load_extensions()` to retry.
│ exception =
│ 1-element ExceptionStack:
│ The following 1 direct dependency failed to precompile:
│
│ FooBarExt
│
│ Failed to precompile FooBarExt [1cbedc19-d9e5-5698-ba6d-aa629f4ffcbf] to "/home/topolarity/.julia/compiled/v1.12/FooBarExt/jl_UIHQPh".
│ ERROR: LoadError: ArgumentError: Package FooBarExt does not have Bar in its dependencies:
│ - Note that the following manifests in the load path were resolved with a potentially
│ different DEV version of the current version, which may be the cause of the error.
│ Try to re-resolve them in the current version, or consider deleting them if that fails:
│ /home/topolarity/repos/julia/testenv/Manifest.toml
│ /home/topolarity/.julia/environments/v1.12/Manifest.toml
│ - You may have a partially installed environment. Try `Pkg.instantiate()`
│ to ensure all packages in the environment are installed.
│ - Or, if you have FooBarExt checked out for development and have
│ added Bar as a dependency but haven't updated your primary
│ environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with FooBarExt
│ Stacktrace:
│ [1] macro expansion
│ @ ./loading.jl:2262 [inlined]
│ [2] macro expansion
│ @ ./lock.jl:287 [inlined]
│ [3] __require(into::Module, mod::Symbol)
│ @ Base ./loading.jl:2234
│ [4] #invoke_in_world#2
│ @ ./essentials.jl:1082 [inlined]
│ [5] invoke_in_world
│ @ ./essentials.jl:1079 [inlined]
│ [6] require(into::Module, mod::Symbol)
│ @ Base ./loading.jl:2227
│ [7] include
│ @ ./Base.jl:582 [inlined]
│ [8] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
│ @ Base ./loading.jl:2825
│ [9] top-level scope
│ @ stdin:5
│ [10] eval
│ @ ./boot.jl:439 [inlined]
│ [11] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
│ @ Base ./loading.jl:2678
│ [12] include_string
│ @ ./loading.jl:2688 [inlined]
│ [13] exec_options(opts::Base.JLOptions)
│ @ Base ./client.jl:327
│ [14] _start()
│ @ Base ./client.jl:558
│ in expression starting at /home/topolarity/repos/julia/Foo/ext/FooBarExt.jl:1
│ in expression starting at stdin:
└ @ Base loading.jl:1543
If the [weakdeps] section is removed and I re-resolve everything works fine:
julia +nightly --project=testenv -q
julia> using Foo, Bar
julia>
Happening on latest master (didn't test 1.10 / 1.11, since those don't allow for deps to be valid as an ext trigger like this)
I failed to reproduce this. Here is my attempt: https://github.com/JuliaLang/julia/commit/92c4bc9134bcc6e8b1a14f3bc57b20d628c1edec
~/julia/test/project/Extensions/BugDepLookup kc/deps_lookup_bug
❯ ~/julia/julia --project -q
(BugDepLookup) pkg> st
Project BugDepLookup v0.1.0
Status `~/julia/test/project/Extensions/BugDepLookup/Project.toml`
[678608ae] SomePackage v0.1.0 `../SomePackage`
julia> using BugDepLookup, SomePackage
julia> Base.get_extension(BugDepLookup, :SomePackageExt)
SomePackageExt
julia> exit()
~/julia/test/project/Extensions/BugDepLookup kc/deps_lookup_bug
❯ ~/julia/julia --project -q
(BugDepLookup) pkg> activate --temp
Activating new project at `/tmp/jl_JikKPp`
(jl_JikKPp) pkg> dev . ../SomePackage/
Resolving package versions...
Updating `/tmp/jl_JikKPp/Project.toml`
[9b094d01] + BugDepLookup v0.1.0 `../../home/kc/julia/test/project/Extensions/BugDepLookup`
[678608ae] + SomePackage v0.1.0 `../../home/kc/julia/test/project/Extensions/SomePackage`
Updating `/tmp/jl_JikKPp/Manifest.toml`
[9b094d01] + BugDepLookup v0.1.0 `../../home/kc/julia/test/project/Extensions/BugDepLookup`
[678608ae] + SomePackage v0.1.0 `../../home/kc/julia/test/project/Extensions/SomePackage`
julia> using BugDepLookup, SomePackage
julia> Base.get_extension(BugDepLookup, :SomePackageExt)
SomePackageExt
I think this code has to look in deps as well:
https://github.com/JuliaLang/julia/blob/04259daf8a339f99d7cd8503d9c1f154b247e4e1/base/loading.jl#L1003-L1019
That is what failed CI in https://github.com/JuliaLang/julia/pull/56234.
I believe https://github.com/JuliaLang/julia/pull/56234/commits/ad1dc390e3123b65433ee06a651ca6de88c29914 (that is in #56234) should fix this.
This should be fixed in upcoming 1.10.8 / current 1.11.2