Pkg.jl: Pkg not detecting versions in branch dependency.

Created on 22 Aug 2018  Β·  13Comments  Β·  Source: JuliaLang/Pkg.jl

I have in the manifest of our package a dependency with a specific branch and version. However, when I add my package to a clean Julia installation this error happens:

(v0.7) pkg> add PowerSystems#master
   Cloning git-repo `https://github.com/NREL/PowerSystems.jl.git`
  Updating git-repo `https://github.com/NREL/PowerSystems.jl.git`
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package PowerModels [23a24fe6]:
 PowerModels [23a24fe6] log:
 β”œβ”€PowerModels [23a24fe6] has no known versions!
 └─restricted to versions * by PowerSystems [c512b964] β€” no versions left
   └─PowerSystems [c512b964] log:
     β”œβ”€possible versions are: 0.1.0 or uninstalled
     └─PowerSystems [c512b964] is fixed to version 0.1.0

Upon review of the files in the packages folder, everything looks ok as per the documentation

In the manifest file in PowerSystems the entry for PowerModels is the following:

[[PowerModels]]
deps = ["Compat", "InfrastructureModels", "JSON", "JuMP", "MathOptInterface", "Memento", "Pkg"]
git-tree-sha1 = "94f9913c02857e7ee0577306be8e513feed3af4b"
repo-rev = "moi-julia-v0.7"
repo-url = "https://github.com/lanl-ansi/PowerModels.jl.git"
uuid = "23a24fe6-a169-11e8-146b-9d23c58f08d1"
version = "0.7.0"

This entry was created automatically using the package manager add command. Moreover, in the branch moi-julia-v0.7 the project.toml file has the following header

name = "PowerModels"
uuid = "23a24fe6-a169-11e8-146b-9d23c58f08d1"
version = "0.7.0"

However, if I add the PowerModels package first there is no error.

(v0.7) pkg> add PowerModels#moi-julia-v0.7
   Cloning git-repo `https://github.com/lanl-ansi/PowerModels.jl.git`
  Updating git-repo `https://github.com/lanl-ansi/PowerModels.jl.git`
 Resolving package versions...
  Updating `~/.julia/environments/v0.7/Project.toml`
  [23a24fe6] + PowerModels v0.7.0 #moi-julia-v0.7 (https://github.com/lanl-ansi/PowerModels.jl.git)
  Updating `~/.julia/environments/v0.7/Manifest.toml`
  [2030c09a] + InfrastructureModels v0.0.9
  [f28f55f0] + Memento v0.9.0
  [4d1e1d77] + Nullables v0.0.7
  [23a24fe6] + PowerModels v0.7.0 #moi-julia-v0.7 (https://github.com/lanl-ansi/PowerModels.jl.git)
  [cea106d9] + Syslogs v0.2.0

(v0.7) pkg> add PowerSystems#master
  Updating git-repo `https://github.com/NREL/PowerSystems.jl.git`
 Resolving package versions...
 Installed ZipFile ─ v0.7.0
 Installed InfoZIP ─ v0.1.6
  Updating `~/.julia/environments/v0.7/Project.toml`
  [c512b964] + PowerSystems v0.1.0 #master (https://github.com/NREL/PowerSystems.jl.git)
  Updating `~/.julia/environments/v0.7/Manifest.toml`
  [336ed68f] + CSV v0.3.1
  [f4508453] + InfoZIP v0.1.6
  [7d512f48] + InternedStrings v0.7.0
  [c512b964] + PowerSystems v0.1.0 #master (https://github.com/NREL/PowerSystems.jl.git)
  [3cdcf5f2] + RecipesBase v0.5.0
  [9e3dc215] + TimeSeries v0.12.0
  [a5390f91] + ZipFile v0.7.0
  Building PowerSystems β†’ `~/.julia/packages/PowerSystems/IoGrN/deps/build.log`

But at the end of the day, I can't get the master branch of PowerSystems to checkout the branch from PowerModels that I need.

All 13 comments

This is, for now, expected. Packages cannot depend on unregistered packages (that are not present already in the Project).

What you can do is

git clone https://github.com/lanl-ansi/PowerSystems.jl.git PowerSystems
cd PowerSystems
julia --project
julia> import Pkg; Pkg.instantiate()

This will install everything that is in the Manifest of PowerSystems (even unregistered packages). But other packages cannot then depend on PowerSystems (it is what we call an Application).

So a branch from a registered package is considered as unregistered? Both PowerSystems and PowerModels are registered packages

Sorry, I misunderstood then. Will look into this in a bit.

However, just to be clear, the manifest inside PowerSystems is completely ignored unless it is set as the active project (whereby that manifest is activated).

This is confusing if I have a package, PowerSystems in this case, with a set of dependencies reflected in the package's project and manifest files, aren't those dependencies added into the environment automatically?

For instance, in the PowerModels we added the dependency on JuMP's master branch as follows:

[[JuMP]]
deps = ["Calculus", "Compat", "DataStructures", "ForwardDiff", "MathOptInterface", "NaNMath"]
git-tree-sha1 = "6b0ce33ffcb99a2757c308a11fd06bdd40bf0335"
repo-rev = "master"
repo-url = "https://github.com/JuliaOpt/JuMP.jl.git"
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
version = "0.18.2+"

and if I run on an empty Julia 7 add PowerModels#moi-julia-v0.7 then it correctly checks out the master branch of JuMP.

(v0.7) pkg> add PowerModels#moi-julia-v0.7
  Updating git-repo `https://github.com/lanl-ansi/PowerModels.jl.git`
 Resolving package versions...
 Installed URIParser ──────────── v0.4.0
 Installed NaNMath ────────────── v0.3.2
 Installed JSON ───────────────── v0.19.0
 Installed BinaryProvider ─────── v0.4.1
 Installed DataStructures ─────── v0.11.0
 Installed Memento ────────────── v0.9.0
 Installed StaticArrays ───────── v0.8.3
 Installed ForwardDiff ────────── v0.7.5
 Installed SpecialFunctions ───── v0.7.0
 Installed Syslogs ────────────── v0.2.0
 Installed DiffRules ──────────── v0.0.7
 Installed DiffResults ────────── v0.0.3
 Installed InfrastructureModels ─ v0.0.9
 Installed MathProgBase ───────── v0.7.2
 Installed MathOptInterface ───── v0.5.1
 Installed JuMP ───────────────── v0.18.2
 Installed Calculus ───────────── v0.4.1
 Installed CommonSubexpressions ─ v0.2.0
 Installed Compat ─────────────── v1.0.1
 Installed BinDeps ────────────── v0.8.10
 Installed Nullables ──────────── v0.0.7
 Installed ReverseDiffSparse ──── v0.8.2
  Updating `~/.julia/environments/v0.7/Project.toml`
  [23a24fe6] + PowerModels v0.7.0 #moi-julia-v0.7 (https://github.com/lanl-ansi/PowerModels.jl.git)
  Updating `~/.julia/environments/v0.7/Manifest.toml`
  [9e28174c] + BinDeps v0.8.10
  [b99e7846] + BinaryProvider v0.4.1
  [49dc2e85] + Calculus v0.4.1
  [bbf7d656] + CommonSubexpressions v0.2.0
  [34da2185] + Compat v1.0.1
  [864edb3b] + DataStructures v0.11.0
  [163ba53b] + DiffResults v0.0.3
  [b552c78f] + DiffRules v0.0.7
  [f6369f11] + ForwardDiff v0.7.5
  [2030c09a] + InfrastructureModels v0.0.9
  [682c06a0] + JSON v0.19.0
  [4076af6c] + JuMP v0.18.2
  [b8f27783] + MathOptInterface v0.5.1
  [fdba3010] + MathProgBase v0.7.2
  [f28f55f0] + Memento v0.9.0
  [77ba4419] + NaNMath v0.3.2
  [4d1e1d77] + Nullables v0.0.7
  [23a24fe6] + PowerModels v0.7.0 #moi-julia-v0.7 (https://github.com/lanl-ansi/PowerModels.jl.git)
  [89212889] + ReverseDiffSparse v0.8.2
  [276daf66] + SpecialFunctions v0.7.0
  [90137ffa] + StaticArrays v0.8.3
  [cea106d9] + Syslogs v0.2.0
  [30578b45] + URIParser v0.4.0
  [2a0f44e3] + Base64 
  [ade2ca70] + Dates 
  [8bb1440f] + DelimitedFiles 
  [8ba89e20] + Distributed 
  [b77e0a4c] + InteractiveUtils 
  [76f85450] + LibGit2 
  [8f399da3] + Libdl 
  [37e2e46d] + LinearAlgebra 
  [56ddb016] + Logging 
  [d6f4376e] + Markdown 
  [a63ad114] + Mmap 
  [44cfe95a] + Pkg 
  [de0858da] + Printf 
  [3fa0cd96] + REPL 
  [9a3f8284] + Random 
  [ea8e919c] + SHA 
  [9e88b42a] + Serialization 
  [1a1011a3] + SharedArrays 
  [6462fe0b] + Sockets 
  [2f01184e] + SparseArrays 
  [10745b16] + Statistics 
  [8dfed614] + Test 
  [cf7118a7] + UUIDs 
  [4ec0a83e] + Unicode 
  Building SpecialFunctions β†’ `~/.julia/packages/SpecialFunctions/KvXoO/deps/build.log`

with a set of dependencies reflected in the package's project and manifest files

The only dependencies that Pkg sees are the ones in Project.toml, when you add a package like you do here, the package Manifest.toml is ignored (i.e. where you have specified master branch of JuMP)

then it correctly checks out the master branch of JuMP.

What do you mean? It installed JuMP v0.18.2 and not the master branch?

@fredrikekre thanks about the uuid number. Is the uuid updated manually or through Pkg, I remember Stefan mentioning that one should never modify manually the TOML files.

You can update it manually. Seems like everything is working as expected here then?

I'm curious: why was there a UUID mismatch in the first place?

@fredrikekre that resolves the error posted at the beginning, but is not clear then how to specify dependencies in the Project.TOML related to a particular branch of a package. Is it the same syntax as in the Manifest file?

I'm curious: why was there a UUID mismatch in the first place?

Presumably because the author just generated a random uuid.

but is not clear then how to specify dependencies in the Project.TOML

You don't.
If you want to use the dependencies in the package Manifest.toml, you can pkg> activate path/to/package and then pkg> instantiate.
If you want to use this package in another environment (e.g. v1.0) then you need to explicitly pkg> add JuMP#master.

I think you misquoted the second time @fredrikekre

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cossio picture cossio  Β·  3Comments

GordStephen picture GordStephen  Β·  3Comments

MaWo2 picture MaWo2  Β·  4Comments

timholy picture timholy  Β·  4Comments

jebej picture jebej  Β·  3Comments