Pkg3 confusion

I’ve found the following behavior that seems to me to be a bug; from a fresh build of master with nothing installed, I install ForwardDiff:

(v0.7) pkg> add ForwardDiff
   Cloning default registries into /home/sean/.julia/registries
   Cloning registry Uncurated from ""


Installed StaticArrays ───────── v0.8.0
[90137ffa] + StaticArrays v0.8.0

julia> Pkg.installed()["StaticArrays"]

Now if I do using StaticArrays, the package is not found - I assume this is a deliberate design decision and not a bug, although I’m not sure I agree. However, my next thought is to install it so I can use it - surely this should be a simple operation since the package is already on my system as a dependency of ForwardDiff. Nope:

(v0.7) pkg> add StaticArrays
  Updating registry at `~/.julia/registries/Uncurated`
  Updating git-repo ``
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package (unknown) [10745b16]:
 (unknown) [10745b16] log:
 ├─(unknown) [10745b16] has no known versions!
 └─found to have no compatible versions left with StaticArrays [90137ffa] 
   └─StaticArrays [90137ffa] log:
     ├─possible versions are: [0.0.1-0.0.11, 0.1.0-0.1.5, 0.2.0-0.2.1, 0.3.0-0.3.1, 0.4.0, 0.5.0-0.5.1, 0.6.0-0.6.6, 0.7.0-0.7.2, 0.8.0] or uninstalled
     └─restricted to versions 0.8.0 by an explicit requirement, leaving only versions 0.8.0

I’m not sure I understand what’s going on here, but surely this shouldn’t be the way the system works - after all, I just installed StaticArrays as a dependency, so this should be a no-op. Am I just confused?

I should note that if I first install StaticArrays and then ForwardDiff, everything works as I’d expect.

This should be fixed on nightly. Could you try with the latest nightly?

Ah, you’re correct. Sorry about that. I just checked out master instead of release-0.6 and didn’t pull, so I had an older version.

My understanding is that if package Bar gets installed automatically as a dependency of Foo, then using Bar only works within the Foo package unless you explicitly do add Bar. This serves at least two purposes:

  1. If another package Baz requires a different package named Bar (i.e. a different UUID), or a different version of the same Bar, then both Foo and Baz can privately install their own versions of Bar without conflicting.

  2. If you ever rm Foo, the package system knows it can safely delete Bar as well since Bar was only installed as a private dependency of Foo.

The separate issue that an explicit add StaticArrays failed in your case should hopefully be fixed now.

1 Like

Yes, I figured that part was intentional - seems like a solid design decision. The error part is resolved for me on a fresh build of the latest master.

Partially correct:

  • different packages named Bar are supported
  • different versions of the same Bar are not

It might be possible to explore the latter in the future.