# How to see all installed packages? + a few other \`Pkg\` related questions

**URL:** https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231
**Category:** New to Julia
**Created:** [December 31, 2016, 7:01pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231 "2016-12-31T19:01:15Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [December 31, 2016, 7:01pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/1 "2016-12-31T19:01:15Z")

</div>

1. I have more than a hundred packages installed. But `Pkg.installed()` only lists some 40 due to the size of the terminal window. How can I see all installed packages?

2. Also, how can I have the installed packages printed alphabetically using `Pkg.installed()`? It’s hard to pick ham from peas.

3. It takes more than 5 minutes on my machine for `Pkg.installed()` to return. Is this normal?

4. Is there a way to see all registered Julia packages on the METADATA git page: [https://github.com/JuliaLang/METADATA.jl](https://github.com/JuliaLang/METADATA.jl). The last 277 packages are not see-able on that page.

5. I use a package which is registered with METADATA. But I don’t use its tagged version, since it’s too old. I use the development version that I checked out from its git repo. However, each time when I `Pkg.update()`, the tagged version is installed automatically and overrides the version I intend to use. This really drive me nuts as I have to manually `Pkg.rm` the tagged version. Is there a way to avoid this?

Sorry to be lengthy. Thanks!!

---

<div class="post-metadata">

### Author: ![bluesmoon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluesmoon/32/327_2.png) [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)
#### Post date: [December 31, 2016, 7:16pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/2 "2016-12-31T19:16:16Z")

</div>

I’ll try and answer these questions, though I’m no expert.

- `Pkg.installed()` returns a `Dict`, so you could pass it to the `sort` function and also write a loop to see the list a few lines at a time, or just list all the keys in alphabetical order

- It will probably be O(n) on the number of packages since it’s a file-system operation to look through all packages on disk

- `git clone https://github.com/JuliaLang/METADATA.jl` and then view the file locally. The limitation on what you see on the github page is imposed by github.

- Try `Pkg.pin` to pin the package to the version you want, or `Pkg.checkout` to always stay on the latest version.

---

<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: [December 31, 2016, 7:17pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/3 "2016-12-31T19:17:51Z")

</div>

> [@chobbes](#):
>
> I have more than a hundred packages installed. But Pkg.installed() only lists some 40 due to the size of the terminal window. How can I see all installed packages?
> 
> Also, how can I have the installed packages printed alphabetically using Pkg.installed()? It’s hard to pick ham from peas.

`sort(collect(Pkg.installed()))` will print them in sorted order. `show(STDOUT, "text/plain", sort(collect(Pkg.installed())))` will print them all, but it would be nice to have something better by default.

> [@chobbes](#):
>
> It takes more than 5 minutes on my machine for Pkg.installed() to return. Is this normal?

Are you using Windows? Julia’s package system currently uses lots of little files in the METADATA repo to store metadata, which is pretty slow on Windows (it was even worse before we switched to libgit in Julia 0.5). At some point we are hoping to switch to a new package metadata system that will eliminate this problem ([https://github.com/JuliaLang/Juleps/blob/master/Pkg3.md](https://github.com/JuliaLang/Juleps/blob/master/Pkg3.md)).

> [@chobbes](#):
>
> Is there a way to see all registered Julia packages on the METADATA git page: [GitHub - JuliaLang/METADATA.jl: Metadata for registered Julia packages up to Julia v0.6. No longer maintained. Please see https://github.com/JuliaRegistries/General instead.](https://github.com/JuliaLang/METADATA.jl). The last 277 packages are not see-able on that page.

Normally I would recommend looking at the listing at [http://pkg.julialang.org/](http://pkg.julialang.org/)

To see the github listing directly you may have to clone the repo, or do `print(readdir(Pkg.dir("METADATA")))` in Julia.

> [@chobbes](#):
>
> I use a package which is registered with METADATA. But I don’t use its tagged version, since it’s too old. I use the development version that I checked out from its git repo. However, each time when I Pkg.update(), the tagged version is installed automatically and overrides the version I intend to use. This really drive me nuts as I have to manually Pkg.rm the tagged version. Is there a way to avoid this?

Normally if you do `Pkg.checkout("somepackage")`, then `update()` will stay on the master release. Is that not working?

---

<div class="post-metadata">

### Author: ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)
#### Post date: [December 31, 2016, 7:20pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/4 "2016-12-31T19:20:34Z")

</div>

> [@chobbes](#):
>
> 1. I have more than a hundred packages installed. But `Pkg.installed()` only lists some 40 due to the size of the terminal window. How can I see all installed packages?

A faster way to access the installed packages can be to read all directories in `Pkg.dir()`

```julia
readdir(Pkg.dir())

```

Please note that there are some extra directories in it (like `.cache`, `.trash`, and `METADATA`). If you want to print them all alphabetically:

```julia
 println.(readdir(Pkg.dir()));

```

> [@chobbes](#):
>
> 4. Is there a way to see all registered Julia packages on the METADATA git page: [GitHub - JuliaLang/METADATA.jl: Metadata for registered Julia packages up to Julia v0.6. No longer maintained. Please see https://github.com/JuliaRegistries/General instead.](https://github.com/JuliaLang/METADATA.jl). The last 277 packages are not see-able on that page.

[http://pkg.julialang.org/](http://pkg.julialang.org/)

---

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [December 31, 2016, 9:29pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/5 "2016-12-31T21:29:54Z")

</div>

> [@bluesmoon](#):
>
> Pkg.installed() returns a Dict, so you could pass it to the sort function and also write a loop to see the list a few lines at a time, or just list all the keys in alphabetical order  
> showall(sort(collect(keys(Pkg.installed()))))

Thanks!

> [@bluesmoon](#):
>
> git clone [GitHub - JuliaLang/METADATA.jl: Metadata for registered Julia packages up to Julia v0.6. No longer maintained. Please see https://github.com/JuliaRegistries/General instead.](https://github.com/JuliaLang/METADATA.jl) and then view the file locally. The limitation on what you see on the github page is imposed by github.

I’m inclined not to clone the repo. I think @stevengj’s method works better for me.

> [@bluesmoon](#):
>
> Try Pkg.pin to pin the package to the version you want, or Pkg.checkout to always stay on the latest version.

Thanks for the tip!

---

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [December 31, 2016, 9:34pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/6 "2016-12-31T21:34:45Z")

</div>

> [@stevengj](#):
>
> sort(collect(Pkg.installed())) will print them in sorted order. show(STDOUT, “text/plain”, sort(collect(Pkg.installed()))) will print them all, but it would be nice to have something better by default.

Yes. It’ll be more convenient if something like `show(STDOUT, "text/plain", sort(collect(Pkg.installed())))` can be set as default or at least be able to be opt for.

> [@stevengj](#):
>
> Are you using Windows? Julia’s package system currently uses lots of little files in the METADATA repo to store metadata, which is pretty slow on Windows (it was even worse before we switched to libgit in Julia 0.5). At some point we are hoping to switch to a new package metadata system that will eliminate this problem ([https://github.com/JuliaLang/Juleps/blob/master/Pkg3.md](https://github.com/JuliaLang/Juleps/blob/master/Pkg3.md)).

No. I’m on Ubuntu. I think it’s more or less because my machine is old and was running something else at the same time, though it’s definitely on the scale of minutes rather than seconds.

> [@stevengj](#):
>
> print(readdir(Pkg.dir(“METADATA”))) in Julia.

This works perfectly.

> [@stevengj](#):
>
> Normally if you do Pkg.checkout(“somepackage”), then update() will stay on the master release. Is that not working?

Thanks for the tip!

---

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [December 31, 2016, 9:36pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/7 "2016-12-31T21:36:17Z")

</div>

> [@giordano](#):
>
> readdir(Pkg.dir())

Yes, it’s indeed quicker than `Pkg.installed()`, as I usually don’t care much about the version tags. Thanks!

---

<div class="post-metadata">

### Author: ![bluesmoon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluesmoon/32/327_2.png) [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)
#### Post date: [December 31, 2016, 10:18pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/9 "2016-12-31T22:18:09Z")

</div>

Pkg.dir() only lists the first package directory. This doesn’t work if you have multiple package directories.

---

<div class="post-metadata">

### Author: ![chobbes](https://avatars.discourse-cdn.com/v4/letter/c/848f3c/32.png) [@chobbes](https://discourse.julialang.org/u/chobbes)
#### Post date: [December 31, 2016, 10:33pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/10 "2016-12-31T22:33:22Z")

</div>

> [@bluesmoon](#):
>
> Pkg.dir() only lists the first package directory. This doesn’t work if you have multiple package directories.

Thanks for pointing out. I wasn’t aware of this.

---

<div class="post-metadata">

### Author: ![sagearbor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sagearbor/32/6871_2.png) [@sagearbor](https://discourse.julialang.org/u/sagearbor)
#### Post date: [January 24, 2019, 6:29pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/11 "2019-01-24T18:29:16Z")

</div>

filter((x) → typeof(eval(x)) \<: Module && x ≠ :Main, names(Main,imported=true))

---

<div class="post-metadata">

### Author: ![bestfriend](https://avatars.discourse-cdn.com/v4/letter/b/4bbf92/32.png) [@bestfriend](https://discourse.julialang.org/u/bestfriend)
#### Post date: [November 27, 2019, 7:39pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/12 "2019-11-27T19:39:50Z")

</div>

To answer (1) and (2): `Pkg.status()`

This was the best option for me on Julia v1.2.0.

---

<div class="post-metadata">

### Author: ![Juan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juan/32/7657_2.png) [@Juan](https://discourse.julialang.org/u/Juan)
#### Post date: [October 26, 2020, 7:51pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/13 "2020-10-26T19:51:06Z")

</div>

How is this done now?

```julia
Pkg.installed()
Warning: Pkg.installed() is deprecated

```

```julia
> Pkg.status()
Status `C:\Users\myname\.julia\environments\v1.5\Project.toml` (empty project)

```

---

<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: [October 27, 2020, 9:22am UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/14 "2020-10-27T09:22:06Z")

</div>

It should work, the above means your project is empty.

---

<div class="post-metadata">

### Author: ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)
#### Post date: [December 26, 2020, 12:48pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/15 "2020-12-26T12:48:11Z")

</div>

If _it_ refers to getting the names of the installed packages in alphabetical order without using the deprecated package, then you can use something like

```julia
julia> io = IOBuffer();

julia> using Pkg; Pkg.status(; io)

julia> text = String(take!(io));

julia> lines = split(text, '\n')[2:end-1]
5-element Array{SubString{String},1}:
 " [336ed68f] CSV v0.8.2"
 " [a93c6f00] DataFrames v0.22.2"
 " [59287772] Formatting v0.4.2"
 " [713c75ef] Franklin v0.10.21"
 " [38e38edf] GLM v1.3.11"

julia> lines_without_id = [l[14:end] for l in lines]
5-element Array{SubString{String},1}:
 "CSV v0.8.2"
 "DataFrames v0.22.2"
 "Formatting v0.4.2"
 "Franklin v0.10.21"
 "GLM v1.3.11"

```

this assumes quite a lot about the appearance of the output of `Pkg.status`. So, not very reliable, but could be useful for scripts.

---

<div class="post-metadata">

### Author: ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)
#### Post date: [February 18, 2021, 3:30pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/16 "2021-02-18T15:30:48Z")

</div>

Less hacky version showing only the direct dependencies:

```julia
julia> using Pkg

julia> deps = [pair.second for pair in Pkg.dependencies()];

julia> direct_deps = filter(p -> p.is_direct_dep, deps);

julia> [(x.name, x.version) for x in direct_deps]
10-element Vector{Tuple{String, Any}}:
 ("Compose", v"0.9.2")
 ("DataFrames", v"0.22.3")
 ("Distributions", v"0.23.12")
 ("CategoricalArrays", v"0.8.3")
 ("KernelDensity", v"0.6.2")
 ("Gadfly", v"1.3.1")
 ("Random", nothing)
 ("MCMCChains", v"4.5.0")
 ("Test", nothing)
 ("Turing", v"0.15.1")

```

---

<div class="post-metadata">

### Author: ![ptoche](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ptoche/32/23554_2.png) [@ptoche](https://discourse.julialang.org/u/ptoche)
#### Post date: [April 27, 2021, 10:02am UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/17 "2021-04-27T10:02:09Z")

</div>

> [@rikh](#):
>
> `[(x.name, x.version) for x in direct_deps]`

Nice, but you still get an ellipsis in the middle, so you don’t see the full list.

---

<div class="post-metadata">

### Author: ![rikh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rikh/32/204104_2.png) [@rikh](https://discourse.julialang.org/u/rikh)
#### Post date: [April 27, 2021, 10:23am UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/18 "2021-04-27T10:23:13Z")

</div>

> [@ptoche](#):
>
> Nice, but you still get an ellipsis in the middle, so you don’t see the full list.

That is because Julia will pretty print the long vector. If you really want, you can force it to a string, so that Julia cannot shorten it.

Continuing from the previous code block:

```julia
julia> pkgs = [(x.name, x.version) for x in direct_deps];

julia> print(join(pkgs, '\n'))
("Compose", v"0.9.2")
("DataFrames", v"0.22.3")
("Distributions", v"0.23.12")
("CategoricalArrays", v"0.8.3")
("KernelDensity", v"0.6.2")
("Gadfly", v"1.3.1")
("Random", nothing)
("MCMCChains", v"4.5.0")
("Test", nothing)
("Turing", v"0.15.1")

```

I’ve tested this and it will show the full output even if the size exceeds the size of the terminal.

---

<div class="post-metadata">

### Author: ![ptoche](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ptoche/32/23554_2.png) [@ptoche](https://discourse.julialang.org/u/ptoche)
#### Post date: [April 27, 2021, 10:59am UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/19 "2021-04-27T10:59:47Z")

</div>

Rik you’re awesome thank you!

I’m going to clean things up (I have rejoined Julia after a long hiatus and didn’t realize about the environment system, so I’ve made a big mess of my packages). Here’s how I’ve made a list and plan to retrieve it later:

```
# make list of packages:
using Pkg
deps = [pair.second for pair in Pkg.dependencies()]
direct_deps = filter(p -> p.is_direct_dep, deps)
[(x.name, x.version) for x in direct_deps]
pkg_name_version = [(x.name, x.version) for x in direct_deps]
pkg_list = [x.name for x in direct_deps]

# save list for later:
outfile = "julia-dependencies-2021-04-27.txt"
open(outfile, "w") do f
  for i in pkg_list
    println(f, i)
  end
end

# retrieve list and add packages
using Pkg
infile = "julia-dependencies-2021-04-27.txt"
open(infile, "r") do file
    for line in eachline(file)
        Pkg.add(line)
    end
end

```

---

<div class="post-metadata">

### Author: ![austin-putz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/austin-putz/32/2583_2.png) [@austin-putz](https://discourse.julialang.org/u/austin-putz)
#### Post date: [January 14, 2023, 7:56pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/20 "2023-01-14T19:56:11Z")

</div>

I’m in Julia 1.8.5 and it says `Pkg.installed()` is deprecated, do you know the current function needed to get a Dict of packages installed?

---

<div class="post-metadata">

### Author: ![bluesmoon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bluesmoon/32/327_2.png) [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)
#### Post date: [January 14, 2023, 8:48pm UTC](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231/21 "2023-01-14T20:48:07Z")

</div>

No idea. I’m on 1.6.7 (LTS) with no plans to upgrade any time soon.

[Next page](https://discourse.julialang.org/t/how-to-see-all-installed-packages-a-few-other-pkg-related-questions/1231.md?page=2)
