# ModelingToolkit fails to precompile on Julia 1.12 (UndefVarError: ODESystem not defined in ModelingToolkit)

**URL:** <https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133>\
**Category:** Modelling & Simulations\
**Tags:** precompilation\
**Created:** [November 26, 2025, 7:37am UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133 "2025-11-26T07:37:47Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![junmorenodi99](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junmorenodi99/32/217862_2.png) [@junmorenodi99](https://discourse.julialang.org/u/junmorenodi99)\
**Post date:** [November 26, 2025, 7:37am UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/1 "2025-11-26T07:37:47Z")

</div>

Hi everyone,

I’m having trouble with ModelingToolkit precompilation on Julia 1.12 on Windows, and I can’t figure out what’s triggering it.

In my project I’m just adding some libraries (including `ModelingToolkit`) :

```julia-auto
using ModelingToolkit
using OrdinaryDiffEq
using Plots
using Waveforms
using Sundials
using DASSL

```

and I consistently get:

```julia-auto
PkgPrecompileError: The following 1 direct dependency failed to precompile:

ModelingToolkit

Failed to precompile ModelingToolkit [961ee093-0014-501f-94e3-6117800e7a78] to "C:\\Users\\...\\.julia\\compiled\\v1.12\\ModelingToolkit\\jl_XXXX.tmp".
ERROR: LoadError: UndefVarError: `ODESystem` not defined in `ModelingToolkit`
Suggestion: define the const at top-level before running function that uses it (stricter Julia v1.12+ rule).

```

I tried to add a local environment and compile via:

```julia-auto
using Pkg
Pkg.activate(@ __DIR__ )
Pkg.instantiate()
Pkg.precompile()

```

but I still get the same error.

Some extras :

Using `ModelingToolkit` in the REPL works, so it seems the package itself is installed, but the precompilation step keeps failing with this `ODESystem` error.

Has anyone seen this on Julia 1.12, or knows what can cause this issue during precompile? Any tips on how to debug which file / expression is being evaluated at that point would be very welcome.

Thanks!

---

<div class="post-metadata">

**Author:** ![Fourier](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fourier/32/38176_2.png) [@Fourier](https://discourse.julialang.org/u/Fourier)\
**Post date:** [November 26, 2025, 8:10am UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/2 "2025-11-26T08:10:16Z")

</div>

Hi,  
can you maybe post the `Project.toml` and `Mainifest.toml`?

Somehow I seems to work on my machine, if I just install the packages, so maybe it has to do with specific versions.

---

<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 26, 2025, 9:40am UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/3 "2025-11-26T09:40:15Z")

</div>

> [@junmorenodi99](#):
>
> ```julia-auto
> ERROR: LoadError: UndefVarError: `ODESystem` not defined in `ModelingToolkit`
> 
> ```

ODESystem doesn’t exist in the ModelingToolkit versions that came out in the last year, so this is at least clearly not on anything recent. What versions do you have? What in your Project.toml is keeping things back?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [November 26, 2025, 1:12pm UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/4 "2025-11-26T13:12:19Z")

</div>

I actually think we added it back (as an alias for System) so a simple package update should fix it.

---

<div class="post-metadata">

**Author:** ![junmorenodi99](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junmorenodi99/32/217862_2.png) [@junmorenodi99](https://discourse.julialang.org/u/junmorenodi99)\
**Post date:** [November 26, 2025, 7:05pm UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/5 "2025-11-26T19:05:18Z")

</div>

The `Project.toml` :

```julia-auto
[deps]
DASSL = "e993076c-0cfd-5d6b-a1ac-36489fdf7917"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
ModelingToolkitStandardLibrary = "16a59e39-deab-5bd0-87e4-056b12336739"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
QuantizedSystemSolver = "1012ed6b-4eb4-43ec-b9f7-8dc4179649a3"
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
Waveforms = "cb13b1c6-351e-5134-b3ad-d6a530956a82"

```

and for `Mainifest.toml` :

```julia-auto
(...)
[[deps.ModelingToolkit]]
deps = ["AbstractTrees", "ArrayInterface", "Combinatorics", "Compat", "ConstructionBase", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "DiffRules", "Distributed", "Distributions", "DocStringExtensions", "DomainSets", "DynamicQuantities", "ExprTools", "FindFirstFunctions", "ForwardDiff", "FunctionWrappersWrappers", "Graphs", "InteractiveUtils", "JuliaFormatter", "JumpProcesses", "LabelledArrays", "Latexify", "Libdl", "LinearAlgebra", "MLStyle", "NaNMath", "OrderedCollections", "OrdinaryDiffEq", "PrecompileTools", "RecursiveArrayTools", "Reexport", "RuntimeGeneratedFunctions", "SciMLBase", "SciMLStructures", "Serialization", "Setfield", "SimpleNonlinearSolve", "SparseArrays", "SpecialFunctions", "StaticArrays", "SymbolicIndexingInterface", "SymbolicUtils", "Symbolics", "URIs", "UnPack", "Unitful"]
git-tree-sha1 = "81ffc7d059a10669a809a4dad2576998b196a43b"
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
version = "9.15.0"

    [deps.ModelingToolkit.extensions]
    MTKBifurcationKitExt = "BifurcationKit"
    MTKDeepDiffsExt = "DeepDiffs"

    [deps.ModelingToolkit.weakdeps]
    BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
    DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"

[[deps.ModelingToolkitStandardLibrary]]
deps = ["ChainRulesCore", "DiffEqBase", "IfElse", "LinearAlgebra", "ModelingToolkit", "Symbolics"]
git-tree-sha1 = "e45ea9a9183d8d3b888a614bd5230262c443cc4f"
uuid = "16a59e39-deab-5bd0-87e4-056b12336739"
version = "2.11.0"
(...)

```

From what I can see, the `ModelingToolkit` version is 9.15.0, so I tried updating it, but I’m getting this output:

```julia-auto
 pkg> update ModelingToolkit
    Updating registry at `C:\Users\...\.julia\registries\General.toml`
     Project No packages added to or removed from `C:\Users\myproject\Project.toml`
    Manifest No packages added to or removed from `C:\Users\myproject\Manifest.toml`
  ✗ ModelingToolkit
  ✗ ModelingToolkitStandardLibrary
Precompiling packages finished.
  0 dependencies successfully precompiled in 90 seconds. 475 already precompiled.
  2 dependencies errored.
  For a report of the errors see `julia> err`. To retry use `pkg> precompile`

```

and the associated error is :

```julia-auto
ERROR: LoadError: UndefVarError: `ODESystem` not defined in `ModelingToolkit`
Suggestion: define the const at top-level before running function that uses it (stricter Julia v1.12+ rule).
Note: the binding state changed since the error occurred (was: 11, now: 0).

```

---

<div class="post-metadata">

**Author:** ![junmorenodi99](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junmorenodi99/32/217862_2.png) [@junmorenodi99](https://discourse.julialang.org/u/junmorenodi99)\
**Post date:** [November 26, 2025, 7:14pm UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/6 "2025-11-26T19:14:43Z")

</div>

> [@ChrisRackauckas](#):
>
> ODESystem doesn’t exist in the ModelingToolkit versions that came out in the last year, so this is at least clearly not on anything recent. What versions do you have? What in your Project.toml is keeping things back?

The `ModelingToolkit` version is 9.15.0, so it’s not the most recent. However, when I try to update it I get the error shown in my reply to @Fourier’s comment.

---

<div class="post-metadata">

**Author:** ![langestefan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/langestefan/32/207923_2.png) [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Post date:** [November 26, 2025, 8:41pm UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/7 "2025-11-26T20:41:53Z")

</div>

In this case I sometimes just `rm Manifest.toml` && `] up` and it just solves the problem.

---

<div class="post-metadata">

**Author:** ![junmorenodi99](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junmorenodi99/32/217862_2.png) [@junmorenodi99](https://discourse.julialang.org/u/junmorenodi99)\
**Post date:** [November 26, 2025, 8:59pm UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/8 "2025-11-26T20:59:13Z")

</div>

Thanks for the reply.  
I tried deleting the `Manifest.toml` and then running `] up`, but I’m getting basically the same error :

```julia-auto
PkgPrecompileError: The following 2 direct dependencies failed to precompile:

ModelingToolkitStandardLibrary

Failed to precompile ModelingToolkitStandardLibrary [16a59e39-deab-5bd0-87e4-056b12336739] to "C:\\Users\\jnmor\\.julia\\compiled\\v1.12\\ModelingToolkitStandardLibrary\\jl_3BA1.tmp".
ERROR: LoadError: UndefVarError: `ODESystem` not defined in `ModelingToolkit`
Suggestion: define the const at top-level before running function that uses it (stricter Julia v1.12+ rule).

ERROR: LoadError: Failed to precompile ModelingToolkit [961ee093-0014-501f-94e3-6117800e7a78] to "C:\\Users\\jnmor\\.julia\\compiled\\v1.12\\ModelingToolkit\\jl_4A33.tmp".  

```

---

<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 26, 2025, 10:35pm UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/9 "2025-11-26T22:35:34Z")

</div>

Do `]add ModelingToolkit@10` and share what it gives

---

<div class="post-metadata">

**Author:** ![junmorenodi99](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junmorenodi99/32/217862_2.png) [@junmorenodi99](https://discourse.julialang.org/u/junmorenodi99)\
**Post date:** [November 26, 2025, 11:41pm UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/10 "2025-11-26T23:41:55Z")

</div>

Thanks for the reply, @ChrisRackauckas. After doing that, I’m now getting the following error:

```julia-auto

ERROR: Unsatisfiable requirements detected for package SymbolicUtils [d1185830]:
 SymbolicUtils [d1185830] log:
 ├─possible versions are: 0.1.0 - 4.5.1 or uninstalled
 ├─restricted by compatibility requirements with ModelingToolkit [961ee093] to versions: 3.26.1 - 3.32.0
 │ └─ModelingToolkit [961ee093] log:
 │ ├─possible versions are: 0.0.1 - 10.30.0 or uninstalled
 │ ├─restricted to versions * by project [0c44d8f1], leaving only versions: 0.0.1 - 10.30.0
 │ │ └─project [0c44d8f1] log:
 │ │ ├─possible versions are: 0.0.0 or uninstalled
 │ │ └─project [0c44d8f1] is fixed to version 0.0.0
 │ └─restricted to versions 10 by an explicit requirement, leaving only versions: 10.0.0 - 10.30.0
 └─restricted by compatibility requirements with SymEngine [123dc426] to versions: 1.4.0 - 1.7.1 or uninstalled — no versions left
   └─SymEngine [123dc426] log:
     ├─possible versions are: 0.4.1 - 0.13.0 or uninstalled
     └─restricted by compatibility requirements with QuantizedSystemSolver [1012ed6b] to versions: 0.11.0
       └─QuantizedSystemSolver [1012ed6b] log:
         ├─possible versions are: 1.0.1 - 1.0.7 or uninstalled
         └─restricted to versions * by project [0c44d8f1], leaving only versions: 1.0.1 - 1.0.7
           └─project [0c44d8f1] log: see above

```

---

<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 27, 2025, 3:45am UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/11 "2025-11-27T03:45:17Z")

</div>

Your problem is QuantizedSystemSolver is on an old version of SymEngine. I’d recommend just removing it since it seems somewhat unmaintained.

---

<div class="post-metadata">

**Author:** ![junmorenodi99](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/junmorenodi99/32/217862_2.png) [@junmorenodi99](https://discourse.julialang.org/u/junmorenodi99)\
**Post date:** [November 27, 2025, 7:56am UTC](https://discourse.julialang.org/t/modelingtoolkit-fails-to-precompile-on-julia-1-12-undefvarerror-odesystem-not-defined-in-modelingtoolkit/134133/12 "2025-11-27T07:56:46Z")

</div>

Thanks a lot, it works! 🎉  
Yes, the issue was the incompatibility with `QuantizedSystemSolver`.
