Skip to content

"ArgumentError: Package FooBarExt does not have Bar in its dependencies" when dep in extension (rather than weakdep) #55939

@topolarity

Description

@topolarity

This is an interesting one...

$ cat Foo/Project.toml
name = "Foo"
uuid = "9b094d01-e697-4a76-8fe8-871656a862e0"
authors = ["Cody Tapscott <topolarity@tapscott.me>"]
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:558in expression starting at /home/topolarity/repos/julia/Foo/ext/FooBarExt.jl:1in 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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorpackage extensions

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions