# Where does Pkg(3) find version numbers?

**URL:** https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330
**Category:** Internals & Design
**Created:** [July 12, 2018, 12:49pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330 "2018-07-12T12:49:00Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)
#### Post date: [July 12, 2018, 12:49pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/1 "2018-07-12T12:49:00Z")

</div>

I am trying to install… or register, or record a package with a particular version number via `(v0.7) pkg> dev packagepath`, but am unable to do this. The package is `LambertW`, which is registered. `Pkg` will only add it to `Project.toml` with a very old version number. I have tried both local repos and the registered package on github. Here is an example:

```julia
(v0.7) pkg> preview dev /home/lapeyre/.julia/dev/LambertW#master
───── Preview mode ─────
┌ Warning: packages will need to have a [Julia]Project.toml file in the future
└ @ Pkg.Types Types.jl:603
 Resolving package versions...
 Installed Revise ─ v0.5.4
 Installed Arpack ─ v0.1.4
  Updating `~/.julia/environments/v0.7/Project.toml`
  [e24f45a5] ? InverseLaplace v0.0.3+ [`~/.julia/dev/InverseLaplace`] ⇒ v0.2.0+ [`~/.julia/dev/InverseLaplace`]
  [984bce1d] + LambertW v0.2.0+ [`~/.julia/dev/LambertW`]
  Updating `~/.julia/environments/v0.7/Manifest.toml`
  [e24f45a5] ? InverseLaplace v0.0.3+ [`~/.julia/dev/InverseLaplace`] ⇒ v0.2.0+ [`~/.julia/dev/InverseLaplace`]
  [984bce1d] + LambertW v0.2.0+ [`~/.julia/dev/LambertW`]
  Building skipping building in preview mode

```

The master branch (which I specify explicitly) is tagged `v0.4.0`. The tag `v0.2.0` is a couple of years old. The latest version here

```julia
~/.julia/v0.7/METADATA/LambertW/versions/

```

_is_ v0.2.0. But, I’d like to ignore this, and just use a local package, for now. This is actually holding up development on another package that depends on `LambertW` v0.4.0. I am using a `REQUIRE` file for this. Maybe I have to switch to `Project.toml` in order to specify a non-registered location. In any case this dependency has been removed, and will stay that way until I am able to “develop” `LambertW` v0.4.0.

---

<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 12, 2018, 1:29pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/2 "2018-07-12T13:29:27Z")

</div>

Unless there is a `Project.toml` file it uses the latest version in METADATA.

If there is a `Project.toml` file, it looks at e.g. the `version = "0.1.0"` field in that file.

---

<div class="post-metadata">

### Author: ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)
#### Post date: [July 12, 2018, 2:12pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/3 "2018-07-12T14:12:13Z")

</div>

Ok. For the record; In the end, it seemed fastest to do the following. Add this to `.julia/environments/v0.7/Manifest.toml`:

```julia
[[LambertW]]
deps = ["Test"]
git-tree-sha1 = "73db9837dfa9c4f2a0793ee68451393fb7f03339"
uuid = "0b6a3af8-85db-11e8-03ee-b981167d19f2"
path = "/home/lapeyre/.julia/dev/LambertW"
version = "0.4.0"

```

with a generated uuid, and the desired commit (with a tag that matches the version). Then this in `.julia/environments/v0.7/Project.toml`:

```julia
LambertW = "0b6a3af8-85db-11e8-03ee-b981167d19f2"

```

Then `pkg > status` shows a harmonious state.  
For the package depending on `LambertW`, I will try a `Project.toml`.

---

<div class="post-metadata">

### Author: ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)
#### Post date: [July 12, 2018, 2:15pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/4 "2018-07-12T14:15:40Z")

</div>

If there is no `version` explicitly in the file, it’s using the UUID? The UUID’s are for specific versions right?

---

<div class="post-metadata">

### Author: ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)
#### Post date: [July 12, 2018, 2:20pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/5 "2018-07-12T14:20:47Z")

</div>

If I delete the `version` line in `Manifest.toml`, I get this:

```julia
(v0.7) pkg> preview resolve 
───── Preview mode ─────
ERROR: KeyError: key "version" not found

```

---

<div class="post-metadata">

### Author: ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)
#### Post date: [July 12, 2018, 2:22pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/6 "2018-07-12T14:22:19Z")

</div>

I know that `version` is always in `Manifest.toml`, but it was my understanding that only `Project.toml` is mandatory, and in that one usually there is no explicit version.

Could you guys also clarify whether `Manifest.toml` should be included in repos?

---

<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 12, 2018, 2:27pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/7 "2018-07-12T14:27:53Z")

</div>

> [@jlapeyre](#):
>
> Add this to `.julia/environments/v0.7/Manifest.toml` :

Modifying the manifest by hand is usually not a good idea. It will likely be overwritten quickly.

> [@ExpandingMan](#):
>
> If there is no `version` explicitly in the file, it’s using the UUID? The UUID’s are for specific versions right?

No, it is for specific packages.

> [@ExpandingMan](#):
>
> Could you guys also clarify whether `Manifest.toml` should be included in repos?

See [Does Manifest.toml belong in the repository?](https://discourse.julialang.org/t/does-manifest-toml-belong-in-the-repository/12029)

---

<div class="post-metadata">

### Author: ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)
#### Post date: [July 12, 2018, 2:30pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/8 "2018-07-12T14:30:22Z")

</div>

Interesting. So if I only have a `Project.toml`, I’ll always get the latest tagged versions of everything?

That would actually explain a _lot_ of things I have been confused about.

---

<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 12, 2018, 2:33pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/9 "2018-07-12T14:33:02Z")

</div>

> [@ExpandingMan](#):
>
> Interesting. So if I only have a `Project.toml` , I’ll always get the latest tagged versions of everything?

Not sure what the question here is, could you elaborate a bit?

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [July 12, 2018, 2:44pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/10 "2018-07-12T14:44:34Z")

</div>

I have wondered about this too, so this is how I would phrase the question: suppose I install a package (with `add` or `dev`) that has a `Project.toml` but no `Manifest.toml`, how are the versions that are used to populate `Manifest.toml` determined? Is it the “latest” feasible solution (not sure that is well-defined, but least up to a partial ordering), or just “a” feasible solution?

---

<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 12, 2018, 2:47pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/11 "2018-07-12T14:47:00Z")

</div>

> [@Tamas\_Papp](#):
>
> how are the versions that are used to populate `Manifest.toml` determined?

The resolver tries to find the latest versions of packages that fits within the constraints given by the `compat` section of the project.

It is not any different from what the old package manager did.

---

<div class="post-metadata">

### Author: ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)
#### Post date: [July 12, 2018, 3:06pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/12 "2018-07-12T15:06:27Z")

</div>

> [@kristoffer.carlsson](#):
>
> The resolver tries to find the latest versions of packages that fits within the constraints given by the `compat` section of the project.

Ohhhh, that clarifies, _soooo_ much thanks! I think that has been my main source of confusion about this whole thing, it must not have been in the docs at the time when I read them. Anyway, I’m really liking this setup! In particular, I like that it defaults to getting most recent tagged versions of everything. Looking forward to using it more now that I understand what’s going on.

---

<div class="post-metadata">

### Author: ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)
#### Post date: [July 12, 2018, 3:09pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/13 "2018-07-12T15:09:12Z")

</div>

> [@kristoffer.carlsson](#):
>
> Modifying the manifest by hand is usually not a good idea. It will likely be overwritten quickly.

I agree its not a good idea. But, I could find no other way to work with the version I want.

In any case. My solution above does not work:

```julia
(v0.7) pkg> preview resolve
───── Preview mode ─────
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package LambertW [0b6a3af8]:
 LambertW [0b6a3af8] log:
 ├─possible versions are: 0.0.0 or uninstalled
 ├─LambertW [0b6a3af8] is fixed to version 0.0.0
 └─restricted to versions 0.4.0 by an explicit requirement — no versions left

```

I’ll think I’ll wait until version `0.4.0` is in `METADATA`.

> [@kristoffer.carlsson](#):
>
> No, it is for specific packages.

I don’t know exactly what “package” means here.

---

<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 12, 2018, 3:11pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/14 "2018-07-12T15:11:25Z")

</div>

> [@jlapeyre](#):
>
> I don’t know exactly what “package” means here.

Every package (something you can load with `using`) is identified by a unique UUID.

> [@jlapeyre](#):
>
> But, I could find no other way to work with the version I want.

You could perhas relax the version constraint on `LambertW`?

---

<div class="post-metadata">

### Author: ![jlapeyre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlapeyre/32/4514_2.png) [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)
#### Post date: [July 12, 2018, 3:23pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/15 "2018-07-12T15:23:59Z")

</div>

> [@kristoffer.carlsson](#):
>
> You could perhas relax the version constraint on `LambertW` ?

I’ll try that. It’s not urgent. I have to wait anyway till `v0.4.0` is in `METADATA` in order for automatic CI to work.

---

<div class="post-metadata">

### Author: ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)
#### Post date: [August 13, 2018, 9:57pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/16 "2018-08-13T21:57:51Z")

</div>

I keep getting errors like ` └─restricted to versions 0.0.0 by an explicit requirement — no versions left` when trying to dev my own packages. I don’t know why. I can’t find any Manifest.toml files that say `0.0.0`.

The problem is I have no idea how to actually fix anything when something goes wrong, so I feel like I’m forced to delete everything and start over whenever there’s a problem.

Maybe I can try and edit all the instances of “0.1.0” I find for that package, replacing them with “0.0.0”, and hope that works?

---

<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: [August 13, 2018, 10:04pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/17 "2018-08-13T22:04:53Z")

</div>

> [@Elrod](#):
>
> I keep getting errors like `└─restricted to versions 0.0.0 by an explicit requirement — no versions left` when trying to dev my own packages.

This typically means you have an unregistered package without a project file or a project file without a `version` entry.

If you have examples that fail, don’t be afraid of opening issues on the Pkg repo. Pkg is new, so better documentation and error messages etc are needed but those are much easier to add based on feedback from users than just coming up with examples in your head.

---

<div class="post-metadata">

### Author: ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)
#### Post date: [August 13, 2018, 10:32pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/18 "2018-08-13T22:32:43Z")

</div>

EDIT: Somehow switched tabs without noticing. Was filing an issue on Github.

Was JuliaLang’s github the correct place? [Pkg3 -- resolve fails with unsatisfiable restricted versions on `dev` · Issue #28639 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/issues/28639)

Or is there still another active repository, outside of the stdlib location?  
[https://github.com/JuliaLang/julia/tree/master/stdlib/Pkg](https://github.com/JuliaLang/julia/tree/master/stdlib/Pkg)

---

<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: [August 13, 2018, 11:44pm UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/19 "2018-08-13T23:44:12Z")

</div>

Thanks for the report. This seems to be a stupid bug in Pkg. [https://github.com/JuliaLang/Pkg.jl/pull/646](https://github.com/JuliaLang/Pkg.jl/pull/646) should fix it.

```julia
(Pkg) pkg> dev https://github.com/chriselrod/TriangularMatrices.jl
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Updating git-repo `https://github.com/chriselrod/TriangularMatrices.jl`
[ Info: Path `/Users/kristoffer/.julia/dev/TriangularMatrices` exists and looks like the correct package, using existing path instead of cloning
 Resolving package versions...
ERROR: Unsatisfiable requirements detected for package TriangularMatrices [5ebe76dc]:
 TriangularMatrices [5ebe76dc] log:
 ├─possible versions are: 0.0.0 or uninstalled
 ├─TriangularMatrices [5ebe76dc] is fixed to version 0.0.0
 └─restricted to versions 0.1.0 by an explicit requirement — no versions left

julia> import Pkg # Load Pkg with fix

(Pkg) pkg> dev https://github.com/chriselrod/TriangularMatrices.jl
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Updating git-repo `https://github.com/chriselrod/TriangularMatrices.jl`
[ Info: Path `/Users/kristoffer/.julia/dev/TriangularMatrices` exists and looks like the correct package, using existing path instead of cloning
 Resolving package versions...
  Updating `Project.toml`
  [5ebe76dc] + TriangularMatrices v0.0.0 [`~/.julia/dev/TriangularMatrices`]

```

Edit: The PR needs some fixup but it is mostly correct. At least I know the problem.

---

<div class="post-metadata">

### Author: ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)
#### Post date: [August 14, 2018, 12:02am UTC](https://discourse.julialang.org/t/where-does-pkg-3-find-version-numbers/12330/20 "2018-08-14T00:02:22Z")

</div>

Saw tests failed for today. Once they’re fixed and fixes are merged in Pkg master, what’s the easiest way to check them out locally? I know we don’t need the same Julia and standard lib versions. My first try was simply:

```julia
(v1.0) pkg> add Pkg#master
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
ERROR: The following package names could not be resolved:
 * Pkg (44cfe95a-1eb2-52ea-b672-e2afdf69b78f in manifest but not in project)
Please specify by known `name=uuid`.

```

Would also be nice to get the `startup.jl` fix too.  
[https://github.com/JuliaLang/Pkg.jl/issues/609](https://github.com/JuliaLang/Pkg.jl/issues/609)
