Skip to content

Precompilation failure on modern DiffEqBase versions: UndefVarError: DefaultInit not defined #108

Closed
JianghuiDu/SedTrace.jl
#95

Description

@uliw

When using ODEInterfaceDiffEq (e.g., version v3.17.0) alongside modern versions of the SciML/DiffEqBase ecosystem (such as DiffEqBase v6.174+), precompilation fails with the following error:

WARNING: Imported binding DiffEqBase.DefaultInit was undeclared at import time during import to ODEInterfaceDiffEq.
ERROR: LoadError: UndefVarError: DefaultInit not defined in ODEInterfaceDiffEq
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/ODEInterfaceDiffEq/HJWJN/src/initialize.jl:14
Cause
In src/initialize.jl, the package tries to import DefaultInit from DiffEqBase:

julia

import DiffEqBase: DefaultInit
However, in modern versions of the SciML ecosystem, DefaultInit is defined in OrdinaryDiffEqCore (or OrdinaryDiffEq) rather than in DiffEqBase or SciMLBase. Since ODEInterfaceDiffEq does not depend on OrdinaryDiffEq, it cannot resolve the type.

Suggested Fix
Similar to how Sundials.jl defines its own IDADefaultInit, ODEInterfaceDiffEq can define its own DAE default initialization type locally to preserve the interface without requiring a dependency on OrdinaryDiffEq:

In src/initialize.jl, remove import DiffEqBase: DefaultInit and instead define it locally:
julia

struct DefaultInit <: DiffEqBase.DAEInitializationAlgorithm end
In src/solve.jl, update the default parameter in the solver signature from DiffEqBase.DefaultInit() to the locally defined DefaultInit():
diff

  •    initializealg = DiffEqBase.DefaultInit(),
    
  •    initializealg = DefaultInit(),
    

Activity

  1. ChrisRackauckas commented on Jun 17, 2026

    @ChrisRackauckas
    Member

    ODEInterfaceDiffEq (e.g., version v3.17.0)

    Please upgrade to v5, which has downgrade tests to ensure this version mismatch isn't possible.

  2. ChrisRackauckas commented on Jun 17, 2026

    @ChrisRackauckas
    Member

    On the older version, likely the issue is that you need a higher DiffEqBase

    However, in modern versions of the SciML ecosystem, DefaultInit is defined in OrdinaryDiffEqCore (or OrdinaryDiffEq) rather than in DiffEqBase or SciMLBase. Since ODEInterfaceDiffEq does not depend on OrdinaryDiffEq, it cannot resolve the type.

    That is not true. https://github.com/SciML/OrdinaryDiffEq.jl/blob/0bda3109a1b9581450776b0e5f9607c2dd5e5281/lib/DiffEqBase/src/dae_initialization.jl#L11

  3. uliw commented on Jun 17, 2026

    @uliw
    Author

    Sorry should have provided more context. I am dealing with a legacy project which makes heavy use of SparseDiffTools v2.x. As such this restricts SciMLOperators to < 0.5.0. Migrating to SparseDiffTools v3.x would be a major headache. Would adding a few lines of checking if DefaultInit is it exported by the loaded version of DiffEqBase be a major pain point on your end?

  4. ChrisRackauckas commented on Jun 17, 2026

    @ChrisRackauckas
    Member

    Backported to what version?

  5. uliw commented on Jun 19, 2026

    @uliw
    Author

    not sure I understand the question. Did you mean the version of ODEInterfaceDiffEq.jl? Also I was able to to update the code to the SparseDiffTools v3.x interface, so the problem is moot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions