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.
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?
As to the original issue, it looks like a uuid mismatch between https://github.com/lanl-ansi/PowerModels.jl/blob/f920fcb82b64d9756a46e67558cffa584917297d/Project.toml#L2 and https://github.com/JuliaRegistries/General/blob/eaf1d71c19305e8970acdc5cc8899b8659fc9ed7/P/PowerModels/Package.toml#L2 . You should use the one from the registry.
@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