julia icon indicating copy to clipboard operation
julia copied to clipboard

nightly: Cannot load Pkg and REPL in module on LOAD_PATH if REPLExt is in no environment

Open pfitzseb opened this issue 6 months ago • 1 comments

Repro:

  • Make sure your global env is empty.
  • Create a new package that depends on Pkg and REPL
  • Put that package on LOAD_PATH and try to using it:
❯ tree
.
└── Foo
    ├── Project.toml
    └── src
        └── Foo.jl

3 directories, 2 files

❯ cat Foo/Project.toml
name="Foo"

[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

❯ cat Foo/src/Foo.jl
module Foo

using REPL, Pkg

end

❯ ~/Documents/Git/julia/usr/bin/julia -e 'pushfirst!(LOAD_PATH, pwd()); using Foo'
┌ Error: Error during loading of extension REPLExt of Pkg, use `Base.retry_load_extensions()` to retry.
│   exception =
│    1-element ExceptionStack:
│    ArgumentError: Package REPLExt [e5eb5ef1-03cf-53a7-ae1d-5a66b08e832b] is required but does not seem to be installed:
│     - Run `Pkg.instantiate()` to install all recorded dependencies.
│
│    Stacktrace:
│      [1] _require(pkg::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:2152
│      [2] __require_prelocked(uuidkey::Base.PkgId, env::Nothing)
│        @ Base ./loading.jl:2033
│      [3] #invoke_in_world#3
│        @ ./essentials.jl:1064 [inlined]
│      [4] invoke_in_world
│        @ ./essentials.jl:1061 [inlined]
│      [5] _require_prelocked
│        @ ./loading.jl:2024 [inlined]
...
│     [25] _start()
│        @ Base ./client.jl:525
└ @ Base loading.jl:1426
┌ Warning: The call to compilecache failed to create a usable precompiled cache file for Foo [a0f744ce-4535-5630-8809-367301d68e22]
│   exception = nothing
└ @ Base loading.jl:2222

In a way this direct LOAD_PATH manipulation is pretty unidiomatic, but it still feels like this shouldn't fail to me.

pfitzseb avatar Feb 16 '24 16:02 pfitzseb

A lot of work on this in https://github.com/JuliaLang/julia/pull/53326, although the correct lookup of the extensions is still a broken aspect on that PR

vtjnash avatar Feb 16 '24 16:02 vtjnash