# Resolve package name to UUID

**URL:** <https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282>\
**Category:** Package Management\
**Tags:** question\
**Created:** [December 2, 2025, 10:19am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282 "2025-12-02T10:19:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 2, 2025, 10:19am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/1 "2025-12-02T10:19:03Z")

</div>

Is there an API for resolving the _name_ of a package (a string) to the _UUID_ of a package (in a specific registry, defaulting to `General`)? The package is not necessarily installed in the local environment.

[this has been asked earlier, see [here](https://discourse.julialang.org/t/pkg-api-for-getting-uuid-of-another-package/15061) and [here](https://discourse.julialang.org/t/how-can-i-know-the-uuid-of-a-registered-package/14081). I am aware of the possibility of installing the package and then looking in the manifest, or digging the UUID out from Github, looking for a solution within Julia.]

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 2, 2025, 10:35am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/2 "2025-12-02T10:35:44Z")

</div>

You can certainly retrieve it with non-public Pkg functions, but if you want a stable solution, this is the best I can propose:

```julia-auto
using RegistryInstances: reachable_registries
function find_uuid(registry_name, package_name)
    registry = only(filter(r -> r.name == registry_name, reachable_registries()))
    return only(key for (key, value) in registry.pkgs if value.name == package_name)
end

```

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [December 2, 2025, 10:35am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/3 "2025-12-02T10:35:59Z")

</div>

You could use RegistryInstances:

```julia
julia> using RegistryInstances

julia> general = first(reachable_registries()) # if General is the first registry in the list
Registry: "General" at "/Users/eph/.julia/registries/General.toml":
  uuid: 23338594-aafe-5451-b93e-139f81909106
  repo: https://github.com/JuliaRegistries/General.git
  git-tree-sha1: e50069c157ca55b02def51fe6395dcf5444f2c3b
  packages: 12940

julia> lookup = Dict(entry.name => uuid for (uuid, entry) in general.pkgs)
Dict{String, Base.UUID} with 12940 entries:
  "FastaLoader" => UUID("139838d8-4077-4d8a-94e1-e6dd554a184c")
  "GAP_pkg_digraphs_jll" => UUID("ce5c30f6-a98c-53bc-b643-089f5717f8db")
  "SyntaxTree" => UUID("a4af3ec5-f8ac-5fed-a759-c2e80b4d74cb")
  "TypeParsers" => UUID("6b5504e1-0c77-489f-ba22-2b282cee145f")
  "GeneratorArrays" => UUID("8fff9178-7e8c-4f28-98e3-90d0f4178808")
  "Luxor" => UUID("ae8d54c2-7ccd-5906-9d76-62fc9837b5bc")
  "Foresight" => UUID("c6e1034d-1844-4b96-abf2-c5824a5aa8c3")
  "AtomsBase" => UUID("a963bdd2-2df7-4f54-a1ee-49d51e6be12a")
  "BloqadeGates" => UUID("9b473568-af80-491c-8f51-e251334462c1")
  "NVTX_jll" => UUID("e98f9f5b-d649-5603-91fd-7774390e6439")
  "ClimaAnalysis" => UUID("29b5916a-a76c-4e73-9657-3c8fd22e65e6")
  "UnsafeArrays" => UUID("c4a57d5a-5b31-53a6-b365-19f8c011fbd6")
  "HackerNews" => UUID("d281a1a7-e441-575c-a368-03cb18f92a7f")
  "BifurcationKit" => UUID("0f109fa4-8a5d-4b75-95aa-f515264e7665")
  "GAP_pkg_ace_jll" => UUID("6e11effc-327b-571d-98e3-e12b1d1e7421")
  "Ai4EComponentLib" => UUID("9901752a-13b3-47c7-8fb4-ce17182539d9")
  "Lectionary" => UUID("6244d477-9cf0-4e07-8f6b-f8ee26bc0292")
  "PowerModelsONM" => UUID("25264005-a304-4053-a338-565045d392ac")
  "Avalon" => UUID("d462d321-1585-4840-9f3e-06f5c1b6ea25")
  "CUDA_Runtime_jll" => UUID("76a88914-d11a-5bdc-97e0-2f5a05c973a2")
  "CommonSolve" => UUID("38540f10-b2f7-11e9-35d8-d573e4eb0ff2")
  "libboxer_jll" => UUID("5847ba37-b048-5c88-b501-c62f664b1471")
  "SentinelMissings" => UUID("b1dc47e8-ebfd-568c-9de9-431a7ef94af6")
  "FlexiGroups" => UUID("1e56b746-2900-429a-8028-5ec1f00612ec")
  "MaximumIndependentSet" => UUID("9e812ceb-42a3-473a-b295-b8bb2099a8ce")
  "RadiiPolynomial" => UUID("f2081a94-c849-46b6-8dc9-07bb90ed72a9")
  "Trixi2Vtk" => UUID("bc1476a1-1ca6-4cc3-950b-c312b255ff95")
  ⋮ => ⋮

julia> lookup["JuMP"]
Base.UUID("4076af6c-e467-56ae-b986-b466b2749572")

```

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 2, 2025, 10:42am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/4 "2025-12-02T10:42:19Z")

</div>

If someone wants to add a function doing this to RegistryInstances.jl, with a little more polish than my suggestion, I’m receptive to PRs.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 2, 2025, 10:46am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/5 "2025-12-02T10:46:02Z")

</div>

I am now confused, isn’t that done already by [`RegistryInstances.uuids_from_name`](https://github.com/GunnarFarneback/RegistryInstances.jl/blob/2796d959014475bc19e2dfa174179cdf02642d28/src/registry_instance.jl#L308)?

(Great package, and answers my question!)

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 2, 2025, 10:52am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/6 "2025-12-02T10:52:24Z")

</div>

It covers the second line of my function. Goes to show how well I know my own package. 🙂

(To be clear I haven’t written much more than the README. The code is a snapshot of the Pkg code for handling registries, specifically intended to make it publically available without locking Pkg itself to a specific API.)

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [December 2, 2025, 11:32am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/7 "2025-12-02T11:32:24Z")

</div>

I may be misremembering something, but isn’t it in general permitted to have the same name multiple times in a registry? Or is the mapping to a UUID guaranteed unique within one registry?

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 2, 2025, 11:52am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/8 "2025-12-02T11:52:25Z")

</div>

The Pkg and registry design allows multiple packages with the same name in one registry. The current registry tooling does not support it but it can be added when needed. The General registry will most likely never allow it.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [December 2, 2025, 5:26pm UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/9 "2025-12-02T17:26:03Z")

</div>

Then I remembered correctly, thanks! I guess such a mapping from package name to one single UUID is too simplistic then 😅

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 2, 2025, 7:05pm UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/10 "2025-12-02T19:05:43Z")

</div>

Just to clarify, the use case is filling in parts of the `Project.toml` that have no CLI API, eg `[weakdeps]`.

---

<div class="post-metadata">

**Author:** ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)\
**Post date:** [December 2, 2025, 7:11pm UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/11 "2025-12-02T19:11:55Z")

</div>

In 1.12 at least, you can do `pkg> add --weak Example` to add a weak dep.

Also, something a lot of folks don’t know, is you can use the `?` help mode from the pkg mode, like `pkg>?add` which lists the options.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 2, 2025, 7:43pm UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/12 "2025-12-02T19:43:15Z")

</div>

I have always added them as regular dependencies and then moved them with my editor. Picking up the UUID from a side channel sounds much more annoying.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 4, 2025, 5:44am UTC](https://discourse.julialang.org/t/resolve-package-name-to-uuid/134282/13 "2025-12-04T05:44:56Z")

</div>

> [@GunnarFarneback](#):
>
> I have always added them as regular dependencies and then moved them with my editor.

But then things precompile, which is time-consuming.

> [@ericphanson](#):
>
> In 1.12 at least, you can do `pkg> add --weak Example` to add a weak dep.

Good point, thanks!
