# Pkg3 confusion

**URL:** <https://discourse.julialang.org/t/pkg3-confusion/12128>\
**Category:** Internals & Design\
**Created:** [July 3, 2018, 1:47pm UTC](https://discourse.julialang.org/t/pkg3-confusion/12128 "2018-07-03T13:47:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sean\_McBane](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sean_mcbane/32/4580_2.png) [@Sean\_McBane](https://discourse.julialang.org/u/Sean_McBane)\
**Post date:** [July 3, 2018, 1:47pm UTC](https://discourse.julialang.org/t/pkg3-confusion/12128/1 "2018-07-03T13:47:23Z")

</div>

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:

```julia
(v0.7) pkg> add ForwardDiff
   Cloning default registries into /home/sean/.julia/registries
   Cloning registry Uncurated from "https://github.com/JuliaRegistries/Uncurated.git"

...

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

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

```

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:

```julia
(v0.7) pkg> add StaticArrays
  Updating registry at `~/.julia/registries/Uncurated`
  Updating git-repo `https://github.com/JuliaRegistries/Uncurated.git`
 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.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [July 3, 2018, 2:07pm UTC](https://discourse.julialang.org/t/pkg3-confusion/12128/2 "2018-07-03T14:07:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sean\_McBane](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sean_mcbane/32/4580_2.png) [@Sean\_McBane](https://discourse.julialang.org/u/Sean_McBane)\
**Post date:** [July 3, 2018, 3:24pm UTC](https://discourse.julialang.org/t/pkg3-confusion/12128/3 "2018-07-03T15:24:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [July 3, 2018, 3:27pm UTC](https://discourse.julialang.org/t/pkg3-confusion/12128/4 "2018-07-03T15:27:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sean\_McBane](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sean_mcbane/32/4580_2.png) [@Sean\_McBane](https://discourse.julialang.org/u/Sean_McBane)\
**Post date:** [July 3, 2018, 3:34pm UTC](https://discourse.julialang.org/t/pkg3-confusion/12128/5 "2018-07-03T15:34:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [July 3, 2018, 4:08pm UTC](https://discourse.julialang.org/t/pkg3-confusion/12128/6 "2018-07-03T16:08:37Z")

</div>

> [@stevengj](#):
>
> 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.

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.
