# Precompilation failure caused by package dependency version

**URL:** <https://discourse.julialang.org/t/precompilation-failure-caused-by-package-dependency-version/92995>\
**Category:** Performance\
**Tags:** package, precompilation\
**Created:** [January 15, 2023, 4:02pm UTC](https://discourse.julialang.org/t/precompilation-failure-caused-by-package-dependency-version/92995 "2023-01-15T16:02:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rex\_Wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rex_wang/32/35108_2.png) [@Rex\_Wang](https://discourse.julialang.org/u/Rex_Wang)\
**Post date:** [January 15, 2023, 4:02pm UTC](https://discourse.julialang.org/t/precompilation-failure-caused-by-package-dependency-version/92995/1 "2023-01-15T16:02:03Z")

</div>

I am trying to install two packages `ClimeTools` and `MultivariateStats`. The former requires version `0.32.2` of the package `StatsBase` while the latter requires `0.33.21`. This results in a conflict and prevents me from successfully precompiling both packages at the same time.

Here is the code to reproduce this problem:

```julia
# Entering Pkg mode
]active --temp
]add ClimateTools # It shows that [2913bbd2] + StatsBase v0.32.2
]add StatsBase # automated install v0.32.2 rather than the latest one
]st
      Status `/tmp/jl_mYrz3B/Project.toml`
  [4f4ee721] ClimateTools v0.23.1
  [2913bbd2] StatsBase v0.32.2

```

Now, try to install `MultivariateStats`

```julia
]add MultivariateStats # fails to precompile
]update
]precompile # precompilation of `MultivariateStats` fails again

```

If I specify a version for `StatsBase`, it will downgrade `ClimeTools` and cause the correspondent precompilation to fail."

```julia
]add StatsBase@33 # It shows that [4f4ee721] ↓ ClimateTools v0.23.1 ⇒ v0.13.0
]precompile # ClimeTools fails to precompile
]st
      Status `/tmp/jl_mYrz3B/Project.toml`
  [4f4ee721] ClimateTools v0.13.0
  [6f286f6a] MultivariateStats v0.10.0
  [2913bbd2] StatsBase v0.33.21

```

Is there any trick to solve this problem? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Krastanov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/krastanov/32/6817_2.png) [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Post date:** [January 15, 2023, 5:10pm UTC](https://discourse.julialang.org/t/precompilation-failure-caused-by-package-dependency-version/92995/2 "2023-01-15T17:10:08Z")

</div>

It seems `ClimateTools` insists on old versions for a lot of packages (e.g. check out the large amount of unmerged CompatBot PRs [Pull requests · JuliaClimate/ClimateTools.jl · GitHub](https://github.com/JuliaClimate/ClimateTools.jl/pulls) )

One way around the issue for me was to start by pinning `MultivariateStats` and `StatsBase` to their newest versions and to install `ClimateTools` after that:

```julia
(climetoolstest) pkg> st
Status `/tmp/climetoolstest/Project.toml`
⌃ [4f4ee721] ClimateTools v0.13.0
  [6f286f6a] MultivariateStats v0.10.0
  [2913bbd2] StatsBase v0.33.21
Info Packages marked with ⌃ have new versions available

```

That is a pretty ancient version of `ClimateTools` though. Everything precompiles fine now (but keep in mind that Project.toml is not enough to fully define the system, you need Manifest.toml for that, because the order of installations might matter to the resolver).

My amateur guess is that somewhere deep in the mutual dependencies of these packages `ClimateTools` needs an old version of a package, which is listed as supported in the Project.toml file of `MultivariateStats` (or dependencies), but is not actually supported. Someone has release a new version of their package and has not noticed that they rely on a newer feature in one of their dependencies. That should be found and fixed, but I think it is much more urgent that someone goes through the CompatBot pull requests for ClimateTools.
