# Pkg.gc() results in error

**URL:** <https://discourse.julialang.org/t/pkg-gc-results-in-error/63972>\
**Category:** General Usage\
**Created:** [July 3, 2021, 3:51am UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972 "2021-07-03T03:51:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [July 3, 2021, 3:51am UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972/1 "2021-07-03T03:51:15Z")

</div>

```julia
julia> import Pkg

julia> Pkg.gc()
ERROR: SystemError: opening file "/usr/share/julia/logs/manifest_usage.toml": Permission denied
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:174
  [2] #systemerror#68
    @ ./error.jl:173 [inlined]
  [3] systemerror
    @ ./error.jl:173 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Bool, append::Nothing)
    @ Base ./iostream.jl:293
  [5] open(fname::String, mode::String; lock::Bool)
    @ Base ./iostream.jl:355
  [6] open(fname::String, mode::String)
    @ Base ./iostream.jl:355
  [7] open(::Pkg.API.var"#152#183", ::String, ::Vararg{String}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:328
  [8] open
    @ ./io.jl:328 [inlined]
  [9] (::Pkg.API.var"#write_condensed_toml#182")(f::Pkg.API.var"#153#184", usage_by_depot::Dict{String, Dict{String, Dates.DateTime}}, fname::String)
    @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:543
 [10] gc(ctx::Pkg.Types.Context; collect_delay::Dates.Day, verbose::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:551
 [11] gc (repeats 2 times)
    @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.7/Pkg/src/API.jl:451 [inlined]
 [12] top-level scope
    @ REPL[2]:1

```

I assume this is a problem with Julia being unable to access the root directory, but I’m not sure why Julia is playing around in root rather than using my home directory, and I have no idea how to fix it.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 3, 2021, 8:28am UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972/2 "2021-07-03T08:28:37Z")

</div>

Which Julia version? Should be fixed by [Only run gc on the user-depot unless force=true, fixes #2642. by fredrikekre · Pull Request #2654 · JuliaLang/Pkg.jl · GitHub](https://github.com/JuliaLang/Pkg.jl/pull/2654)

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [July 3, 2021, 4:07pm UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972/3 "2021-07-03T16:07:56Z")

</div>

1.6.1, version from the official Arch repos.

---

<div class="post-metadata">

**Author:** ![genkuroki](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/genkuroki/32/18030_2.png) [@genkuroki](https://discourse.julialang.org/u/genkuroki)\
**Post date:** [July 3, 2021, 4:53pm UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972/4 "2021-07-03T16:53:31Z")

</div>

I have a similar problem on Windows 10 Home edition.

Pkg.gc()'s of v1.7.0-beta2 and v1.8.0-DEV.94 work fine, but v1.6.1 not. (All official binaries.)

 ![2021-07-04 (3)](https://global.discourse-cdn.com/julialang/original/3X/a/e/ae58b5d0c7dec51255dcfdf852640d1a3c9ad873.png)

 ![2021-07-04 (2)](https://global.discourse-cdn.com/julialang/original/3X/b/f/bf6c088e95ca84976512acaffd41ed8402389677.png)

 ![2021-07-04 (1)](https://global.discourse-cdn.com/julialang/original/3X/2/6/266394a9db019ccb0278dd6372edfca572a1cae8.png)

Full error messages of v1.6.1’s Pkg.gc():

```julia
┌ Error: Could not parse entry for `deps`
└ @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\manifest.jl:150
┌ Warning: Reading manifest file at D:\.julia\environments\v1.8\Manifest.toml failed with error
│ exception =
│ MethodError: no method matching get(::Pair{String, Any}, ::String, ::Nothing)
│ Closest candidates are:
│ get(::IOContext, ::Any, ::Any) at show.jl:342
│ get(::Base.ImmutableDict, ::Any, ::Any) at dict.jl:787
│ get(::Dict{K, V}, ::Any, ::Any) where {K, V} at dict.jl:504
│ ...
└ @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:504
┌ Error: Could not parse entry for `deps`
└ @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\manifest.jl:150
┌ Warning: Reading manifest file at D:\.julia\environments\v1.7\Manifest.toml failed with error
│ exception =
│ MethodError: no method matching get(::Pair{String, Any}, ::String, ::Nothing)
│ Closest candidates are:
│ get(::IOContext, ::Any, ::Any) at show.jl:342
│ get(::Base.ImmutableDict, ::Any, ::Any) at dict.jl:787
│ get(::Dict{K, V}, ::Any, ::Any) where {K, V} at dict.jl:504
│ ...
└ @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:504
┌ Error: Could not parse entry for `deps`
└ @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\manifest.jl:150
┌ Warning: Reading manifest file at D:\.julia\packages\PackageCompiler\ztq60\examples\MyApp\Manifest.toml failed with error
│ exception =
│ MethodError: no method matching get(::Pair{String, Any}, ::String, ::Nothing)
│ Closest candidates are:
│ get(::IOContext, ::Any, ::Any) at show.jl:342
│ get(::Base.ImmutableDict, ::Any, ::Any) at dict.jl:787
│ get(::Dict{K, V}, ::Any, ::Any) where {K, V} at dict.jl:504
│ ...
└ @ Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:504
      Active manifest files: 6 found
      Active artifact files: 104 found
┌ Error: Could not parse entry for `deps`
└ @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\manifest.jl:150
┌ Error: Could not parse entry for `deps`
└ @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\manifest.jl:150
┌ Error: Could not parse entry for `deps`
└ @ Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\manifest.jl:150
      Active scratchspaces: 15 found
     Deleted no artifacts, repos, packages or scratchspaces

```

---

<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:** [July 4, 2021, 12:50pm UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972/5 "2021-07-04T12:50:33Z")

</div>

> [@ParadaCarleton](#):
>
> 1.6.1, version from the official Arch repos.

Don’t use that package, use [`aur:julia-bin`](https://aur.archlinux.org/packages/julia-bin) instead

---

<div class="post-metadata">

**Author:** ![ParadaCarleton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paradacarleton/32/20005_2.png) [@ParadaCarleton](https://discourse.julialang.org/u/ParadaCarleton)\
**Post date:** [July 4, 2021, 4:00pm UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972/6 "2021-07-04T16:00:47Z")

</div>

Why?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [July 4, 2021, 4:49pm UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972/7 "2021-07-04T16:49:32Z")

</div>

> [@genkuroki](#):
>
> Full error messages of v1.6.1’s Pkg.gc():

Will be fixed in 1.6.2 that comes out soon.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 4, 2021, 5:33pm UTC](https://discourse.julialang.org/t/pkg-gc-results-in-error/63972/8 "2021-07-04T17:33:17Z")

</div>

because Julia is most stable when compiled against the versions of supporting libraries (most importantly LLVM) as-is. Now, Julia would be happy to upstream the things we patch but that’s not always easy / fast.

In short, you run into more errors because distribution maintainers don’t test Julia as carefully much as Julia people test Julia
