Package manager: what are "explicit requirements"?

pkg

#1

I sometimes run into “Unsatisfiable requirements” error when adding some package A, where the description mentions that some package B has “explicit requirements”. When this happens, I found that removing package B and installing A fixes the problem while automatically installing some version of B (sometimes the same version that was “explicitly required”!).
Although this workaround always works so far, I’d like to understand what is happening. I find the error message pretty confusing as I have never “explicitly required” any specific version. Does it refer to a requirement from some other, unspecified, package? Is uninstalling B really the “standard” way to fix this?

Here is a recent example (where an older version of B==ForwardDiff is eventually installed):

(v1.0) pkg> add JuMP
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package ReverseDiffSparse [89212889]:
 ReverseDiffSparse [89212889] log:
 ├─possible versions are: [0.0.1-0.0.5, 0.1.0-0.1.13, 0.2.0-0.2.11, 0.3.0, 0.4.0-0.4.1, 0.5.0-0.5.8, 0.6.0, 0.7.0-0.7.3, 0.8.0-0.8.4] or uninstalled
 ├─restricted by compatibility requirements with ForwardDiff [f6369f11] to versions: [0.0.1-0.0.5, 0.1.0-0.1.13, 0.2.0-0.2.11, 0.3.0, 0.4.0-0.4.1] or uninstalled
 │ └─ForwardDiff [f6369f11] log:
 │   ├─possible versions are: [0.0.2-0.0.3, 0.1.0-0.1.8, 0.2.0-0.2.5, 0.3.0-0.3.5, 0.4.0-0.4.2, 0.5.0, 0.6.0, 0.7.0-0.7.5, 0.8.0-0.8.5, 0.9.0, 0.10.0-0.10.1] or uninstalled
 │   └─restricted to versions 0.10.1 by an explicit requirement, leaving only versions 0.10.1
 ├─restricted by julia compatibility requirements to versions: 0.8.2-0.8.4 or uninstalled, leaving only versions: uninstalled
 └─restricted by compatibility requirements with JuMP [4076af6c] to versions: 0.8.0-0.8.4 — no versions left
   └─JuMP [4076af6c] log:
     ├─possible versions are: [0.1.1-0.1.2, 0.2.0, 0.3.0-0.3.2, 0.4.0-0.4.1, 0.5.0-0.5.8, 0.6.0-0.6.3, 0.7.0-0.7.4, 0.8.0, 0.9.0-0.9.3, 0.10.0-0.10.3, 0.11.0-0.11.3, 0.12.0-0.12.2, 0.13.0-0.13.2, 0.14.0-0.14.2, 0.15.0-0.15.1, 0.16.0-0.16.2, 0.17.0-0.17.1, 0.18.0-0.18.5] or uninstalled
     ├─restricted to versions * by an explicit requirement, leaving only versions [0.1.1-0.1.2, 0.2.0, 0.3.0-0.3.2, 0.4.0-0.4.1, 0.5.0-0.5.8, 0.6.0-0.6.3, 0.7.0-0.7.4, 0.8.0, 0.9.0-0.9.3, 0.10.0-0.10.3, 0.11.0-0.11.3, 0.12.0-0.12.2, 0.13.0-0.13.2, 0.14.0-0.14.2, 0.15.0-0.15.1, 0.16.0-0.16.2, 0.17.0-0.17.1, 0.18.0-0.18.5]
     ├─restricted by compatibility requirements with ForwardDiff [f6369f11] to versions: [0.1.1-0.1.2, 0.2.0, 0.3.0-0.3.2, 0.4.0-0.4.1, 0.5.0-0.5.8, 0.6.0-0.6.3, 0.7.0-0.7.4, 0.8.0, 0.9.0-0.9.3, 0.10.0-0.10.3, 0.11.0-0.11.3, 0.18.4-0.18.5] or uninstalled, leaving only versions: [0.1.1-0.1.2, 0.2.0, 0.3.0-0.3.2, 0.4.0-0.4.1, 0.5.0-0.5.8, 0.6.0-0.6.3, 0.7.0-0.7.4, 0.8.0, 0.9.0-0.9.3, 0.10.0-0.10.3, 0.11.0-0.11.3, 0.18.4-0.18.5]
     │ └─ForwardDiff [f6369f11] log: see above
     └─restricted by julia compatibility requirements to versions: 0.18.3-0.18.5 or uninstalled, leaving only versions: 0.18.4-0.18.5

(v1.0) pkg> remove ForwardDiff
  Updating `C:\Users\yharel\.julia\environments\v1.0\Project.toml`
  [f6369f11] - ForwardDiff v0.10.1
  Updating `C:\Users\yharel\.julia\environments\v1.0\Manifest.toml`
 [no changes]

(v1.0) pkg> add JuMP
 Resolving package versions...
 Installed MathProgBase ────── v0.7.7
 Installed ReverseDiffSparse ─ v0.8.4
 Installed JuMP ────────────── v0.18.5
  Updating `C:\Users\yharel\.julia\environments\v1.0\Project.toml`
  [4076af6c] + JuMP v0.18.5
  Updating `C:\Users\yharel\.julia\environments\v1.0\Manifest.toml`
  [f6369f11] ↓ ForwardDiff v0.10.1 ⇒ v0.9.0
  [4076af6c] + JuMP v0.18.5
  [fdba3010] + MathProgBase v0.7.7
  [89212889] + ReverseDiffSparse v0.8.4

#2

I think (I am not 100% familiar with the resolver) that an explicit requirement is a requirement that comes from the package being in your Project file. So it is not in the resolver because anyone depends on it, it is because you explicitly wanted it (by adding the package).


#3

To expand on this - when you add a package, it adds a specific version of that package. If you don’t update for a while, that package might fall behind and be too old for some new packages’ deps. Is that right?

In other words, rather than removing FowardDiff, you may have just been able to update it. I think…