Skip to content

Instantly share code, notes, and snippets.

@peteristhegreat
Created August 8, 2019 21:00
Show Gist options
  • Save peteristhegreat/412273ac6ecd5fec10993de9da8e691c to your computer and use it in GitHub Desktop.
Save peteristhegreat/412273ac6ecd5fec10993de9da8e691c to your computer and use it in GitHub Desktop.
Pkg3 Pkg.jl Julia ERROR: MethodError: no method matching getindex(::Nothing, ::String)

This happens shortly after one of the Installing PackageXXX lines, and crashes the Pkg.instantiate().
Rerunning Pkg.instantiate() seems to ignore the error, but doesn't fix it.

ERROR: MethodError: no method matching getindex(::Nothing, ::String)
Stacktrace:
 [1] #build_versions#47(::Bool, ::Function, ::Pkg.Types.Context, ::Array{Base.UUID,1}) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1044
 [2] build_versions at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1033 [inlined]
 [3] up(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1247
 [4] #up#31(::Pkg.Types.UpgradeLevel, ::Pkg.Types.PackageMode, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:203
 [5] #up at ./none:0 [inlined]
 [6] #up#26 at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:168 [inlined]
 [7] #up at ./none:0 [inlined]
 [8] resolve at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:208 [inlined]
 [9] do_resolve!(::Dict{Symbol,Any}, ::Array{String,1}, ::Dict{Symbol,Any}) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:665
 [10] #invokelatest#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:697
 [11] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:696
 [12] do_cmd!(::Pkg.REPLMode.PkgCommand, ::REPL.LineEditREPL) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:603
 [13] #do_cmd#33(::Bool, ::Function, ::REPL.LineEditREPL, ::String) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:577
 [14] do_cmd at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:573 [inlined]
 [15] (::getfield(Pkg.REPLMode, Symbol("##50#53")){REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:923
 [16] #invokelatest#1 at ./essentials.jl:697 [inlined]
 [17] invokelatest at ./essentials.jl:696 [inlined]
 [18] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:2273
 [19] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:1034
 [20] run_repl(::REPL.AbstractREPL, ::Any) at /root/julia-1.0.5/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:191
 [21] (::getfield(Base, Symbol("##720#722")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:355
 [22] #invokelatest#1 at ./essentials.jl:697 [inlined]
 [23] invokelatest at ./essentials.jl:696 [inlined]
 [24] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:339
 [25] exec_options(::Base.JLOptions) at ./client.jl:277
 [26] _start() at ./client.jl:425

To fix it, you need to call Pkg.resolve().
This will find the orphans in the manifest file and clear up the issue, or at least highlight the real problem.

Also read the help for Pkg.rm (by typing ]?rm at the julia REPL).

So if you remove a package in the Manifest file but leave behind some orphans, you will likely have Pkg.instantiate() issues later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment