How to know why a Julia package is downgraded?

Sometimes packages seem to be randomly downgraded while update is run:

(v1.3) pkg> update
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
  Updating `~/.julia/environments/v1.3/Project.toml`
 [no changes]
  Updating `~/.julia/environments/v1.3/Manifest.toml`
  [b552c78f] ↓ DiffRules v1.0.0 ⇒ v0.1.0

At the same time DiffRules 0.1.0 is not a strict dependency:

add DiffRules@1
 Resolving package versions...
  Updating `~/.julia/environments/v1.3/Project.toml`
  [b552c78f] + DiffRules v1.0.0
  Updating `~/.julia/environments/v1.3/Manifest.toml`
  [b552c78f] ↑ DiffRules v0.1.0 ⇒ v1.0.0

How do I know why the package is downgraded and what package requires DiffRules 0.1.0 but not 1.0? Shouldn’t the latest be installed automatically?

Mostly it is because compat bounds of the packages that you have are old.

So Pkg manager downgrades one specific package so all the packages use compatible compat bounds.

This is also an issue with Flux. Colors compat bounds are old, but there are other packages that use newer Colors. This is when Pkg downgrades for example Flux to a point that it didn’t have any restriction or it was more relaxed.
https://github.com/FluxML/Flux.jl/pull/984

If everyone use CompatHelper, and not to remove the support for older versions of a package for no reason, this issue gets resolved

You can also have different folders on your system, and activate there to keep separate environments that don’t clash with each other.

2 Likes

You can find reverse dependencies in Julia Observer (look at the pane “Used by”):
https://www.juliaobserver.com/packages/DiffRules

It seems that packages marked in italics are reverse dependencies, so you can check which ones are in your environment.

But wouldn’t a compatibility error be cast if I tried to install a version outside compat bounds?

Deps are also listed in the manifest, but the versions are not there.

Yes, sure. The advantage of Julia Observer is that it gives you the list of reverse dependencies, so that you don’t have to go through the manifest file and look for packages that have the downgraded one among its deps (in this case DiffRules).

Regarding the version number, you can go to your local registry (.julia/registries etc.), and look into the Compat.toml file of the packages that depend on the one that was downgraded. It should be possible to create a script that does that search and tells you what packages are setting the upper compat limit.