# StructArrays and ModellingToolkit

**URL:** <https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253>\
**Category:** General Usage\
**Tags:** question, package, modelingtoolkit, structarrays\
**Created:** [November 29, 2024, 3:25pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253 "2024-11-29T15:25:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 29, 2024, 3:25pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/1 "2024-11-29T15:25:44Z")

</div>

StructArrays 0.6.18 works fine with the newest version of ModelingToolkit, but StructArrays 0.6.20 works only with a very old version of MTK. I find this counter-intuitive. Any idea why this is the case?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [November 29, 2024, 3:27pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/2 "2024-11-29T15:27:28Z")

</div>

I never tasted the two together. Worth an MWE. I dont quite understand the use case though since the point of mtk is canonicalization

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 29, 2024, 3:31pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/3 "2024-11-29T15:31:57Z")

</div>

> [@ChrisRackauckas](#):
>
> I dont quite understand the use case though since the point of mtk is canonicalization

My package `KiteUtils.jl` uses StructArrays for logging, and our package `KiteModels.jl` uses MTK for building a simulation model. I upgraded StructArrays in KiteUtils, and then I could not bump the version of KiteUtils in KiteModels. Now I downgraded it again and I create a new release. Still strange.

The changelog of StructArrays says that the latest versions are backports: [Releases · JuliaArrays/StructArrays.jl · GitHub](https://github.com/JuliaArrays/StructArrays.jl/releases)

I do not understand what that means.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [November 29, 2024, 3:55pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/4 "2024-11-29T15:55:07Z")

</div>

> [@ufechner7](#):
>
> latest versions are backports

That’s probably unrelated or only tangentially related. Backporting is an update for an older version having changes first made in a newer version. I imagine some things in StructArrays v0.7.0 were important enough to be patched into v0.6.20-21.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 29, 2024, 4:23pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/5 "2024-11-29T16:23:44Z")

</div>

MWE:

```julia
mkdir tmp
cd tmp
julia --project="."

```

and then in Julia:

```julia
using Pkg
pkg"add ModelingToolkit"
pkg"add StructArrays"

```

gives me:

```julia
(tmp) pkg> st
Status `~/tmp/Project.toml`
  [961ee093] ModelingToolkit v9.54.0
⌃ [09ab397b] StructArrays v0.6.18

```

If I now do:

```julia
pkg"add StructArrays@0.6.20"

```

MTK gets downgraded and I get:

```julia
julia> pkg"status"
Status `~/tmp/Project.toml`
⌃ [961ee093] ModelingToolkit v9.25.0
⌃ [09ab397b] StructArrays v0.6.20
Info Packages marked with ⌃ have new versions available and may be upgradable.

```

Why?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [November 29, 2024, 4:38pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/6 "2024-11-29T16:38:53Z")

</div>

Can you post `]why StructArrays`?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 29, 2024, 4:43pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/7 "2024-11-29T16:43:12Z")

</div>

```julia
(tmp) pkg> why StructArrays
  StructArrays

```

---

<div class="post-metadata">

**Author:** ![hexaeder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hexaeder/32/24403_2.png) [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Post date:** [November 29, 2024, 4:45pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/8 "2024-11-29T16:45:15Z")

</div>

You can `pin` MTK to a current version and then try to update `StructArrays` to 0.7. This shows where the resolver cannot satisfy the constraints:

```julia
(jl_0nLgRi) pkg> add StructArrays@0.7
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package SciMLBase [0bca4576]:
 SciMLBase [0bca4576] log:
 ├─possible versions are: 1.0.0 - 2.65.0 or uninstalled
 ├─restricted by compatibility requirements with ModelingToolkit [961ee093] to versions: 2.57.1 - 2.65.0
 │ └─ModelingToolkit [961ee093] log:
 │ ├─possible versions are: 0.0.1 - 9.54.0 or uninstalled
 │ ├─restricted to versions * by project [eb167fc8], leaving only versions: 0.0.1 - 9.54.0
 │ │ └─project [eb167fc8] log:
 │ │ ├─possible versions are: 0.0.0 or uninstalled
 │ │ └─project [eb167fc8] is fixed to version 0.0.0
 │ └─restricted to versions 9.54.0 by an explicit requirement, leaving only versions: 9.54.0
 └─restricted by compatibility requirements with Accessors [7d9f7c33] to versions: 1.0.0 - 2.39.0 or uninstalled — no versions left
   └─Accessors [7d9f7c33] log:
     ├─possible versions are: 0.1.0 - 0.1.38 or uninstalled
     └─restricted by compatibility requirements with StructArrays [09ab397b] to versions: 0.1.0 - 0.1.27 or uninstalled
       └─StructArrays [09ab397b] log:
         ├─possible versions are: 0.0.1 - 0.7.0 or uninstalled
         ├─restricted to versions * by project [eb167fc8], leaving only versions: 0.0.1 - 0.7.0
         │ └─project [eb167fc8] log: see above
         └─restricted to versions 0.7 by an explicit requirement, leaving only versions: 0.7.0

```

I tried to check the Project tomls of the related packages, Acccesors, SciMLBase and StructArrays but wasn’t able to spot the problem.

---

<div class="post-metadata">

**Author:** ![hexaeder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hexaeder/32/24403_2.png) [@hexaeder](https://discourse.julialang.org/u/hexaeder)\
**Post date:** [November 29, 2024, 4:49pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/9 "2024-11-29T16:49:30Z")

</div>

Ah, Accessors needs a bump. On [master it declares compat](https://github.com/JuliaObjects/Accessors.jl/blob/master/Project.toml) with `StructArrays@0.7` but that’s not released yet.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [November 29, 2024, 7:45pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/10 "2024-11-29T19:45:12Z")

</div>

> [@hexaeder](#):
>
> then try to update `StructArrays` to 0.7

ufechner7 isn’t asking about 0.7 though, rather going from 0.6.18 to 0.6.20 having such a drastic effect on ModelingToolkit. Here’s the conflict after pinning MTk v9.54.0:

```julia
(jl_dsRs74) pkg> add StructArrays@0.6.20
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DiffEqNoiseProcess [77a26b50]:
 DiffEqNoiseProcess [77a26b50] log:
 ├─possible versions are: 2.0.0 - 5.23.0 or uninstalled
 ├─restricted by compatibility requirements with ModelingToolkit [961ee093] to versions: 5.0.0 - 5.23.0
 │ └─ModelingToolkit [961ee093] log:
 │ ├─possible versions are: 0.0.1 - 9.54.0 or uninstalled
 │ ├─restricted to versions * by project [5488c30d], leaving only versions: 0.0.1 - 9.54.0
 │ │ └─project [5488c30d] log:
 │ │ ├─possible versions are: 0.0.0 or uninstalled
 │ │ └─project [5488c30d] is fixed to version 0.0.0
 │ └─restricted to versions 9.54.0 by an explicit requirement, leaving only versions: 9.54.0
 ├─restricted by compatibility requirements with SciMLBase [0bca4576] to versions: [2.0.0 - 5.8.0, 5.19.0 - 5.23.0] or uninstalled, leaving only versions: [5.0.0 - 5.8.0, 5.19.0 - 5.23.0]
 │ └─SciMLBase [0bca4576] log:
 │ ├─possible versions are: 1.0.0 - 2.65.0 or uninstalled
 │ └─restricted by compatibility requirements with ModelingToolkit [961ee093] to versions: 2.57.1 - 2.65.0
 │ └─ModelingToolkit [961ee093] log: see above
 ├─restricted by compatibility requirements with RecursiveArrayTools [731186ca] to versions: 5.20.0 - 5.23.0 or uninstalled, leaving only versions: 5.20.0 - 5.23.0
 │ └─RecursiveArrayTools [731186ca] log:
 │ ├─possible versions are: 0.16.0 - 3.27.4 or uninstalled
 │ ├─restricted by compatibility requirements with ModelingToolkit [961ee093] to versions: 3.26.0 - 3.27.4
 │ │ └─ModelingToolkit [961ee093] log: see above
 │ └─restricted by compatibility requirements with GPUArraysCore [46192b85] to versions: [0.16.0 - 2.29.2, 3.27.1 - 3.27.4] or uninstalled, leaving only versions: 3.27.1 - 3.27.4
 │ └─GPUArraysCore [46192b85] log:
 │ ├─possible versions are: 0.1.0 - 0.2.0 or uninstalled
 │ ├─restricted by compatibility requirements with StructArrays [09ab397b] to versions: 0.2.0 or uninstalled
 │ │ └─StructArrays [09ab397b] log:
 │ │ ├─possible versions are: 0.0.1 - 0.7.0 or uninstalled
 │ │ ├─restricted to versions * by project [5488c30d], leaving only versions: 0.0.1 - 0.7.0
 │ │ │ └─project [5488c30d] log: see above
 │ │ └─restricted to versions 0.6.20 by an explicit requirement, leaving only versions: 0.6.20
 │ └─restricted by compatibility requirements with RecursiveArrayTools [731186ca] to versions: 0.1.1 - 0.2.0, leaving only versions: 0.2.0
 │ └─RecursiveArrayTools [731186ca] log: see above
 └─restricted by compatibility requirements with GPUArraysCore [46192b85] to versions: 2.0.0 - 5.11.1 or uninstalled — no versions left
   └─GPUArraysCore [46192b85] log: see above

```

DiffEqNoiseProcess from 5.12.0 onwards depended on GPUArraysCore 0.1. StructArrays from 0.6.18 to 0.6.20 switched from GPUArraysCore 0.1 to 0.2, forcing MTk to downgrade where DiffEqNoiseProcess is 5.11.1 or lower. DiffEqNoiseProcess 5.11.1 depends on GPUArrays 8, which does partially predate the separation of GPUArraysCore.

Incidentally, is there a way to simulate environments without actually installing anything? No point in waiting for downloads and precompilation if I’m just checking version compatibility.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 29, 2024, 8:28pm UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/11 "2024-11-29T20:28:27Z")

</div>

Does anybody understand in which package this issue could/should be fixed?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [November 30, 2024, 12:33am UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/12 "2024-11-30T00:33:25Z")

</div>

I think DiffEqNoiseProcess.jl just needed a tag. Let’s see if that fixes it.

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [November 30, 2024, 8:50am UTC](https://discourse.julialang.org/t/structarrays-and-modellingtoolkit/123253/13 "2024-11-30T08:50:50Z")

</div>

> [@Benny](#):
>
> Incidentally, is there a way to simulate environments without actually installing anything? No point in waiting for downloads and precompilation if I’m just checking version compatibility.

Best you can do is interrupt the compilation with `control-C` I think. IIRC there was a `dry-run` option once but it was removed some time ago.
