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

Cannot convert an object of type Pkg.Types.VersionSpec to an object of type VersionNumber #1570

Closed
timholy opened this issue Dec 30, 2019 · 29 comments
Labels

Comments

@timholy
Copy link
Member

timholy commented Dec 30, 2019

(@v1.4) pkg> free Graphics ProfileView ImageMorphology
ERROR: MethodError: Cannot `convert` an object of type Pkg.Types.VersionSpec to an object of type VersionNumber
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:171
Stacktrace:
 [1] convert(::Type{Union{Nothing, VersionNumber}}, ::Pkg.Types.VersionSpec) at ./some.jl:34
 [2] Pkg.Types.PackageEntry(::String, ::Pkg.Types.VersionSpec, ::Nothing, ::Bool, ::Pkg.Types.GitRepo, ::Nothing, ::Dict{String,Base.UUID}, ::Nothing) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/Types.jl:222
 [3] Pkg.Types.PackageEntry(; name::String, version::Pkg.Types.VersionSpec, path::Nothing, pinned::Bool, repo::Pkg.Types.GitRepo, tree_hash::Nothing, deps::Dict{String,Base.UUID}, other::Nothing) at ./util.jl:736
 [4] update_manifest!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:120
 [5] free(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:1240
 [6] free(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:287
 [7] free at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:268 [inlined]
 [8] #free#59 at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:265 [inlined]
 [9] free(::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:265
 [10] do_cmd!(::Pkg.REPLMode.Command, ::REPL.LineEditREPL) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/REPLMode/REPLMode.jl:403
 [11] do_cmd(::REPL.LineEditREPL, ::String; do_rethrow::Bool) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/REPLMode/REPLMode.jl:381
 [12] do_cmd at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/REPLMode/REPLMode.jl:376 [inlined]
 [13] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/Pkg/src/REPLMode/REPLMode.jl:542
 [14] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [15] invokelatest at ./essentials.jl:711 [inlined]
 [16] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
 [17] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
 [18] run_repl(::REPL.AbstractREPL, ::Any) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
 [19] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
 [20] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [21] invokelatest at ./essentials.jl:711 [inlined]
 [22] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
 [23] exec_options(::Base.JLOptions) at ./client.jl:305
 [24] _start() at ./client.jl:484

julia> versioninfo()
Julia Version 1.4.0-DEV.668
Commit 0570202e5f* (2019-12-28 22:20 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = atom  -a
  JULIA_NUM_THREADS = 6
  JULIA_CPU_THREADS = 4
@timholy
Copy link
Member Author

timholy commented Dec 30, 2019

The oddity is the path for Graphics:

(@v1.4) pkg> st
Status `~/.julia/environments/v1.4/Project.toml`
  [c52e3926] Atom v0.11.3
  [39de3d68] AxisArrays v0.3.3
  [6e4b80f9] BenchmarkTools v0.4.3
  [336ed68f] CSV v0.5.21
  [159f3aea] Cairo v1.0.1 [`~/.julia/dev/Cairo`]
  [aafaddc9] CatIndices v0.2.0
  [da1fd8a2] CodeTracking v0.5.8
  [31a5f54b] Debugger v0.6.2
  [e30172f5] Documenter v0.24.3
  [35a29f4d] DocumenterTools v0.1.3
  [97e2ac4a] EponymTuples v0.2.2
  [7876af07] Example v0.5.3
  [7a1cc6ca] FFTW v1.2.0
  [5789e2e9] FileIO v1.2.0
  [a2bd30eb] Graphics v1.0.1 [`../../dev/Graphics`]
  [27996c0f] GtkReactive v1.0.2
  [bbac6d45] IdentityRanges v0.3.0
  [2803e5a7] ImageAxes v0.6.2 [`~/.julia/dev/ImageAxes`]
  [a09fc81d] ImageCore v0.8.8 [`~/.julia/dev/ImageCore`]
  [51556ac3] ImageDistances v0.2.7 [`~/.julia/dev/ImageDistances`]
  [6a3955dd] ImageFiltering v0.6.8
  [bc367c6b] ImageMetadata v0.8.0
  [787d08f9] ImageMorphology v0.2.5 [`~/.julia/dev/ImageMorphology`]
  [02fcd773] ImageTransformations v0.8.1 [`~/.julia/dev/ImageTransformations`]
  [86fae568] ImageView v0.10.3 [`~/.julia/dev/ImageView`]
  [916415d5] Images v0.19.2 [`~/.julia/dev/Images`]
  [8197267c] IntervalSets v0.3.2
  [4138dd39] JLD v0.9.1
  [033835bb] JLD2 v0.1.10
  [aa1ae85d] JuliaInterpreter v0.7.7
  [e5e0dc1b] Juno v0.7.2
  [6f1432cf] LoweredCodeUtils v0.4.2
  [dbb5928d] MappedArrays v0.2.2
  [6fe1bfb0] OffsetArrays v0.11.4
  [bac558e1] OrderedCollections v1.1.0
  [14b8a8f1] PkgTemplates v0.6.3
  [c46f51b8] ProfileView v0.5.2 [`~/.julia/dev/ProfileView`]
  [ae029012] Requires v0.5.2
  [295af30f] Revise v2.5.0
  [aa65fe97] SnoopCompile v1.1.0
  [90137ffa] StaticArrays v0.12.1
  [2913bbd2] StatsBase v0.32.0
  [83775a58] Zlib_jll v1.2.11+7
  [3161d3a3] Zstd_jll v1.4.2+0

@00vareladavid
Copy link
Contributor

That's a bit troubling. I took a look and nothing stands out as problematic.

I've also tried to reproduce to no avail:

(poiqwer) pkg> status
Status `/tmp/poiqwer/Project.toml`
  [7876af07] Example v0.5.3
  [a2bd30eb] Graphics v1.0.1 [`../../home/david/.julia/dev/Graphics`]
  [787d08f9] ImageMorphology v0.2.5 [`~/.julia/dev/ImageMorphology`]
  [c46f51b8] ProfileView v0.5.2 [`~/.julia/dev/ProfileView`]

(poiqwer) pkg> free Graphics ImageMorphology ProfileView
  Updating `/tmp/poiqwer/Project.toml`
  [a2bd30eb] ~ Graphics v1.0.1 [`../../home/david/.julia/dev/Graphics`] ⇒ v1.0.1
  [787d08f9] ~ ImageMorphology v0.2.5 [`~/.julia/dev/ImageMorphology`] ⇒ v0.2.5
  [c46f51b8] ~ ProfileView v0.5.2 [`~/.julia/dev/ProfileView`] ⇒ v0.5.2
  Updating `/tmp/poiqwer/Manifest.toml`
  [a2bd30eb] ~ Graphics v1.0.1 [`../../home/david/.julia/dev/Graphics`] ⇒ v1.0.1
  [787d08f9] ~ ImageMorphology v0.2.5 [`~/.julia/dev/ImageMorphology`] ⇒ v0.2.5
  [c46f51b8] ~ ProfileView v0.5.2 [`~/.julia/dev/ProfileView`] ⇒ v0.5.2

The path for Graphics looks fine if you directly developed it. (ie joinpath("/home/user/.julia/environments/v1.4", "../../dev/Graphics") seems like it would resolve to the correct location).

It difficult to proceed further without the offending TOML files. Do you still have access to them?

@timholy
Copy link
Member Author

timholy commented Dec 31, 2019

I wondered if you might want them so I made a copy: https://gist.github.com/timholy/4705c98a915028cc8116f2572e619a08

@baggepinnen
Copy link

It also appeared for me doing dev

(@v1.4) pkg> dev [email protected]:baggepinnen/BlobTracking.jl.git
    Cloning git-repo `[email protected]:baggepinnen/BlobTracking.jl.git`
Path `/home/fredrikb/.julia/dev/BlobTracking` exists and looks like the correct package. Using existing path.
  Resolving package versions...
ERROR: MethodError: Cannot `convert` an object of type Pkg.Types.VersionSpec to an object of type VersionNumber
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:171
Stacktrace:
 [1] convert(::Type{Union{Nothing, VersionNumber}}, ::Pkg.Types.VersionSpec) at ./some.jl:34
 [2] Pkg.Types.PackageEntry(::String, ::Pkg.Types.VersionSpec, ::Nothing, ::Bool, ::Pkg.Types.GitRepo, ::Nothing, ::Dict{String,Base.UUID}, ::Nothing) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/Types.jl:218
 [3] Pkg.Types.PackageEntry(; name::String, version::Pkg.Types.VersionSpec, path::Nothing, pinned::Bool, repo::Pkg.Types.GitRepo, tree_hash::Nothing, deps::Dict{String,Base.UUID}, other::Nothing) at ./util.jl:742
 [4] update_manifest!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:120
 [5] develop(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/Operations.jl:1102
 [6] develop(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; shared::Bool, preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:102
 [7] develop(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:63
 [8] #develop#15 at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:60 [inlined]
 [9] develop(::Array{Pkg.Types.PackageSpec,1}) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/API.jl:60
 [10] do_cmd!(::Pkg.REPLMode.Command, ::REPL.LineEditREPL) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/REPLMode/REPLMode.jl:403
 [11] do_cmd(::REPL.LineEditREPL, ::String; do_rethrow::Bool) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/REPLMode/REPLMode.jl:381
 [12] do_cmd at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/REPLMode/REPLMode.jl:376 [inlined]
 [13] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/Pkg/src/REPLMode/REPLMode.jl:542
 [14] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [15] invokelatest at ./essentials.jl:711 [inlined]
 [16] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
 [17] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
 [18] run_repl(::REPL.AbstractREPL, ::Any) at /home/fredrikb/julia/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
 [19] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
 [20] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [21] invokelatest at ./essentials.jl:711 [inlined]
 [22] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
 [23] exec_options(::Base.JLOptions) at ./client.jl:305
 [24] _start() at ./client.jl:484

@00vareladavid
Copy link
Contributor

@baggepinnen are you using any custom registries or only General?

I ran the TOML files that @timholy provided, but I was not able to reproduce. The only two other inputs to Pkg are the project files of dependencies and the registries themselves. The former has a really small surface area and I couldn't find anything wrong, so I'm guessing that there is some bad registry state that we aren't detecting

@baggepinnen
Copy link

I was only using general

@timholy
Copy link
Member Author

timholy commented Jan 18, 2020

I did a registry rm HolyLabRegistry so that I was only using General, and then added

@show pkg pkg.version typeof(pkg.version)

here and did a Revise.track(Pkg). I got this:

(@v1.5) pkg> add TerminalRegressionTests
 Resolving package versions...
pkg = PackageSpec(
  name = TerminalRegressionTests
  uuid = 98bfdc55-cc95-5876-a49a-74609291cbe0
  version = *
)
pkg.version = VersionSpec("*")
typeof(pkg.version) = Pkg.Types.VersionSpec
ERROR: MethodError: Cannot `convert` an object of type Pkg.Types.VersionSpec to an object of type VersionNumber
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:171
Stacktrace:
 [1] convert(::Type{Union{Nothing, VersionNumber}}, ::Pkg.Types.VersionSpec) at ./some.jl:34
 [2] Pkg.Types.PackageEntry(::String, ::Pkg.Types.VersionSpec, ::Nothing, ::Bool, ::Pkg.Types.GitRepo, ::Nothing, ::Dict{String,Base.UUID}, ::Nothing) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/Types.jl:222
 [3] Pkg.Types.PackageEntry(; name::String, version::Pkg.Types.VersionSpec, path::Nothing, pinned::Bool, repo::Pkg.Types.GitRepo, tree_hash::Nothing, deps::Dict{String,Base.UUID}, other::Nothing) at ./util.jl:745
 [4] update_manifest!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:121
 [5] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/Operations.jl:1071
 [6] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:159
 [7] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:112
 [8] #add#27 at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:109 [inlined]
 [9] add(::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/API.jl:109
 [10] do_cmd!(::Pkg.REPLMode.Command, ::REPL.LineEditREPL) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/REPLMode/REPLMode.jl:403
 [11] do_cmd(::REPL.LineEditREPL, ::String; do_rethrow::Bool) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/REPLMode/REPLMode.jl:381
 [12] do_cmd at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/REPLMode/REPLMode.jl:376 [inlined]
 [13] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/Pkg/src/REPLMode/REPLMode.jl:542
 [14] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [15] invokelatest at ./essentials.jl:709 [inlined]
 [16] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2354
 [17] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1055
 [18] run_repl(::REPL.AbstractREPL, ::Any) at /home/tim/src/julia-master/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:206
 [19] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
 [20] #invokelatest#1 at ./essentials.jl:710 [inlined]
 [21] invokelatest at ./essentials.jl:709 [inlined]
 [22] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
 [23] exec_options(::Base.JLOptions) at ./client.jl:305
 [24] _start() at ./client.jl:484

@timholy
Copy link
Member Author

timholy commented Jan 18, 2020

The cause appears to be that TerminalRegressionTests's UUID doesn't end up being a key in vers:

vers = Resolve.resolve(graph)
. Consequently it gets left as * rather than being a specific version.

As far as I can tell, this package is removed during graph simplification by prune_graph!.

@timholy
Copy link
Member Author

timholy commented Jan 18, 2020

OK, here's a theory: I have TerminalRegressionTests devved with local modifications, and these include bumping the Project.toml version to 0.1.2 which is a version that is not in the registry. It seems to get screened out at the pkg_mask stage of prune_graph!.

This seems likely to be the reason you've not been able to replicate it: while I gave you my Manifest.toml and Project.toml, you didn't have the same devved local Project.toml modifications I had. Should I file this as an issue in it's own right? Do we need a Pkg.vacuum() to bundle up all the devved Project.tomls and submit them with a bug report?

EDIT: here's the Project.toml for my copy of TerminalRegressionTests:

name = "TerminalRegressionTests"
uuid = "98bfdc55-cc95-5876-a49a-74609291cbe0"
author = ["Keno Fischer <[email protected]>"]
version = "0.1.2"

[deps]
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
VT100 = "7774df62-37c0-5c21-b34d-f6d7f98f54bc"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
julia = "1.1"

[targets]
test = ["Test"]

@timholy
Copy link
Member Author

timholy commented Jan 18, 2020

Oh wait, that's not quite right, it's just that Keno wasn't running tagbot so the new release didn't show up. 0.1.2 is in the registry. Still, a lot of this analysis is correct.

@tlienart
Copy link

tlienart commented Feb 5, 2020

I ran into the exact same problem today, any idea how to get around the issue? the error is ... obscure... to say the least 😅 . thanks!

Edit: here's one crude way of getting around it which worked for me: just enter the Package name and UUID manually in the Project.toml, do a up and status and the package is there...

Edit2: I ended up having to go nuclear and remove my general project toml and start from scratch...

@00vareladavid
Copy link
Contributor

@tlienart were you also using developed packages?

@tlienart
Copy link

tlienart commented Feb 5, 2020

Yes, this happened with two packages that I'm developping

@timholy
Copy link
Member Author

timholy commented Apr 18, 2020

If someone can energetically work with me on this I can pause all Julia development until we get this fixed. But I can't afford to do that for long.

I think I have a better sense for what's going on, using this debugging diff:

tim@diva:~/src/Pkg.jl/src$ git diff
diff --git a/Project.toml b/Project.toml
index 4d32549..c87196a 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,5 +1,4 @@
 name = "Pkg"
-uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
 keywords = ["package management"]
 license = "MIT"
 desc = "The next-generation Julia package manager."
diff --git a/src/Operations.jl b/src/Operations.jl
index 7e679fe..a98c1b2 100644
--- a/src/Operations.jl
+++ b/src/Operations.jl
@@ -329,6 +329,14 @@ function resolve_versions!(ctx::Context, pkgs::Vector{PackageSpec})
     # fixed packages are `dev`ed or `add`ed by repo
     # at this point, fixed packages have a version and `deps`
 
+    seen = Set{UUID}()
+    for pkg in pkgs
+        if pkg.uuid ∈ seen
+            @warn("pkg appears twice: ", pkg)
+        end
+        push!(seen, pkg.uuid)
+    end
+
     # check compat
     for pkg in pkgs
         compat = project_compatibility(ctx, pkg.name)
@@ -367,6 +375,14 @@ function resolve_versions!(ctx::Context, pkgs::Vector{PackageSpec})
     # TODO: We already parse the Versions.toml file for each package in deps_graph but this
     # function ends up reparsing it. Consider caching the earlier result.
     load_tree_hashes!(ctx, pkgs)
+
+    for pkg in pkgs
+        v = get(fixed, pkg.uuid, nothing)
+        if v !== nothing
+            println(pkg)
+            println(v.version)
+        end
+    end
 end
 
 get_or_make!(d::Dict{K,V}, k::K) where {K,V} = get!(d, k) do; V() end
@@ -1055,6 +1071,7 @@ function tiered_resolve(ctx::Context, pkgs::Vector{PackageSpec})
 end
 
 function targeted_resolve(ctx::Context, pkgs::Vector{PackageSpec}, preserve::PreserveLevel)
+    @show pkgs preserve
     if preserve == PRESERVE_ALL
         pkgs = load_all_deps(ctx, pkgs)
     elseif preserve == PRESERVE_DIRECT

for which the output is:

julia> Pkg.develop("ColorVectorSpace")
Path `/home/tim/.julia/dev/ColorVectorSpace` exists and looks like the correct package. Using existing path.
  Resolving package versions...
pkgs = Pkg.Types.PackageSpec[PackageSpec(
  name = ColorVectorSpace
  uuid = c3611d14-8923-5661-9e6a-0046d554d3a4
  dev/path = /home/tim/.julia/dev/ColorVectorSpace
  version = *
)]
preserve = PRESERVE_ALL
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = ColorTypes
│      uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
│      dev/path = ../../dev/ColorTypes
│      version = v"0.10.2"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = Compat
│      uuid = 34da2185-b29b-5c13-b0c7-acf172513d20
│      dev/path = ../../dev/Compat
│      version = v"3.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = FixedPointNumbers
│      uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
│      dev/path = ../../dev/FixedPointNumbers
│      version = v"0.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
pkgs = Pkg.Types.PackageSpec[PackageSpec(
  name = ColorVectorSpace
  uuid = c3611d14-8923-5661-9e6a-0046d554d3a4
  dev/path = /home/tim/.julia/dev/ColorVectorSpace
  version = v"0.8.4"
)]
preserve = PRESERVE_DIRECT
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = ColorTypes
│      uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
│      dev/path = ../../dev/ColorTypes
│      version = v"0.10.2"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = Compat
│      uuid = 34da2185-b29b-5c13-b0c7-acf172513d20
│      dev/path = ../../dev/Compat
│      version = v"3.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = FixedPointNumbers
│      uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
│      dev/path = ../../dev/FixedPointNumbers
│      version = v"0.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
pkgs = Pkg.Types.PackageSpec[PackageSpec(
  name = ColorVectorSpace
  uuid = c3611d14-8923-5661-9e6a-0046d554d3a4
  dev/path = /home/tim/.julia/dev/ColorVectorSpace
  version = v"0.8.4"
)]
preserve = PRESERVE_SEMVER
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = ColorTypes
│      uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
│      dev/path = ../../dev/ColorTypes
│      version = v"0.10.2"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = Compat
│      uuid = 34da2185-b29b-5c13-b0c7-acf172513d20
│      dev/path = ../../dev/Compat
│      version = v"3.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = FixedPointNumbers
│      uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
│      dev/path = ../../dev/FixedPointNumbers
│      version = v"0.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
pkgs = Pkg.Types.PackageSpec[PackageSpec(
  name = ColorVectorSpace
  uuid = c3611d14-8923-5661-9e6a-0046d554d3a4
  dev/path = /home/tim/.julia/dev/ColorVectorSpace
  version = v"0.8.4"
)]
preserve = PRESERVE_NONE
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = ColorTypes
│      uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
│      dev/path = ../../dev/ColorTypes
│      version = v"0.10.2"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = Compat
│      uuid = 34da2185-b29b-5c13-b0c7-acf172513d20
│      dev/path = ../../dev/Compat
│      version = v"3.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = FixedPointNumbers
│      uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
│      dev/path = ../../dev/FixedPointNumbers
│      version = v"0.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:335
PackageSpec(
  name = ColorVectorSpace
  uuid = c3611d14-8923-5661-9e6a-0046d554d3a4
  dev/path = /home/tim/.julia/dev/ColorVectorSpace
  version = v"0.8.4"
)
0.8.4
PackageSpec(
  name = Compat
  uuid = 34da2185-b29b-5c13-b0c7-acf172513d20
  version = *
)
3.8.0
PackageSpec(
  name = FixedPointNumbers
  uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
  version = *
)
0.8.0
PackageSpec(
  name = ColorTypes
  uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
  version = *
)
0.10.2
PackageSpec(
  name = ImageSegmentation
  uuid = 80713f31-8817-5129-9cf8-209ff8fb23e1
  dev/path = /home/tim/.julia/dev/ImageSegmentation
  version = v"1.4.2"
)
1.4.2
PackageSpec(
  name = ColorTypes
  uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
  dev/path = ../../dev/ColorTypes
  version = v"0.10.2"
)
0.10.2
PackageSpec(
  name = Compat
  uuid = 34da2185-b29b-5c13-b0c7-acf172513d20
  dev/path = ../../dev/Compat
  version = v"3.8.0"
)
3.8.0
PackageSpec(
  name = FixedPointNumbers
  uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
  dev/path = ../../dev/FixedPointNumbers
  version = v"0.8.0"
)
0.8.0
ERROR: MethodError: Cannot `convert` an object of type Pkg.Types.VersionSpec to an object of type VersionNumber
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:171
Stacktrace:
 [1] convert(::Type{Union{Nothing, VersionNumber}}, ::Pkg.Types.VersionSpec) at ./some.jl:34
 [2] Pkg.Types.PackageEntry(::String, ::Pkg.Types.VersionSpec, ::Nothing, ::Bool, ::Pkg.Types.GitRepo, ::Nothing, ::Dict{String,Base.UUID}, ::Nothing) at /home/tim/src/Pkg.jl/src/Types.jl:221
 [3] Pkg.Types.PackageEntry(; name::String, version::Pkg.Types.VersionSpec, path::Nothing, pinned::Bool, repo::Pkg.Types.GitRepo, tree_hash::Nothing, deps::Dict{String,Base.UUID}, other::Nothing) at ./util.jl:742
 [4] update_manifest!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/Pkg.jl/src/Operations.jl:126
 [5] develop(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux) at /home/tim/src/Pkg.jl/src/Operations.jl:1129
 [6] develop(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; shared::Bool, preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Linux, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/tim/src/Pkg.jl/src/API.jl:102
 [7] develop(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/Pkg.jl/src/API.jl:63
 [8] #develop#15 at /home/tim/src/Pkg.jl/src/API.jl:60 [inlined]
 [9] develop at /home/tim/src/Pkg.jl/src/API.jl:60 [inlined]
 [10] #develop#12 at /home/tim/src/Pkg.jl/src/API.jl:58 [inlined]
 [11] develop at /home/tim/src/Pkg.jl/src/API.jl:58 [inlined]
 [12] develop(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/tim/src/Pkg.jl/src/API.jl:57
 [13] develop(::String) at /home/tim/src/Pkg.jl/src/API.jl:57
 [14] top-level scope at REPL[16]:1
 [15] eval(::Module, ::Any) at ./boot.jl:331
 [16] eval_user_input(::Any, ::REPL.REPLBackend) at /home/tim/src/julia-1/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
 [17] run_backend(::REPL.REPLBackend) at /home/tim/.julia/packages/Revise/C272c/src/Revise.jl:1075
 [18] top-level scope at none:0

So, the problem is that three packages (ColorTypes, Compat, and FixedPointNumbers) appear more than once in pkgs. Now check this out:

tim@diva:~/.julia/dev/ColorVectorSpace$ grep path Manifest.toml 
path = "/home/tim/.julia/dev/ColorTypes"
path = "/home/tim/.julia/dev/Compat"
path = "/home/tim/.julia/dev/FixedPointNumbers"

So these 3 packages are deved in ColorVectorSpace's own Manifest file.

The consequence of having them duplicated is that the version gets resolved for their second entry (the one that has the devved path) but not the first. But then when update_manifest! goes through them in order, it sees the first one and gets confused.

I can also verify that moving ColorVectorSpace/Manifest.toml out of the way fixes the problem.

@KristofferC
Copy link
Member

What Pkg version are you using?

I recently added these lines:

Pkg.jl/src/Operations.jl

Lines 254 to 256 in 596998b

if any(x -> x.uuid == pkg.uuid, developed)
continue
end

could they change something here?

@timholy
Copy link
Member Author

timholy commented Apr 18, 2020

master as of Apr 17, 2020, 596998b. Those lines appear in my source but the any condition never triggers.

@timholy
Copy link
Member Author

timholy commented Apr 18, 2020

I should also say that the info here might be enough to come up with a test case. I've been hesitant to bork my current setup, but I suspect that devving a package that has devved packages in its own Manifest.toml is enough to recapitulate this.

@KristofferC
Copy link
Member

KristofferC commented Apr 18, 2020

Can you figure out where the duplicate package is inserted?

but I suspect that devving a package that has devved packages in its own Manifest.toml is enough to recapitulate this.

I've been trying some combinations of this but haven't gotten it to repro.

@fredrikekre
Copy link
Member

I suspect that devving a package that has devved packages in its own Manifest.toml

Probably similar to #1755 then in that the manifest of the package you dev also seems to be used when it shouldn't.

@KristofferC
Copy link
Member

Probably similar to #1755 then in that the manifest of the package you dev also seems to be used when it shouldn't.

It looks this got explicitly introduced in #1427 (comment).
I still don't really know what the point of collect_developed is though, my guess is (as I wrote in the comment) to help with #1005 but I am not sure.

@KristofferC
Copy link
Member

@timholy
Copy link
Member Author

timholy commented Apr 18, 2020

OK, I have a partial repro. From my src/Pkg.jl clone (with the modifications in the diff above):

tim@diva:~/src/Pkg.jl$ JULIA_DEPOT_PATH=/tmp/pkgs julia --project
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.2-pre.0 (2020-04-15)
 _/ |\__'_|_|_|\__'_|  |  release-1.4/ef4fe83698* (fork: 122 commits, 109 days)
|__/                   |

julia> using Pkg
[ Info: Precompiling Pkg [1ad25b94-0f6a-5ffa-bbe3-cb5b20b300e7]

julia> pathof(Pkg)
"/home/tim/src/Pkg.jl/src/Pkg.jl"

julia> DEPOT_PATH
1-element Array{String,1}:
 "/tmp/pkgs"

(Pkg) pkg> activate /tmp/pkgs/environments/v1.4
 Activating new environment at `/tmp/pkgs/environments/v1.4/Project.toml`

(@v1.4) pkg> instantiate
    Cloning default registries into `/tmp/pkgs`
######################################################################## 100.0%
      Added registry `General` to `/tmp/pkgs/registries/General`
   Updating registry at `/tmp/pkgs/registries/General`
No Changes to `/tmp/pkgs/environments/v1.4/Project.toml`
No Changes to `/tmp/pkgs/environments/v1.4/Manifest.toml`

(@v1.4) pkg> dev FixedPointNumbers ColorTypes
    Cloning git-repo `https://github.com/JuliaMath/FixedPointNumbers.jl.git`
    Cloning git-repo `https://github.com/JuliaGraphics/ColorTypes.jl.git`
  Resolving package versions...
pkgs = Pkg.Types.PackageSpec[PackageSpec(
  name = FixedPointNumbers
  uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
  dev/path = /tmp/pkgs/dev/FixedPointNumbers
  version = *
), PackageSpec(
  name = ColorTypes
  uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
  dev/path = /tmp/pkgs/dev/ColorTypes
  version = *
)]
preserve = PRESERVE_ALL
PackageSpec(
  name = FixedPointNumbers
  uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
  dev/path = /tmp/pkgs/dev/FixedPointNumbers
  version = v"0.8.0"
)
0.8.0
PackageSpec(
  name = ColorTypes
  uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
  dev/path = /tmp/pkgs/dev/ColorTypes
  version = v"0.10.2"
)
0.10.2
Updating `/tmp/pkgs/environments/v1.4/Project.toml`
  [3da002f7] + ColorTypes v0.10.2 `/tmp/pkgs/dev/ColorTypes`
  [53c48c17] + FixedPointNumbers v0.8.0 `/tmp/pkgs/dev/FixedPointNumbers`
Updating `/tmp/pkgs/environments/v1.4/Manifest.toml`
  [3da002f7] + ColorTypes v0.10.2 `/tmp/pkgs/dev/ColorTypes`
  [53c48c17] + FixedPointNumbers v0.8.0 `/tmp/pkgs/dev/FixedPointNumbers`
  [9a3f8284] + Random
  [9e88b42a] + Serialization

(@v1.4) pkg> free FixedPointNumbers ColorTypes
  Installed FixedPointNumbers ─ v0.8.0
  Installed ColorTypes ──────── v0.10.2
Updating `/tmp/pkgs/environments/v1.4/Project.toml`
  [3da002f7] ~ ColorTypes v0.10.2 `/tmp/pkgs/dev/ColorTypes` ⇒ v0.10.2
  [53c48c17] ~ FixedPointNumbers v0.8.0 `/tmp/pkgs/dev/FixedPointNumbers` ⇒ v0.8.0
Updating `/tmp/pkgs/environments/v1.4/Manifest.toml`
  [3da002f7] ~ ColorTypes v0.10.2 `/tmp/pkgs/dev/ColorTypes` ⇒ v0.10.2
  [53c48c17] ~ FixedPointNumbers v0.8.0 `/tmp/pkgs/dev/FixedPointNumbers` ⇒ v0.8.0

(@v1.4) pkg> st
Status `/tmp/pkgs/environments/v1.4/Project.toml`
  [3da002f7] ColorTypes v0.10.2
  [53c48c17] FixedPointNumbers v0.8.0

Let's pause and look at the Manifest.toml in a separate shell (leave that previous Julia session running):

tim@diva:/tmp/pkgs/environments/v1.4$ cat Manifest.toml 
# This file is machine-generated - editing it directly is not advised

[[ColorTypes]]
deps = ["FixedPointNumbers", "Random"]
git-tree-sha1 = "f746d4fc892fdf683b5c22064c8e99b2f5b990e7"
uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
version = "0.10.2"

[[FixedPointNumbers]]
git-tree-sha1 = "3ba9ea634d4c8b289d590403b4a06f8e227a6238"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.8.0"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

All seems well. Now do this from a separate shell:

tim@diva:/tmp/pkgs/dev/ColorTypes$ JULIA_DEPOT_PATH=/tmp/pkgs julia --project
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.2-pre.0 (2020-04-15)
 _/ |\__'_|_|_|\__'_|  |  release-1.4/ef4fe83698* (fork: 122 commits, 109 days)
|__/                   |

(ColorTypes) pkg> st
Project ColorTypes v0.10.2
Status `/tmp/pkgs/dev/ColorTypes/Project.toml`
  (no changes since last commit)

(ColorTypes) pkg> dev /tmp/pkgs/dev/FixedPointNumbers
Path `/tmp/pkgs/dev/FixedPointNumbers` exists and looks like the correct package. Using existing path.
  Resolving package versions...
pkg.name = "FixedPointNumbers"
pkg.version = v"0.8.0"
pkg.name = "Random"
pkg.version = v"1.4.2-pre.0"
pkg.name = "Serialization"
pkg.version = v"1.4.2-pre.0"
   Updating `/tmp/pkgs/dev/ColorTypes/Project.toml`
  [53c48c17] + FixedPointNumbers v0.8.0 [`/tmp/pkgs/dev/FixedPointNumbers`]
  [9a3f8284] + Random 
   Updating `/tmp/pkgs/dev/ColorTypes/Manifest.toml`
  [53c48c17] + FixedPointNumbers v0.8.0 [`/tmp/pkgs/dev/FixedPointNumbers`]
  [9a3f8284] + Random 
  [9e88b42a] + Serialization 

(ColorTypes) pkg> st
Project ColorTypes v0.10.2
Status `/tmp/pkgs/dev/ColorTypes/Project.toml`
  [53c48c17] FixedPointNumbers v0.8.0 [`/tmp/pkgs/dev/FixedPointNumbers`]
  [9a3f8284] Random 

(ColorTypes) pkg> 
tim@diva:/tmp/pkgs/dev/ColorTypes$ cat Manifest.toml 
# This file is machine-generated - editing it directly is not advised

[[FixedPointNumbers]]
path = "/tmp/pkgs/dev/FixedPointNumbers"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.8.0"

[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

One can easily check that /tmp/pkgs/environments/v1.4/Manifest.toml is unchanged.

Then, go back to the original julia session:

(@v1.4) pkg> dev ColorTypes
Path `/tmp/pkgs/dev/ColorTypes` exists and looks like the correct package. Using existing path.
  Resolving package versions...
pkgs = Pkg.Types.PackageSpec[PackageSpec(
  name = ColorTypes
  uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
  dev/path = /tmp/pkgs/dev/ColorTypes
  version = *
)]
preserve = PRESERVE_ALL
about to try KC's patch
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = FixedPointNumbers
│      uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
│      dev/path = ../../dev/FixedPointNumbers
│      version = v"0.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:337
PackageSpec(
  name = ColorTypes
  uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
  dev/path = /tmp/pkgs/dev/ColorTypes
  version = v"0.10.2"
)
0.10.2
PackageSpec(
  name = FixedPointNumbers
  uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
  tree_hash = 3ba9ea634d4c8b289d590403b4a06f8e227a6238
  version = v"0.8.0"
)
0.8.0
PackageSpec(
  name = FixedPointNumbers
  uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
  dev/path = ../../dev/FixedPointNumbers
  version = v"0.8.0"
)
0.8.0
Updating `/tmp/pkgs/environments/v1.4/Project.toml`
  [3da002f7] ~ ColorTypes v0.10.2  v0.10.2 `/tmp/pkgs/dev/ColorTypes`
  [53c48c17] ~ FixedPointNumbers v0.8.0  v0.8.0 `../../dev/FixedPointNumbers`
Updating `/tmp/pkgs/environments/v1.4/Manifest.toml`
  [3da002f7] ~ ColorTypes v0.10.2  v0.10.2 `/tmp/pkgs/dev/ColorTypes`
  [53c48c17] ~ FixedPointNumbers v0.8.0  v0.8.0 `../../dev/FixedPointNumbers`

Interestingly, we get the twice warning but nothing too bad happens. Notice that it devs FixedPointNumbers.

And finally 💥

(@v1.4) pkg> free FixedPointNumbers
about to try KC's patch
┌ Warning: pkg appears twice: 
│   pkg =PackageSpec(
│      name = FixedPointNumbers
│      uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
│      dev/path = ../../dev/FixedPointNumbers
│      version = v"0.8.0"
│    )
└ @ Pkg.Operations ~/src/Pkg.jl/src/Operations.jl:337
PackageSpec(
  name = FixedPointNumbers
  uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
  version = *
)
0.8.0
PackageSpec(
  name = ColorTypes
  uuid = 3da002f7-5984-5a60-b8a6-cbb66c0b333f
  dev/path = /tmp/pkgs/dev/ColorTypes
  version = v"0.10.2"
)
0.10.2
PackageSpec(
  name = FixedPointNumbers
  uuid = 53c48c17-4a7d-5ca2-90c5-79b7896eea93
  dev/path = ../../dev/FixedPointNumbers
  version = v"0.8.0"
)
0.8.0
ERROR: MethodError: Cannot `convert` an object of type Pkg.Types.VersionSpec to an object of type VersionNumber
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:171
Stacktrace:
 [1] convert(::Type{Union{Nothing, VersionNumber}}, ::Pkg.Types.VersionSpec) at ./some.jl:34
 [2] Pkg.Types.PackageEntry(::String, ::Pkg.Types.VersionSpec, ::Nothing, ::Bool, ::Pkg.Types.GitRepo, ::Nothing, ::Dict{String,Base.UUID}, ::Nothing) at /home/tim/src/Pkg.jl/src/Types.jl:221
 [3] Pkg.Types.PackageEntry(; name::String, version::Pkg.Types.VersionSpec, path::Nothing, pinned::Bool, repo::Pkg.Types.GitRepo, tree_hash::Nothing, deps::Dict{String,Base.UUID}, other::Nothing) at ./util.jl:742
 [4] update_manifest!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/Pkg.jl/src/Operations.jl:126
 [5] free(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/Pkg.jl/src/Operations.jl:1273
 [6] free(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/tim/src/Pkg.jl/src/API.jl:290
 [7] free at /home/tim/src/Pkg.jl/src/API.jl:271 [inlined]
 [8] #free#61 at /home/tim/src/Pkg.jl/src/API.jl:268 [inlined]
 [9] free(::Array{Pkg.Types.PackageSpec,1}) at /home/tim/src/Pkg.jl/src/API.jl:268
 [10] do_cmd!(::Pkg.REPLMode.Command, ::REPL.LineEditREPL) at /home/tim/src/Pkg.jl/src/REPLMode/REPLMode.jl:403
 [11] do_cmd(::REPL.LineEditREPL, ::String; do_rethrow::Bool) at /home/tim/src/Pkg.jl/src/REPLMode/REPLMode.jl:381
 [12] do_cmd at /home/tim/src/Pkg.jl/src/REPLMode/REPLMode.jl:376 [inlined]
 [13] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /home/tim/src/Pkg.jl/src/REPLMode/REPLMode.jl:542
 [14] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [15] invokelatest at ./essentials.jl:711 [inlined]
 [16] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /home/tim/src/julia-1/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
 [17] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /home/tim/src/julia-1/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
 [18] run_repl(::REPL.AbstractREPL, ::Any) at /home/tim/src/julia-1/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
 [19] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
 [20] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [21] invokelatest at ./essentials.jl:711 [inlined]
 [22] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
 [23] exec_options(::Base.JLOptions) at ./client.jl:305
 [24] _start() at ./client.jl:484

@KristofferC
Copy link
Member

I'll be away for a couple of hours but the first step I think is to figure out exactly where a package with the same uuid gets introduced for the second time in the vector of packages.

@timholy
Copy link
Member Author

timholy commented Apr 18, 2020

Yes, your branch fixes this!

But I agree that the main problem seems to be the introduction of a duplicate.

@timholy
Copy link
Member Author

timholy commented Apr 18, 2020

Since we have a reproducer (can anyone else replicate it?), I think we are now on the right track.

@KristofferC
Copy link
Member

Should be fixed now.

@timholy
Copy link
Member Author

timholy commented Jul 1, 2020

Awesome! Which Julia versions is it in?

@KristofferC
Copy link
Member

I thought #1781 fixed it... So it should at least be in 1.5.

@goretkin
Copy link
Contributor

It was mentioned above, but I'll repeat for visibility, deleting the Manifest.toml seems to get you out of this state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants