Pkg.gc() results in error

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.

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

1.6.1, version from the official Arch repos.

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

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

β”Œ 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

Don’t use that package, use aur:julia-bin instead

1 Like

Why?

Will be fixed in 1.6.2 that comes out soon.

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