ERROR: KeyError: key "git-tree-sha1" not found when doing `Pkg.instantiate()`

Hi everyone,

I’m using Julia 1.0. First when I do:

julia> using Flux
[ Info: Precompiling Flux [587475ba-b771-5e3f-ad9e-33799f191a9c]
ERROR: LoadError: ArgumentError: Package Zygote [e88e6eb3-aa80-5325-afca-941959d7151f] is required but does not seem to be installed:
 - Run `Pkg.instantiate()` to install all recorded dependencies.

Stacktrace:
 [1] _require(::Base.PkgId) at ./loading.jl:929
 [2] require(::Base.PkgId) at ./loading.jl:858
 [3] require(::Module, ::Symbol) at ./loading.jl:853
 [4] include at ./boot.jl:317 [inlined]
 [5] include_relative(::Module, ::String) at ./loading.jl:1044
 [6] include(::Module, ::String) at ./sysimg.jl:29
 [7] top-level scope at none:2
 [8] eval at ./boot.jl:319 [inlined]
 [9] eval(::Expr) at ./client.jl:393
 [10] top-level scope at ./none:3
in expression starting at /Users/gaurav/.julia/dev/Flux/src/Flux.jl:7
ERROR: Failed to precompile Flux [587475ba-b771-5e3f-ad9e-33799f191a9c] to /Users/gaurav/.julia/compiled/v1.0/Flux/QdkVy.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1203
 [3] _require(::Base.PkgId) at ./loading.jl:960
 [4] require(::Base.PkgId) at ./loading.jl:858

I get the error to instantiate the package, which I tried doing but get the below error:

julia> Pkg.instantiate()
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
ERROR: KeyError: key "git-tree-sha1" not found
Stacktrace:
 [1] getindex(::Dict{String,Any}, ::String) at ./dict.jl:478
 [2] #instantiate#61(::Nothing, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:558
 [3] instantiate at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:537 [inlined]
 [4] #instantiate#60 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:535 [inlined]
 [5] instantiate() at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:535
 [6] top-level scope at none:0

If anyone wants to look at my status here’s that:

(Flux) pkg> status
Project Flux v0.12.4
    Status `~/.julia/dev/Flux/Project.toml`
  [1520ce14] AbstractTrees v0.3.4
→ [79e6a3ab] Adapt v3.3.0
→ [052768ef] CUDA v3.0.3
→ [944b1d66] CodecZlib v0.7.0
→ [5ae59095] Colors v0.12.7
→ [d9f16b24] Functors v0.2.1
  [e5e0dc1b] Juno v0.8.4
  [1914dd2f] MacroTools v0.5.6
→ [872c559c] NNlib v0.7.19
→ [a00861dc] NNlibCUDA v0.1.0
→ [189a3867] Reexport v1.0.0
→ [2913bbd2] StatsBase v0.33.5
→ [a5390f91] ZipFile v0.9.3
→ [e88e6eb3] Zygote v0.6.10
  [8bb1440f] DelimitedFiles 
  [37e2e46d] LinearAlgebra 
  [44cfe95a] Pkg 
  [de0858da] Printf 
  [9a3f8284] Random 
  [ea8e919c] SHA 
  [10745b16] Statistics 
  [8dfed614] Test 
┌ Warning: Some packages (indicated with a red arrow) are not downloaded, use `instantiate` to instantiate the current environment
└ @ Pkg.Display /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Display.jl:194

I couldn’t find the solution from the current topics, some help would be appreciated.

[EDIT]: Here’s my Manifest.toml: https://gist.github.com/gxyd/259a079fe0b8c079345d10e2ef8c51a8

I think the issue might have something to do with the version of Julia. When I tried the same things on Julia 1.6, I get it working without any issues. I’m not really sure as to why that happened with Julia 1.0 though.

The basic problem is that recent versions of Flux are not compatible with Julia 1.0 and your Manifest was presumably created by Julia 1.6. The reason for the difficult to understand error is probably that Julia 1.6 elevated some packages to stdlib status, which are handled differently in Manifests, and Pkg in Julia 1.0 did not foresee that this might happen.

If you add Flux in a new environment with Julia 1.0 things should work, but you will get a somewhat old version of Flux and its dependencies. You may also have a harder time getting binary dependencies in place (CUDA etc) since this was less sophisticated before the introduction of the artifacts infrastructure in Julia 1.3.

2 Likes