# Failed to precompile DifferentialEquations

**URL:** <https://discourse.julialang.org/t/failed-to-precompile-differentialequations/67286>\
**Category:** New to Julia\
**Tags:** question, diffeq\
**Created:** [August 29, 2021, 2:56pm UTC](https://discourse.julialang.org/t/failed-to-precompile-differentialequations/67286 "2021-08-29T14:56:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![baba12321](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baba12321/32/14039_2.png) [@baba12321](https://discourse.julialang.org/u/baba12321)\
**Post date:** [August 29, 2021, 2:56pm UTC](https://discourse.julialang.org/t/failed-to-precompile-differentialequations/67286/1 "2021-08-29T14:56:52Z")

</div>

I am trying to run the sample code given [here](https://towardsdatascience.com/differential-equations-as-a-neural-network-layer-ac3092632255). The code here on Differential Equations

> using DifferentialEquations, Flux, Optim, DiffEqFlux, Plots
> 
> u0 = [1.0,1.0]  
> tstart=0.0  
> tend=10.0  
> sampling=0.1
> 
> model\_params= [1.5,1.0,3.0,1.0]
> 
> function model(du,u,p,t)  
> x, y = u  
> a, b, c, d = p  
> du[1] = dx = a_x - b_x_y  
> du[2] = dy = -c_y + d_x_y  
> end

generates the following error

> ┌ Info: Precompiling DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa]  
> └ @ Base loading.jl:1192  
> WARNING: Method definition vec(Number) in module FiniteDiff at /home/biplav/.julia/packages/FiniteDiff/EBys0/src/jacobians.jl:128 overwritten in module DiffEqDiffTools at /home/biplav/.julia/packages/DiffEqDiffTools/uD0fb/src/jacobians.jl:114.  
> ERROR: LoadError: LoadError: syntax: incomplete: premature end of input  
> Stacktrace:  
> [1] include at ./boot.jl:317 [inlined]  
> [2] include\_relative(::Module, ::String) at ./loading.jl:1044  
> [3] include at ./sysimg.jl:29 [inlined]  
> [4] include(::String) at /home/biplav/.julia/packages/OrdinaryDiffEq/8Pn99/src/OrdinaryDiffEq.jl:1  
> [5] top-level scope at none:0  
> [6] include at ./boot.jl:317 [inlined]  
> [7] include\_relative(::Module, ::String) at ./loading.jl:1044  
> [8] include(::Module, ::String) at ./sysimg.jl:29  
> [9] top-level scope at none:2  
> [10] eval at ./boot.jl:319 [inlined]  
> [11] eval(::Expr) at ./client.jl:393  
> [12] top-level scope at ./none:3  
> in expression starting at /home/biplav/.julia/packages/OrdinaryDiffEq/8Pn99/src/tableaus/rkc\_tableaus.jl:12393  
> in expression starting at /home/biplav/.julia/packages/OrdinaryDiffEq/8Pn99/src/OrdinaryDiffEq.jl:106  
> ERROR: LoadError: Failed to precompile OrdinaryDiffEq [1dea7af3-3e70-54e6-95c3-0bf5283fa5ed] to /home/biplav/.julia/compiled/v1.0/OrdinaryDiffEq/DlSvy.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  
> [5] require(::Module, ::Symbol) at ./loading.jl:853  
> [6] include at ./boot.jl:317 [inlined]  
> [7] include\_relative(::Module, ::String) at ./loading.jl:1044  
> [8] include(::Module, ::String) at ./sysimg.jl:29  
> [9] top-level scope at none:2  
> [10] eval at ./boot.jl:319 [inlined]  
> [11] eval(::Expr) at ./client.jl:393  
> [12] top-level scope at ./none:3  
> in expression starting at /home/biplav/.julia/packages/DiffEqCallbacks/b4ahb/src/DiffEqCallbacks.jl:10  
> ERROR: LoadError: Failed to precompile DiffEqCallbacks [459566f4-90b8-5000-8ac3-15dfb0a30def] to /home/biplav/.julia/compiled/v1.0/DiffEqCallbacks/TKs5l.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  
> [5] require(::Module, ::Symbol) at ./loading.jl:853  
> [6] include at ./boot.jl:317 [inlined]  
> [7] include\_relative(::Module, ::String) at ./loading.jl:1044  
> [8] include(::Module, ::String) at ./sysimg.jl:29  
> [9] top-level scope at none:2  
> [10] eval at ./boot.jl:319 [inlined]  
> [11] eval(::Expr) at ./client.jl:393  
> [12] top-level scope at ./none:3  
> in expression starting at /home/biplav/.julia/packages/SteadyStateDiffEq/qQ3Lb/src/SteadyStateDiffEq.jl:6  
> ERROR: LoadError: Failed to precompile SteadyStateDiffEq [9672c7b4-1e72-59bd-8a11-6ac3964bc41f] to /home/biplav/.julia/compiled/v1.0/SteadyStateDiffEq/lsCSw.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  
> [5] require(::Module, ::Symbol) at ./loading.jl:853  
> [6] include at ./boot.jl:317 [inlined]  
> [7] include\_relative(::Module, ::String) at ./loading.jl:1044  
> [8] include(::Module, ::String) at ./sysimg.jl:29  
> [9] top-level scope at none:2  
> [10] eval at ./boot.jl:319 [inlined]  
> [11] eval(::Expr) at ./client.jl:393  
> [12] top-level scope at ./none:3  
> in expression starting at /home/biplav/.julia/packages/DifferentialEquations/9ez1L/src/DifferentialEquations.jl:9  
> Failed to precompile DifferentialEquations [0c46a032-eb83-5123-abaf-570d42b7fbaa] to /home/biplav/.julia/compiled/v1.0/DifferentialEquations/UQdwS.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  
> [5] require(::Module, ::Symbol) at ./loading.jl:853  
> [6] top-level scope at In[5]:1

Is this problem a memory error as solved in this [question](https://discourse.julialang.org/t/part-of-differentialequations-failing-to-compile/38302), and how can I solve this?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [August 29, 2021, 3:28pm UTC](https://discourse.julialang.org/t/failed-to-precompile-differentialequations/67286/2 "2021-08-29T15:28:44Z")

</div>

You are getting an error from precompilation that seems inside the package and not in the code you are executing. However, I just update everything here, recompile DiffEqDiffTools without a problem. I would suggest you to clean your Julia environment and start again.

EDIT: Another option would be trying to update everything.

---

<div class="post-metadata">

**Author:** ![baba12321](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baba12321/32/14039_2.png) [@baba12321](https://discourse.julialang.org/u/baba12321)\
**Post date:** [August 29, 2021, 4:14pm UTC](https://discourse.julialang.org/t/failed-to-precompile-differentialequations/67286/3 "2021-08-29T16:14:06Z")

</div>

could you explain on what is needed to be done to update everything and clean environment?

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [August 29, 2021, 5:37pm UTC](https://discourse.julialang.org/t/failed-to-precompile-differentialequations/67286/4 "2021-08-29T17:37:04Z")

</div>

For a clean environment, just remove / move `~/.julia` and install all the packages again. To update, type `]update` in REPL.

---

<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:** [August 29, 2021, 6:44pm UTC](https://discourse.julialang.org/t/failed-to-precompile-differentialequations/67286/5 "2021-08-29T18:44:07Z")

</div>

The issue is Julia v1.0 does not work with DifferentialEquations. That said, v1.6 will very soon be the new LTS and it works well DifferentialEquations.jl
