Why Random.jl is fixed to version 0.0.0?

I’m trying to explicitly specify the compatibilities of some standard packages as recently required by the General registry. I added Random = "1.9" (or "1", I tried both, resulting in the same error) to Project.toml of NNlib.jl but the CI ended up with the following error in an integration test:

ERROR: LoadError: Unsatisfiable requirements detected for package Random [9a3f8284]:
 Random [9a3f8284] log:
 ├─possible versions are: 0.0.0 or uninstalled (package in sysimage!)
 ├─restricted to versions 1.6.0-1 by Lux [b2108857] — no versions left
 │ └─Lux [b2108857] log:
 │   ├─possible versions are: 0.5.9 or uninstalled
 │   └─Lux [b2108857] is fixed to version 0.5.9
 └─Random [9a3f8284] is fixed to version 0.0.0

(see Set compatibilities for standard packages · FluxML/NNlib.jl@25d4eca · GitHub for the complete messages)

Random.jl 1.6.0 or newer is required by Lux.jl and it was run on Julia 1.9.3, so there must be a natural compatibility. However, Random.jl is fixed to version 0.0.0 for some reason and we cannot satisfy the compatibility. What is the problem of this? Or do I misunderstand the error message?

Basically, this happens if either:

  1. You are using Julia 1.3 or earlier.
  2. You are using Julia 1.4+, and you do Pkg operations inside your test suite.

For almost all stdlibs (including Random), the fix is:

[compat]
StdlibName = "<0.0.1, 1"

For the SHA stdlib specifically, the fix is:

[compat]
SHA = "<0.0.1, 0.7, 1"
7 Likes

Just had to use this fix (thanks Dilum!). However I noticed this fix also downgrades many other packages to the version they had before the [compat] entries for stdlib was implemented. The only way this fix could work in practice is if all packages had the <0.0.1 fix. But nearly all packages do not :confused:

Is there any solution that fixes this issue without forcing a downgrade of any package that does not use the <0.0.1 spec?

We have to go back and retroactively modify the compat entries of old package versions.

Unfortunately I have 110 indirect dependencies :confused: So seems infeasible to correct all the compat. Are there any alternatives to this?

Or could we do this en masse in the registry?

Seems like it would be better to special-case this in the Pkg system — if a package depends on a stdlib and doesn’t have a compat entry, it should be automatically interpreted as "<0.0.1, 1" etc.

(Though that would leave older versions of Julia in the lurch?)

Right, and the issue is only seen on older versions of Julia. One possible fix is to automatically add the <0.0.1 to every stdlib [compat] in the registry, since then it would propagate to the older Julia as well.

Yeah, we should likely just make a single mass PR to the registry.

2 Likes