Specifying dependency versions in my package

So I wrote my first package (CurrentPopulationSurvey.jl) and it was just added to the registry. When I went to download it via add CurrentPopulationSurvey I got the following error:

(v1.2) pkg> add CurrentPopulationSurvey
  Updating registry at `C:\Users\mthel\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package CurrentPopulationSurvey [d0231af6]:
 CurrentPopulationSurvey [d0231af6] log:
 ├─possible versions are: 0.1.0 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions 0.1.0
 └─restricted by compatibility requirements with CSV [336ed68f] to versions: uninstalled — no versions left
   └─CSV [336ed68f] log:
     ├─possible versions are: [0.3.0-0.3.1, 0.4.0-0.4.3, 0.5.0-0.5.18] or uninstalled
     ├─restricted to versions * by Agents [46ada45e], leaving only versions [0.3.0-0.3.1, 0.4.0-0.4.3, 0.5.0-0.5.18]
     │ └─Agents [46ada45e] log:
     │   ├─possible versions are: 1.1.7 or uninstalled
     │   └─Agents [46ada45e] is fixed to version 1.1.7
     └─restricted to versions 0.5.12 by an explicit requirement, leaving only versions 0.5.12

I’m assuming I’ve screwed something up in the Project.toml. It currently looks like this:

name = "CurrentPopulationSurvey"
uuid = "d0231af6-78e7-4e9e-9602-dcd107aeccbe"
authors = ["Matt Helm"]
version = "0.1.0"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Glob = "c27321d9-0574-5035-807b-f59d2c89b15c"
JuliaDB = "a93385a2-3734-596a-9a66-3cfbb77141e6"

[compat]
julia = "1.2"
CSV = "0.5.18"
DataDeps = "0.7.1"
DataFrames = "0.19.4"
Glob = "1.2.0"
JuliaDB = "0.13.0"

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

[targets]
test = ["Test"]

Is this error being caused by the specification of versions in [compat] or is something else wrong?

CSV = "0.5.18" means that CSV has to be in [0.5.18,0.6.0). But the version of CSV in your current project seems to be 0.5.12, which is not in that range, so the resolver fails. You can force CSV to the correct version with:

pkg> add CurrentPopulationSurvey CSV@0.5.18

Note that the behavior of the resolver has been adjusted so that manual interventions like this will not be necessary in the future (starting with Julia 1.4):

(ExampleProject) pkg> status
Status `/tmp/ExampleProject/Project.toml`
  [336ed68f] CSV v0.5.12

(ExampleProject) pkg> add CurrentPopulationSurvey
 Resolving package versions...
  Updating `/tmp/ExampleProject/Project.toml`
  [336ed68f] ↑ CSV v0.5.12 ⇒ v0.5.18
  [d0231af6] + CurrentPopulationSurvey v0.1.0
1 Like

Thanks for the info! I tried to install as you suggested and got this:

(v1.2) pkg> add CurrentPopulationSurvey CSV@0.5.18
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFrames [a93c6f00]:
 DataFrames [a93c6f00] log:
 ├─possible versions are: [0.11.7, 0.12.0, 0.13.0-0.13.1, 0.14.0-0.14.1, 0.15.0-0.15.2, 0.16.0, 0.17.0-0.17.1, 0.18.0-0.18.4, 0.19.0-0.19.4] or uninstalled
 ├─restricted to versions * by Agents [46ada45e], leaving only versions [0.11.7, 0.12.0, 0.13.0-0.13.1, 0.14.0-0.14.1, 0.15.0-0.15.2, 0.16.0, 0.17.0-0.17.1, 0.18.0-0.18.4, 0.19.0-0.19.4]
 │ └─Agents [46ada45e] log:
 │   ├─possible versions are: 1.1.7 or uninstalled
 │   └─Agents [46ada45e] is fixed to version 1.1.7
 ├─restricted to versions 0.19.3 by an explicit requirement, leaving only versions 0.19.3
 └─restricted by compatibility requirements with CurrentPopulationSurvey [d0231af6] to versions: 0.19.4 — no versions left
   └─CurrentPopulationSurvey [d0231af6] log:
     ├─possible versions are: 0.1.0 or uninstalled
     └─restricted to versions * by an explicit requirement, leaving only versions 0.1.0

I’m trying to figure out if this is a consequence of how I’ve specified the [compat] section of my Project.toml in my package CurrentPopulationSurvey, or if this is a consequence of not setting up isolated project environments for all of my different Julia projects…?