# Why Random.jl is fixed to version 0.0.0?

**URL:** <https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957>\
**Category:** General Usage\
**Tags:** gpu, flux, autodiff\
**Created:** [November 8, 2023, 3:46pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957 "2023-11-08T15:46:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bicycle1885](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bicycle1885/32/107_2.png) [@bicycle1885](https://discourse.julialang.org/u/bicycle1885)\
**Post date:** [November 8, 2023, 3:46pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/1 "2023-11-08T15:46:22Z")

</div>

I’m trying to explicitly specify the compatibilities of some standard packages as [recently required](https://discourse.julialang.org/t/psa-compat-requirements-in-the-general-registry-are-changing/104958) 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:

```julia
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](https://github.com/FluxML/NNlib.jl/actions/runs/6798858467/job/18483855640?pr=550) 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?

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [November 8, 2023, 4:39pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/2 "2023-11-08T16:39:29Z")

</div>

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:

```toml
[compat]
StdlibName = "<0.0.1, 1"

```

For the SHA stdlib specifically, the fix is:

```toml
[compat]
SHA = "<0.0.1, 0.7, 1"

```

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [August 26, 2024, 6:20pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/3 "2024-08-26T18:20:51Z")

</div>

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 😕

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

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [August 26, 2024, 6:21pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/4 "2024-08-26T18:21:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [August 26, 2024, 6:30pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/5 "2024-08-26T18:30:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [August 26, 2024, 6:33pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/6 "2024-08-26T18:33:00Z")

</div>

Or could we do this en masse in the registry?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [August 26, 2024, 6:59pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/7 "2024-08-26T18:59:21Z")

</div>

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?)

---

<div class="post-metadata">

**Author:** ![MilesCranmer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milescranmer/32/21070_2.png) [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Post date:** [August 26, 2024, 7:12pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/8 "2024-08-26T19:12:46Z")

</div>

> [@stevengj](#):
>
> (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.

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [August 26, 2024, 7:17pm UTC](https://discourse.julialang.org/t/why-random-jl-is-fixed-to-version-0-0-0/105957/9 "2024-08-26T19:17:59Z")

</div>

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