Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow REPL to load with outdated manifests #53190

Closed
wants to merge 1 commit into from

Conversation

KristofferC
Copy link
Sponsor Member

If you have an older manifests where REPL did not depend on StyledStrings you cannot really start the Julia REPL anymore. This adds a fallback to load the REPL with the only the stdlib as the load path.

It is pretty ugly right now but it does start up...

❯ ~/julia/julia  --startup-file=no --project 
┌ Info: Precompiling REPL [3fa0cd96-eef1-5676-8a61-b3b8758bbffb] (cache misses: invalid header (10), mismatched flags (1), dep uuid changed (1))
└ @ Base loading.jl:2576
ERROR: LoadError: ArgumentError: Package REPL does not have StyledStrings in its dependencies:
- Note that the following manifests in the load path were resolved with a different
  julia version, which may be the cause of the error:
    /home/kc/.julia/environments/v1.10/Manifest.toml (v1.10.0)
- Note that the following manifests in the load path were resolved a potentially
  different DEV version of the current version, which may be the cause
  of the error:
    /home/kc/.julia/environments/v1.11/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 REPL checked out for development and have
  added StyledStrings 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 REPL
Stacktrace:
 [1] macro expansion
   @ ./loading.jl:1894 [inlined]
 [2] macro expansion
   @ ./lock.jl:273 [inlined]
 [3] __require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1870
 [4] #invoke_in_world#3
   @ ./essentials.jl:1059 [inlined]
 [5] invoke_in_world
   @ ./essentials.jl:1056 [inlined]
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1863
 [7] include
   @ ./Base.jl:556 [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:2427
 [9] top-level scope
   @ stdin:3
in expression starting at /home/kc/julia/usr/share/julia/stdlib/v1.11/REPL/src/REPL.jl:3
in expression starting at stdin:3
┌ Warning: REPL failed to load with LOAD_PATH: ["@", "@v#.#", "@stdlib"], try running `Pkg.resolve` to fix the issue
│   exception = (ErrorException("Failed to precompile REPL [3fa0cd96-eef1-5676-8a61-b3b8758bbffb] to \"/home/kc/.julia/compiled/v1.11/REPL/jl_nRuUNv\"."), Union{Ptr{Nothing}, Base.InterpreterIP}[Ptr{Nothing} @0x00007a3e30ab9ec0, Ptr{Nothing} @0x00007a3e3090c3a3, Ptr{Nothing} @0x00007a3e41904f67, Ptr{Nothing} @0x00007a3e41904fad, Ptr{Nothing} @0x00007a3e30e34775, Ptr{Nothing} @0x00007a3e41904e42, Ptr{Nothing} @0x00007a3e41904ef4, Ptr{Nothing} @0x00007a3e419015ca, Ptr{Nothing} @0x00007a3e41901661, Ptr{Nothing} @0x00007a3e4190169d, Ptr{Nothing} @0x00007a3e56e5ea4d, Ptr{Nothing} @0x00007a3e4190148c, Ptr{Nothing} @0x00007a3e56e5ea4d, Ptr{Nothing} @0x00007a3e419012e2, Ptr{Nothing} @0x00007a3e56e5c7dd, Ptr{Nothing} @0x00007a3e30bb7a70, Ptr{Nothing} @0x00007a3e3097c8b7, Ptr{Nothing} @0x00007a3e309091ec, Ptr{Nothing} @0x00007a3e30e4f6e6, Ptr{Nothing} @0x00007a3e56e5c97d, Ptr{Nothing} @0x00007a3e30d3d06a, Ptr{Nothing} @0x00007a3e30bf21f0, Ptr{Nothing} @0x00007a3e30c85437, Ptr{Nothing} @0x00007a3e30e41697, Ptr{Nothing} @0x00007a3e309898a0, Ptr{Nothing} @0x00007a3e56ec6275, Ptr{Nothing} @0x00007a3e56ec6eec, Ptr{Nothing} @0x00005e7a3ee9808c, Ptr{Nothing} @0x00007a3e57e29d8f, Ptr{Nothing} @0x00007a3e57e29e3f, Ptr{Nothing} @0x00005e7a3ee980c4])
└ @ Base client.jl:418
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.0-DEV.1477 (2024-02-05)
 _/ |\__'_|_|_|\__'_|  |  kc/m/5497749a5a* (fork: 3 commits, 0 days)
|__/                   |

julia> 

@KristofferC KristofferC added the domain:packages Package management and loading label Feb 5, 2024
@oscardssmith
Copy link
Member

oscardssmith commented Feb 5, 2024

Should we have a similar behavior for other stdlibs? We ran into this for Pkg earlier.

@IanButterworth
Copy link
Sponsor Member

Alternatively the warning could explicitly suggest deleting the Manifest.toml (it's implicit, but too implicit, it seems)

- Note that the following manifests in the load path were resolved with a different
  julia version, which may be the cause of the error. Consider deleting this Manifest.toml:
    /home/kc/.julia/environments/v1.10/Manifest.toml (v1.10.0)

Copy link
Sponsor Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside: I wish that Base.require was more natively capable of doing this "load from Manifest" operation, rather than introducing even more data races into the already messy loading code.

Maybe we could do a ScopedValue to hold the Manifest.toml (making loading ignore the globals), now that we have those and they propagate to new Tasks?

@vchuravy
Copy link
Member

vchuravy commented Feb 6, 2024

If you have an older manifests where REPL did not depend on StyledStrings you cannot really start the Julia REPL anymore.

Are we not automatically executing the fallback repl? Would JULIA_FALLBACK_REPL=1 julia be enough to get a working Pkg?

@vtjnash
Copy link
Sponsor Member

vtjnash commented Feb 6, 2024

Pkg has a dependency on loading the REPL, so loading Pkg in an older environment fails also

$ ./julia --project=~/.julia/environments/v1.10 -e 'using Pkg'
ERROR: LoadError: ArgumentError: Package REPL does not have StyledStrings in its dependencies:
...
ERROR: Failed to precompile Pkg [44cfe95a-1eb2-52ea-b672-e2afdf69b78f] to "/home/vtjnash/.julia/compiled/v1.11/Pkg/jl_YENgI6".
...

@KristofferC
Copy link
Sponsor Member Author

I would say subsumed by #53326

@vtjnash vtjnash deleted the kc/load_repl_fallback branch February 15, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:packages Package management and loading
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants