# Incompabilities between package versions

**URL:** https://discourse.julialang.org/t/incompabilities-between-package-versions/23609
**Category:** New to Julia
**Created:** [April 27, 2019, 10:29pm UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609 "2019-04-27T22:29:43Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![sbacelar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sbacelar/32/4359_2.png) [@sbacelar](https://discourse.julialang.org/u/sbacelar)
#### Post date: [April 27, 2019, 10:29pm UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/1 "2019-04-27T22:29:43Z")

</div>

Anyone can explain why Julia package manager works like this?  
Just one example: I added the package `Agents` and `Distributions v0.19.0` shows incompatibilities. I remove `Distributions` and then added it and then the incompatibility disappeared but the version of `Distributions` package is now v0.18.0.  
It seems a behaviour very different from what happens for example in `Anaconda`.  
Is there any rule that we must follow when these incompatibilities happen?

---

<div class="post-metadata">

### Author: ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)
#### Post date: [April 27, 2019, 11:41pm UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/2 "2019-04-27T23:41:08Z")

</div>

What’s happening here as far as I know is that Agents and Distributions are both fixed to some version, and there’s some incompatibility between Agents (or one of its dependencies) and Distributions v0.19.0.

However, when you `]rm Distributions`, it get removed from your environment’s Project.toml, which  
means that the version is no longer required to be v0.19.0. Then, when you re-`add` it, Pkg will look through the compatibility requirements of all the packages that are in your Project.toml, and determine that the highest supported version of `Distributions` is v0.18.0, and install that.

That being said, there seems to have been a bug with the conversion of METADATA.jl to JuliaRegistries/General, which caused package compatibility caps to be stricter than they should have been.

---

<div class="post-metadata">

### Author: ![ablaom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ablaom/32/4889_2.png) [@ablaom](https://discourse.julialang.org/u/ablaom)
#### Post date: [May 2, 2019, 9:41pm UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/3 "2019-05-02T21:41:32Z")

</div>

Yes, there is something strange going on here with Distributions, which I guessed had something do with recent transition from REQUIRE (ie METADATA.jl) to Project.toml (General).

If you add Distributions to an empty environment and then try to add, say, KernelDensity, then you get incompatibility error. However, there is no problem adding them in the _reverse_ order, which, as I understand it, shouldn’t make a difference, no?

---

<div class="post-metadata">

### Author: ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)
#### Post date: [May 3, 2019, 3:50am UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/4 "2019-05-03T03:50:07Z")

</div>

No, in your example KernelDensity.jl depends on Distributions (but not vice versa). So if you add KernelDensity to an environment (which already contains Distributions), then Distributions (in your environment) must match the requirements of KernelDensity. KernelDensity doesn’t currently have a Project.toml of its own, so it’s unclear to me where it’s requirements are set. I’m guessing it’s these lines in it’s Compat.toml in the general registry:  
[https://github.com/JuliaRegistries/General/blob/c0b2310f9cee4a47b49979fb07bd6eb13babf648/K/KernelDensity/Compat.toml#L23-L24](https://github.com/JuliaRegistries/General/blob/c0b2310f9cee4a47b49979fb07bd6eb13babf648/K/KernelDensity/Compat.toml#L23-L24)  
So I think if you do `]add Distributions@0.18`, then  
`]add KernelDensity` that should work.

---

<div class="post-metadata">

### Author: ![ablaom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ablaom/32/4889_2.png) [@ablaom](https://discourse.julialang.org/u/ablaom)
#### Post date: [May 3, 2019, 4:48am UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/5 "2019-05-03T04:48:26Z")

</div>

Thanks for that! So, to clarify: Your’e saying that the order in which you add packages to an environment matters? But how can this be? Doesn’t the outcome of resolving an environment (which happens each time you `add` to it) depend only on the Project.toml file? And surely the order in which dependencies appear in the Project.toml file is irrelevant. What am I missing here?

---

<div class="post-metadata">

### Author: ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)
#### Post date: [May 3, 2019, 5:35am UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/6 "2019-05-03T05:35:00Z")

</div>

Yes currently installation order matters when their are version dependencies. If you have added a package A independently (the latest version) to an environment, and later try to add package B which depends _on a different version_ of package A, then currently the pkg manager does not auto-regrade package A. Instead the pkg manager throws a warning that the version of A you have already is not compatible with the version of B you’re trying to install.

It’s different when you add package A to an environment with B, because A does not depend on a version of B. So in this case the pkg manager gives you a version of A which is compatible with B’s Project.toml.

---

<div class="post-metadata">

### Author: ![ablaom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ablaom/32/4889_2.png) [@ablaom](https://discourse.julialang.org/u/ablaom)
#### Post date: [May 3, 2019, 5:58am UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/7 "2019-05-03T05:58:52Z")

</div>

So if I activate a brand new Project.toml (that I created by hand) and `resolve`, in what order are the packages parsed to determine possible conflicts?

---

<div class="post-metadata">

### Author: ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)
#### Post date: [May 3, 2019, 6:30am UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/8 "2019-05-03T06:30:14Z")

</div>

When I `instantiate` a new environment, containing only the Project.toml below, I get Distributions 0.18 (not 0.19.2) and KernelDensity 0.5.1. The pkg manager finds the latest compatible versions.

```julia
# Project.toml
[deps]
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
KernelDensity = "5ab0869b-81aa-558d-bb23-cbf5423bbe9b"

```

---

<div class="post-metadata">

### Author: ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)
#### Post date: [May 4, 2019, 3:59pm UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/9 "2019-05-04T15:59:44Z")

</div>

I remember there was some bug in General where it assumed that any package without Project.toml was incompatible with any version of a package released after the porting script was executed? That could be a reason. Would be a simple PR to `KernelDensity` I think to add a Project.toml and then register.

---

<div class="post-metadata">

### Author: ![ablaom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ablaom/32/4889_2.png) [@ablaom](https://discourse.julialang.org/u/ablaom)
#### Post date: [May 6, 2019, 1:00am UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/10 "2019-05-06T01:00:52Z")

</div>

@Mattriks Or I can achieve the same by first adding Distributions, deleting the manifest (but see Pkg #1184) and then adding KernelDensity.

Thanks very much for the explanations. They dispel my confusion.

---

<div class="post-metadata">

### Author: ![Mattriks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mattriks/32/351_2.png) [@Mattriks](https://discourse.julialang.org/u/Mattriks)
#### Post date: [May 6, 2019, 1:09am UTC](https://discourse.julialang.org/t/incompabilities-between-package-versions/23609/11 "2019-05-06T01:09:05Z")

</div>

Or `]add Distributions@0.18`, then  
`]add KernelDensity`
