# Flux and Metal circular dependencies in 1.10.7

**URL:** <https://discourse.julialang.org/t/flux-and-metal-circular-dependencies-in-1-10-7/123698>\
**Category:** GPU\
**Tags:** flux, metaljl\
**Created:** [December 11, 2024, 10:07am UTC](https://discourse.julialang.org/t/flux-and-metal-circular-dependencies-in-1-10-7/123698 "2024-12-11T10:07:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrea\_Pagnani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrea_pagnani/32/3136_2.png) [@Andrea\_Pagnani](https://discourse.julialang.org/u/Andrea_Pagnani)\
**Post date:** [December 11, 2024, 10:07am UTC](https://discourse.julialang.org/t/flux-and-metal-circular-dependencies-in-1-10-7/123698/1 "2024-12-11T10:07:51Z")

</div>

Dearests,

I was inspecting my new MacBook pro M4 GPU capabilities. I created a TestMetal package on a fresh new environment in 1.10.7. I added Metal and Flux but received warnings that a circular dependency was detected.

```julia
(TestMetal) pkg> st
Project TestMetal v0.1.0
Status `~/SCRA/PKG/TestMetal/Project.toml`
  [587475ba] Flux
  [dde4c033] Metal

```

Then I instantiate the package

```julia
(TestMetal) pkg> instantiate
    Updating registry at `~/.julia/registries/General.toml`
    Updating `~/SCRA/PKG/TestMetal/Project.toml`
  [587475ba] + Flux v0.15.1
  [dde4c033] + Metal v1.4.2
    Updating `~/SCRA/PKG/TestMetal/Manifest.toml`
  [621f4979] + AbstractFFTs v1.5.0
  [7d9f7c33] + Accessors v0.1.39
  [79e6a3ab] + Adapt v4.1.1
  [dce04be8] + ArgCheck v2.4.0
  [a9b6321e] + Atomix v1.0.1
  [198e06fe] + BangBang v0.4.3
  [9718e550] + Baselet v0.1.1
  [fa961155] + CEnum v0.5.0
  [082447d4] + ChainRules v1.72.1
  [d360d2e6] + ChainRulesCore v1.25.0
  [523fee87] + CodecBzip2 v0.8.4
  [bbf7d656] + CommonSubexpressions v0.3.1
  [34da2185] + Compat v4.16.0
  [a33af91c] + CompositionsBase v0.1.2
  [187b0558] + ConstructionBase v1.5.8
  [6add18c4] + ContextVariablesX v0.1.3
  [9a962f9c] + DataAPI v1.16.0
  [864edb3b] + DataStructures v0.18.20
  [e2d170a0] + DataValueInterfaces v1.0.0
  [244e2a9f] + DefineSingletons v0.1.2
  [8bb1440f] + DelimitedFiles v1.9.1
  [163ba53b] + DiffResults v1.1.0
  [b552c78f] + DiffRules v1.15.1
  [ffbed154] + DocStringExtensions v0.9.3
  [f151be2c] + EnzymeCore v0.8.8
  [e2ba6199] + ExprTools v0.1.10
  [cc61a311] + FLoops v0.2.2
  [b9860ae5] + FLoopsBase v0.1.1
  [1a297f60] + FillArrays v1.13.0
  [587475ba] + Flux v0.15.1
  [f6369f11] + ForwardDiff v0.10.38
  [d9f16b24] + Functors v0.5.2
⌅ [0c68f7d7] + GPUArrays v10.3.1
⌅ [46192b85] + GPUArraysCore v0.1.6
⌅ [61eb1bfa] + GPUCompiler v0.27.8
  [7869d1d1] + IRTools v0.4.14
  [22cec73e] + InitialValues v0.3.1
  [3587e190] + InverseFunctions v0.1.17
  [92d709cd] + IrrationalConstants v0.2.2
  [82899510] + IteratorInterfaceExtensions v1.0.0
  [692b3bcd] + JLLWrappers v1.6.1
  [b14d175d] + JuliaVariables v0.2.4
  [63c18a36] + KernelAbstractions v0.9.31
  [929cbde3] + LLVM v9.1.3
  [2ab3a3ac] + LogExpFunctions v0.3.28
  [7e8f7934] + MLDataDevices v1.6.3
  [d8e11817] + MLStyle v0.4.17
  [f1d291b0] + MLUtils v0.4.4
  [1914dd2f] + MacroTools v0.5.13
  [dde4c033] + Metal v1.4.2
  [128add7d] + MicroCollections v0.2.0
  [e1d29d7a] + Missings v1.2.0
  [872c559c] + NNlib v0.9.26
  [77ba4419] + NaNMath v1.0.2
  [71a1bf82] + NameResolution v0.1.5
  [d8793406] + ObjectFile v0.4.2
  [e86c9b32] + ObjectiveC v3.1.0
  [0b1bfda6] + OneHotArrays v0.2.6
  [3bd65402] + Optimisers v0.4.1
  [bac558e1] + OrderedCollections v1.7.0
  [aea7be01] + PrecompileTools v1.2.1
  [21216c6a] + Preferences v1.4.3
  [8162dcfd] + PrettyPrint v0.2.0
  [33c8b6b6] + ProgressLogging v0.1.4
  [c1ae055f] + RealDot v0.1.0
  [189a3867] + Reexport v1.2.2
  [ae029012] + Requires v1.3.0
  [6c6a2e73] + Scratch v1.2.1
  [efcf1570] + Setfield v1.1.1
  [605ecd9f] + ShowCases v0.1.0
  [699a6c99] + SimpleTraits v0.9.4
  [a2af1166] + SortingAlgorithms v1.2.1
  [dc90abb0] + SparseInverseSubset v0.1.2
  [276daf66] + SpecialFunctions v2.4.0
  [171d559e] + SplittablesBase v0.1.15
  [90137ffa] + StaticArrays v1.9.8
  [1e83bf80] + StaticArraysCore v1.4.3
  [82ae8749] + StatsAPI v1.7.0
  [2913bbd2] + StatsBase v0.34.3
⌃ [09ab397b] + StructArrays v0.6.18
  [53d494c1] + StructIO v0.3.1
  [3783bdb8] + TableTraits v1.0.1
  [bd369af6] + Tables v1.12.0
  [a759f4b9] + TimerOutputs v0.5.26
  [3bb67fe8] + TranscodingStreams v0.11.3
  [28d57a85] + Transducers v0.4.84
  [013be700] + UnsafeAtomics v0.2.1
  [e88e6eb3] + Zygote v0.6.73
  [700de1a5] + ZygoteRules v0.2.5
  [6e34b625] + Bzip2_jll v1.0.8+2
  [2e619515] + Expat_jll v2.6.4+1
⌅ [f52de702] + LLVMDowngrader_jll v0.3.0+2
  [dad2f222] + LLVMExtra_jll v0.0.34+0
  [7106de7a] + LibMPDec_jll v2.5.1+0
⌅ [e9f186c6] + Libffi_jll v3.2.2+1
  [458c3c95] + OpenSSL_jll v3.0.15+1
  [efe28fd5] + OpenSpecFun_jll v0.5.5+0
  [93d3a430] + Python_jll v3.10.14+0
  [76ed43ae] + SQLite_jll v3.47.2+0
  [ffd25f8a] + XZ_jll v5.6.3+0
  [0dad84c5] + ArgTools v1.1.1
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8ba89e20] + Distributed
  [f43a241f] + Downloads v1.6.0
  [7b1f6079] + FileWatching
  [9fa8497b] + Future
  [b77e0a4c] + InteractiveUtils
  [4af54fe1] + LazyArtifacts
  [b27032c2] + LibCURL v0.6.4
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra
  [56ddb016] + Logging
  [d6f4376e] + Markdown
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions v1.2.0
  [44cfe95a] + Pkg v1.10.0
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA v0.7.0
  [9e88b42a] + Serialization
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays v1.10.0
  [10745b16] + Statistics v1.10.0
  [4607b0f0] + SuiteSparse
  [fa267f1f] + TOML v1.0.3
  [a4e569a6] + Tar v1.10.0
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] + LibCURL_jll v8.4.0+0
  [e37daf67] + LibGit2_jll v1.6.4+0
  [29816b5a] + LibSSH2_jll v1.11.0+1
  [c8ffd9c3] + MbedTLS_jll v2.28.2+1
  [14a3606d] + MozillaCACerts_jll v2023.1.10
  [4536629a] + OpenBLAS_jll v0.3.23+4
  [05823500] + OpenLibm_jll v0.8.1+2
  [bea87d4a] + SuiteSparse_jll v7.2.1+1
  [83775a58] + Zlib_jll v1.2.13+1
  [8e850b90] + libblastrampoline_jll v5.11.0+0
  [8e850ede] + nghttp2_jll v1.52.0+1
  [3f19e933] + p7zip_jll v17.4.0+2
        Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated -m`
┌ Warning: Circular dependency detected. Precompilation will be skipped for:
│ MLUtils [f1d291b0-491e-4a28-83b9-f70985020b54]
│ SparseArraysExt [85068d23-b5fb-53f1-8204-05c2aba6942f]
│ SpecialFunctionsExt [05d8ebbe-653a-54ed-ba56-24759129d732]
│ MLDataDevicesOneHotArraysExt [338a49bd-c049-5b4c-976b-5ff9d2bfb7e7]
│ TestMetal [aa3d2e57-f0a9-410f-9d7f-cb53e4f6c5aa]
│ NNlibForwardDiffExt [e8958739-db86-5f80-9e4c-f7c96aa15038]
│ MLDataDevicesMLUtilsExt [ebee3dfe-b9aa-5535-b9a3-b63281c92313]
│ LinearAlgebraExt [66d79d19-2cc4-5b0b-ac7a-b340256d1ecd]
│ EnzymeExt [6425d1ab-ad86-5f6e-82f1-f5118e0dc800]
│ NNlibEnzymeCoreExt [c8a29c40-e0ac-5e6e-8984-8da3115ac879]
│ KernelAbstractions [63c18a36-062a-441e-b654-da1e3ab1ce7c]
│ MLDataDevicesMetalExt [88f91015-f6ee-5f84-8ad5-6fd48b2feb8d]
│ Flux [587475ba-b771-5e3f-ad9e-33799f191a9c]
│ NNlib [872c559c-99b0-510c-b3b7-b6c96a88d5cd]
│ AtomixMetalExt [368c01e8-f8da-5dca-a1ea-818da1f33961]
│ Metal [dde4c033-4e86-420c-a63e-0dd931031962]
│ OneHotArrays [0b1bfda6-eb8a-41d2-88d8-f5af5cad476f]
└ @ Pkg.API ~/.julia/juliaup/julia-1.10.7+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/Pkg/src/API.jl:1279

```

Maybe reporting upstream? But where … Flux or Metal?

Here my versioninfo()

```julia
julia> versioninfo()
Julia Version 1.10.7
Commit 4976d05258e (2024-11-26 15:57 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 14 × Apple M4 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 8 default, 0 interactive, 4 GC (on 10 virtual cores)
Environment:
  JULIA_NUM_THREADS = 8
  JULIA_EDITOR = xem

```

Edit: I forgot to add that in 1.11 works fine.

---

<div class="post-metadata">

**Author:** ![CarloLucibello](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carlolucibello/32/3278_2.png) [@CarloLucibello](https://discourse.julialang.org/u/CarloLucibello)\
**Post date:** [December 11, 2024, 10:34am UTC](https://discourse.julialang.org/t/flux-and-metal-circular-dependencies-in-1-10-7/123698/2 "2024-12-11T10:34:51Z")

</div>

It is a julia bug, see discussion here

> <https://github.com/JuliaConcurrent/Atomix.jl/issues/44>
>
> Error encountered when trying to load a GPU backend Atomix extension
> 
> See http…s://buildkite.com/julialang/atomix-dot-jl/builds/18
> 
> \<details\>
> \<summary\>Error:\</summary\>
> 
> \`\`\`
> │ ┌ Warning: Module Metal with build ID ffffffff-ffff-ffff-0000-ba908ccbce5a is missing from the cache.
> │ │ This may mean Metal \[dde4c033-4e86-420c-a63e-0dd931031962\] does not support precompilation but is imported by a module that does.
> │ └ @ Base loading.jl:2539
> │ ┌ Error: Error during loading of extension AtomixMetalExt of Atomix, use \`Base.retry\_load\_extensions()\` to retry.
> │ │ exception =
> │ │ 1-element ExceptionStack:
> │ │ Error when precompiling module, potentially caused by a \_\_precompile\_\_(false) declaration in the module.
> │ │ Stacktrace:
> │ │ \[1\] \_require(pkg::Base.PkgId, env::Nothing)
> │ │ @ Base ./loading.jl:2601
> │ │ \[2\] \_\_require\_prelocked(uuidkey::Base.PkgId, env::Nothing)
> │ │ @ Base ./loading.jl:2386
> │ │ \[3\] #invoke\_in\_world#3
> │ │ @ ./essentials.jl:1089 \[inlined\]
> │ │ \[4\] invoke\_in\_world
> │ │ @ ./essentials.jl:1086 \[inlined\]
> │ │ \[5\] \_require\_prelocked
> │ │ @ ./loading.jl:2373 \[inlined\]
> │ │ \[6\] \_require\_prelocked
> │ │ @ ./loading.jl:2372 \[inlined\]
> │ │ \[7\] run\_extension\_callbacks(extid::Base.ExtensionId)
> │ │ @ Base ./loading.jl:1542
> │ │ \[8\] run\_extension\_callbacks(pkgid::Base.PkgId)
> │ │ @ Base ./loading.jl:1574
> │ │ \[9\] run\_package\_callbacks(modkey::Base.PkgId)
> │ │ @ Base ./loading.jl:1395
> │ │ \[10\] \_require\_search\_from\_serialized(pkg::Base.PkgId, sourcepath::String, build\_id::UInt128, stalecheck::Bool; reasons::Dict{String, Int64}, DEPOT\_PATH::Vector{String})
> │ │ @ Base ./loading.jl:2063
> │ │ \[11\] \_require(pkg::Base.PkgId, env::String)
> │ │ @ Base ./loading.jl:2525
> │ │ \[12\] \_\_require\_prelocked(uuidkey::Base.PkgId, env::String)
> │ │ @ Base ./loading.jl:2386
> │ │ \[13\] #invoke\_in\_world#3
> │ │ @ ./essentials.jl:1089 \[inlined\]
> │ │ \[14\] invoke\_in\_world
> │ │ @ ./essentials.jl:1086 \[inlined\]
> │ │ \[15\] \_require\_prelocked(uuidkey::Base.PkgId, env::String)
> │ │ @ Base ./loading.jl:2373
> │ │ \[16\] macro expansion
> │ │ @ ./loading.jl:2312 \[inlined\]
> │ │ \[17\] macro expansion
> │ │ @ ./lock.jl:273 \[inlined\]
> │ │ \[18\] \_\_require(into::Module, mod::Symbol)
> │ │ @ Base ./loading.jl:2269
> │ │ \[19\] #invoke\_in\_world#3
> │ │ @ ./essentials.jl:1089 \[inlined\]
> │ │ \[20\] invoke\_in\_world
> │ │ @ ./essentials.jl:1086 \[inlined\]
> │ │ \[21\] require(into::Module, mod::Symbol)
> │ │ @ Base ./loading.jl:2258
> │ │ \[22\] include
> │ │ @ ./Base.jl:557 \[inlined\]
> │ │ \[23\] include\_package\_for\_otput(pkg::Base.PkgId, input::String, depot\_path::Vector{String}, dl\_load\_path::Vector{String}, load\_path::Vector{String}, concrete\_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)
> │ │ @ Base ./loading.jl:2879
> │ │ \[24\] top-level scope
> │ │ @ stdin:5
> │ │ \[25\] eval
> │ │ @ ./boot.jl:430 \[inlined\]
> │ │ \[26\] include\_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)
> │ │ @ Base ./loading.jl:2732
> │ │ \[27\] include\_string
> │ │ @ ./loading.jl:2742 \[inlined\]
> │ │ \[28\] exec\_options(opts::Base.JLOptions)
> │ │ @ Base ./client.jl:321
> │ │ \[29\] \_start()
> │ │ @ Base ./client.jl:531
> │ └ @ Base loading.jl:1548
> \`\`\`
> \</details\>
> 
> I'm not familiar enough with precompilation to know if that's a Julia bug or a bug in this PR.
> 
> Tests still seem to pass though...
> 
> \_Originally posted by @christiangnrd in https://github.com/JuliaConcurrent/Atomix.jl/issues/42#issuecomment-2495542106\_

It will be fixed in 1.10.8

---

<div class="post-metadata">

**Author:** ![Andrea\_Pagnani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/andrea_pagnani/32/3136_2.png) [@Andrea\_Pagnani](https://discourse.julialang.org/u/Andrea_Pagnani)\
**Post date:** [December 11, 2024, 11:25am UTC](https://discourse.julialang.org/t/flux-and-metal-circular-dependencies-in-1-10-7/123698/3 "2024-12-11T11:25:16Z")

</div>

Thanks Carlo … good to know …
