Need help getting started with NeuralPDE.jl

I am an absolute beginner to Julia trying to get started with the first NeuralPDE.jl tutorial at:

I am using Julia 1.5.2 and understand that I need to install some packages before I can get started with the tutorial. But I am not clear as to what exactly as I don’t see specific documentation about that. [1]

What I have tried so far is to get into pkg mode and run the following:

add DifferentialEquations
add Flux
add Optim
add NeuralPDE

But when I then try to follow the run the tutorial’s first lines, I stumble into the following:

julia> using NeuralPDE
[ Info: Precompiling NeuralPDE [315f7962-48a3-4962-8226-d0f33b1235f0]
WARNING: could not import DiffEqBase.OptimizationFunction into GalacticOptim
WARNING: could not import DiffEqBase.AbstractADType into GalacticOptim
ERROR: LoadError: LoadError: UndefVarError: AbstractADType not defined
 [1] top-level scope at /Users/harish/.julia/packages/GalacticOptim/TzUrT/src/function.jl:1
 [2] include(::Function, ::Module, ::String) at ./Base.jl:380
 [3] include at ./Base.jl:368 [inlined]
 [4] include(::String) at /Users/harish/.julia/packages/GalacticOptim/TzUrT/src/GalacticOptim.jl:1
 [5] top-level scope at /Users/harish/.julia/packages/GalacticOptim/TzUrT/src/GalacticOptim.jl:15
 [6] include(::Function, ::Module, ::String) at ./Base.jl:380
 [7] include(::Module, ::String) at ./Base.jl:368
 [8] top-level scope at none:2
 [9] eval at ./boot.jl:331 [inlined]
 [10] eval(::Expr) at ./client.jl:467
 [11] top-level scope at ./none:3
in expression starting at /Users/harish/.julia/packages/GalacticOptim/TzUrT/src/function.jl:1
in expression starting at /Users/harish/.julia/packages/GalacticOptim/TzUrT/src/GalacticOptim.jl:15
ERROR: LoadError: Failed to precompile GalacticOptim [a75be94c-b780-496d-a8a9-0878b188d577] to /Users/harish/.julia/compiled/v1.5/GalacticOptim/fP6Iz_l9FIb.ji.
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
 [3] _require(::Base.PkgId) at ./loading.jl:1030
 [4] require(::Base.PkgId) at ./loading.jl:928
 [5] require(::Module, ::Symbol) at ./loading.jl:923
 [6] include(::Function, ::Module, ::String) at ./Base.jl:380
 [7] include(::Module, ::String) at ./Base.jl:368
 [8] top-level scope at none:2
 [9] eval at ./boot.jl:331 [inlined]
 [10] eval(::Expr) at ./client.jl:467
 [11] top-level scope at ./none:3
in expression starting at /Users/harish/.julia/packages/NeuralPDE/7SDF6/src/NeuralPDE.jl:9
ERROR: Failed to precompile NeuralPDE [315f7962-48a3-4962-8226-d0f33b1235f0] to /Users/harish/.julia/compiled/v1.5/NeuralPDE/uYXxU_l9FIb.ji.
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1305
 [3] _require(::Base.PkgId) at ./loading.jl:1030
 [4] require(::Base.PkgId) at ./loading.jl:928
 [5] require(::Module, ::Symbol) at ./loading.jl:923

Could someone point me to what I should be trying to do to correct this? I imagine I should be uninstalling/reinstalling different variants of these requirements, or maybe an additional package DiffEqBase(?), but I am not sure.

[1] I will independently write on GitHub and see if the authors are interested in additions to the documentation that help beginners like me.

Are you using the standard Julia v1.5 binary? Is your registry blocking ModelingToolkit v4?

Thank you for getting back to me.

I doubt my Julia is standard. It was installed via MacPorts. But looking at the installation instructions for it, there doesn’t seem to be any strange patching going on.

I don’t understand your second question enough to answer it. (I don’t know what a registry is and how my particular Julia could maintain its own one.) But I share below my status in pkg mode, if that is of any help:

(@v1.5) pkg> status
Status `~/.julia/environments/v1.5/Project.toml`
  [2b5f629d] DiffEqBase v6.44.3
  [0c46a032] DifferentialEquations v6.15.0
  [587475ba] Flux v0.11.2
  [315f7962] NeuralPDE v2.5.0
  [429524aa] Optim v1.2.0
  [91a5bcdd] Plots v1.6.8
  [c3e4b0f8] Pluto v0.11.14

Should I perhaps be installing ModellingToolkit too?

Try running ] status -m to see the full list of dependencies.

This is what the full list is:

(@v1.5) pkg> status -m
Status `~/.julia/environments/v1.5/Manifest.toml`
  [c3fe647b] AbstractAlgebra v0.11.1
  [621f4979] AbstractFFTs v0.5.0
  [1520ce14] AbstractTrees v0.3.3
  [79e6a3ab] Adapt v2.3.0
  [ec485272] ArnoldiMethod v0.0.4
  [4fba245c] ArrayInterface v2.13.7
  [4c555306] ArrayLayouts v0.3.8
  [56f22d72] Artifacts v1.3.0
  [ab4f0b2a] BFloat16s v0.1.0
  [aae01518] BandedMatrices v0.15.15
  [a134a8b2] BlackBoxOptim v0.5.0
  [764a87c0] BoundaryValueDiffEq v2.5.0
  [6e34b625] Bzip2_jll v1.0.6+5
  [fa961155] CEnum v0.4.1
  [a9c8d775] CPUTime v1.0.0
  [052768ef] CUDA v2.3.0
  [a603d957] CanonicalTraits v0.2.3
  [082447d4] ChainRules v0.7.33
  [d360d2e6] ChainRulesCore v0.9.18
  [cdddcdb0] ChainRulesTestUtils v0.5.3
  [944b1d66] CodecZlib v0.7.0
  [35d6a980] ColorSchemes v3.10.1
  [3da002f7] ColorTypes v0.10.9
  [5ae59095] Colors v0.12.4
  [861a8166] Combinatorics v1.0.2
  [bbf7d656] CommonSubexpressions v0.3.0
  [34da2185] Compat v3.23.0
  [e66e0078] CompilerSupportLibraries_jll v0.3.4+0
  [88cd18e8] ConsoleProgressMonitor v0.1.2
  [187b0558] ConstructionBase v1.0.0
  [d38c429a] Contour v0.5.6
  [adafc99b] CpuId v0.2.2
  [9a962f9c] DataAPI v1.4.0
  [864edb3b] DataStructures v0.17.20
  [e2d170a0] DataValueInterfaces v1.0.0
  [bcd4f6db] DelayDiffEq v5.24.1
  [2b5f629d] DiffEqBase v6.44.3
  [459566f4] DiffEqCallbacks v2.13.5
  [5a0ffddc] DiffEqFinancial v2.4.0
  [aae7a2af] DiffEqFlux v1.24.0
  [c894b116] DiffEqJump v6.10.0
  [77a26b50] DiffEqNoiseProcess v5.4.1
  [055956cb] DiffEqPhysics v3.6.0
  [41bf760c] DiffEqSensitivity v6.34.0
  [163ba53b] DiffResults v1.0.2
  [b552c78f] DiffRules v1.0.2
  [0c46a032] DifferentialEquations v6.15.0
  [c619ae07] DimensionalPlotRecipes v1.2.0
  [b4f34e82] Distances v0.9.2
  [31c24e10] Distributions v0.23.8
  [ced4e74d] DistributionsAD v0.6.11
  [ffbed154] DocStringExtensions v0.8.3
  [5ae413db] EarCut_jll v2.1.5+1
  [d4d017d3] ExponentialUtilities v1.8.0
  [e2ba6199] ExprTools v0.1.3
  [c87230d0] FFMPEG v0.4.0
  [b22a6f82] FFMPEG_jll v4.3.1+4
  [7a1cc6ca] FFTW v1.2.4
  [f5851436] FFTW_jll v3.3.9+6
  [9aa1b823] FastClosures v0.3.2
  [1a297f60] FillArrays v0.8.14
  [6a86dc24] FiniteDiff v2.7.1
  [26cc04aa] FiniteDifferences v0.11.2
  [53c48c17] FixedPointNumbers v0.8.4
  [587475ba] Flux v0.11.2
  [59287772] Formatting v0.4.1
  [f6369f11] ForwardDiff v0.10.12
  [d7e528f0] FreeType2_jll v2.10.1+5
  [559328eb] FriBidi_jll v1.0.5+6
  [069b7b12] FunctionWrappers v1.1.1
  [d9f16b24] Functors v0.1.0
  [0c68f7d7] GPUArrays v6.1.2
  [61eb1bfa] GPUCompiler v0.8.3
  [28b8d3ca] GR v0.52.0
  [a75be94c] GalacticOptim v0.3.0
  [6b9d7cbe] GeneralizedGenerated v0.2.8
  [01680d73] GenericSVD v0.3.0
  [5c1252a2] GeometryBasics v0.3.3
  [4d00f742] GeometryTypes v0.8.3
  [42e2da0e] Grisu v1.0.0
  [cd3eb016] HTTP v0.8.17
  [7869d1d1] IRTools v0.4.1
  [615f187c] IfElse v0.1.0
  [d25df0c9] Inflate v0.1.2
  [83e8ac13] IniFile v0.5.0
  [1d5cc7b8] IntelOpenMP_jll v2018.0.3+0
  [c8e1da08] IterTools v1.3.0
  [42fd0dbc] IterativeSolvers v0.8.4
  [82899510] IteratorInterfaceExtensions v1.0.0
  [692b3bcd] JLLWrappers v1.1.3
  [682c06a0] JSON v0.21.1
  [b14d175d] JuliaVariables v0.2.3
  [e5e0dc1b] Juno v0.8.4
  [c1c5ebd0] LAME_jll v3.100.0+3
  [929cbde3] LLVM v3.4.0
  [b964fa9f] LaTeXStrings v1.2.0
  [2ee39098] LabelledArrays v1.3.0
  [23fbe1c1] Latexify v0.13.5
  [a5e1c1ea] LatinHypercubeSampling v1.7.3
  [73f95e8e] LatticeRules v0.0.1
  [1d6d02ad] LeftChildRightSiblingTrees v0.1.2
  [dd192d2f] LibVPX_jll v1.9.0+1
  [093fc24a] LightGraphs v1.3.3
  [d3d80556] LineSearches v7.1.0
  [e6f89c97] LoggingExtras v0.4.2
  [bdcacae8] LoopVectorization v0.8.26
  [d00139f3] METIS_jll v5.1.0+5
  [856f044c] MKL_jll v2020.2.254+0
  [d8e11817] MLStyle v0.4.6
  [1914dd2f] MacroTools v0.5.6
  [739be429] MbedTLS v1.0.2
  [c8ffd9c3] MbedTLS_jll v2.16.8+1
  [442fdcdd] Measures v0.3.1
  [e89f7d12] Media v0.5.0
  [e1d29d7a] Missings v0.4.4
  [961ee093] ModelingToolkit v3.20.1
  [99f44e22] MsgPack v1.1.0
  [46d2c3a1] MuladdMacro v0.2.2
  [f9640e96] MultiScaleArrays v1.8.1
  [d41bc354] NLSolversBase v7.7.1
  [2774e3e8] NLsolve v4.4.1
  [872c559c] NNlib v0.7.7
  [77ba4419] NaNMath v0.3.5
  [71a1bf82] NameResolution v0.1.5
  [315f7962] NeuralPDE v2.5.0
  [6fe1bfb0] OffsetArrays v1.4.0
  [e7412a2a] Ogg_jll v1.3.4+2
  [4536629a] OpenBLAS_jll v0.3.9+5
  [458c3c95] OpenSSL_jll v1.1.1+6
  [efe28fd5] OpenSpecFun_jll v0.5.3+4
  [429524aa] Optim v1.2.0
  [91d4177d] Opus_jll v1.3.1+3
  [bac558e1] OrderedCollections v1.3.2
  [1dea7af3] OrdinaryDiffEq v5.42.3
  [90014a1f] PDMats v0.10.1
  [65888b18] ParameterizedFunctions v5.6.0
  [d96e819e] Parameters v0.12.1
  [69de0a69] Parsers v1.0.12
  [ccf2f8ad] PlotThemes v2.0.0
  [995b91a9] PlotUtils v1.0.7
  [91a5bcdd] Plots v1.6.8
  [c3e4b0f8] Pluto v0.11.14
  [e409e4f3] PoissonRandom v0.4.0
  [85a6dd25] PositiveFactorizations v0.2.3
  [8162dcfd] PrettyPrint v0.2.0
  [33c8b6b6] ProgressLogging v0.1.3
  [92933f4c] ProgressMeter v1.4.0
  [1fd47b50] QuadGK v2.4.1
  [8a4e6c94] QuasiMonteCarlo v0.2.1
  [74087812] Random123 v1.2.0
  [fb686558] RandomExtensions v0.4.3
  [e6cf234a] RandomNumbers v1.4.0
  [3cdcf5f2] RecipesBase v1.1.1
  [01d81517] RecipesPipeline v0.1.13
  [731186ca] RecursiveArrayTools v2.7.2
  [f2c3362d] RecursiveFactorization v0.1.4
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v1.1.1
  [ae5879a3] ResettableStacks v1.0.0
  [37e2e3b7] ReverseDiff v1.4.4
  [708f8203] Richardson v1.2.0
  [79098fc4] Rmath v0.6.1
  [f50d1b31] Rmath_jll v0.2.2+1
  [f2b01f46] Roots v1.0.5
  [21efa798] SIMDPirates v0.8.26
  [476501e8] SLEEFPirates v0.5.5
  [1bc83da4] SafeTestsets v0.0.1
  [6c6a2e73] Scratch v1.0.3
  [992d4aef] Showoff v0.3.2
  [699a6c99] SimpleTraits v0.9.3
  [ed01d8cd] Sobol v1.4.0
  [a2af1166] SortingAlgorithms v0.3.1
  [47a9eef4] SparseDiffTools v1.10.1
  [d4ead438] SpatialIndexing v0.1.2
  [276daf66] SpecialFunctions v0.10.3
  [860ef19b] StableRNGs v1.0.0
  [90137ffa] StaticArrays v0.12.5
  [2913bbd2] StatsBase v0.33.2
  [4c63d2b9] StatsFuns v0.9.6
  [9672c7b4] SteadyStateDiffEq v1.5.1
  [789caeaf] StochasticDiffEq v6.25.0
  [09ab397b] StructArrays v0.4.4
  [bea87d4a] SuiteSparse_jll v5.4.0+9
  [c3572dad] Sundials v4.2.6
  [fb77eaff] Sundials_jll v5.2.0+1
  [d1185830] SymbolicUtils v0.5.2
  [3783bdb8] TableTraits v1.0.0
  [bd369af6] Tables v1.2.1
  [5d786b92] TerminalLoggers v0.1.2
  [a759f4b9] TimerOutputs v0.5.7
  [9f7883ad] Tracker v0.2.12
  [3bb67fe8] TranscodingStreams v0.9.5
  [a2a6695c] TreeViews v0.3.0
  [3a884ed6] UnPack v1.0.2
  [1986cc42] Unitful v1.5.0
  [3d5dd08c] VectorizationBase v0.12.33
  [19fa3120] VertexSafeGraphs v0.1.2
  [a5390f91] ZipFile v0.9.3
  [83775a58] Zlib_jll v1.2.11+18
  [e88e6eb3] Zygote v0.5.13
  [700de1a5] ZygoteRules v0.2.0
  [0ac62f75] libass_jll v0.14.0+4
  [f638f0a6] libfdk_aac_jll v0.1.6+4
  [f27f6e37] libvorbis_jll v1.3.6+6
  [1270edf5] x264_jll v2020.7.14+2
  [dfaa095f] x265_jll v3.0.0+3
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [44cfe95a] Pkg
  [de0858da] Printf
  [9abbd945] Profile
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [4607b0f0] SuiteSparse
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode

As you can see ModelingToolkit is at version v3.20.1, and from @ChrisRackauckas reply you need at least v4.x.z

Thank you. I didn’t explicitly pick this version (or any version of any package). I’ll figure out how to upgrade it and report back.

I was also being blind and didn’t see it on the list that I pasted. :sweat_smile:

As with other package management systems, do I not need to be concerned about other packages (presumably the one that installed this older version) need this earlier0 version?

If you force ]add ModelingToolkit@4 what does it tell you?

We did a bunch of downstream PRs to upgrade the other libraries, so it should be okay.

I don’t know the flag to force add[1] to actually apply the following but just an add fails with the following:

(@v1.5) pkg> add ModelingToolkit@4
  Resolving package versions...
ERROR: Unsatisfiable requirements detected for package ModelingToolkit [961ee093]:
 ModelingToolkit [961ee093] log:
 ├─possible versions are: [0.0.1-0.0.2, 0.1.0, 0.2.0, 0.4.0, 0.5.0, 0.6.0-0.6.1, 0.6.3-0.6.4, 0.7.0-0.7.2, 0.8.0, 0.9.0-0.9.1, 0.10.0, 1.0.0-1.0.3, 1.1.0-1.1.3, 1.2.0-1.2.10, 1.3.0-1.3.3, 1.4.0-1.4.3, 2.0.0, 3.0.0-3.0.2, 3.1.0-3.1.1, 3.2.0, 3.3.0, 3.4.0, 3.5.0, 3.6.0-3.6.4, 3.7.0-3.7.1, 3.8.0, 3.9.0, 3.10.0-3.10.2, 3.11.0-3.11.1, 3.12.0-3.12.2, 3.13.0, 3.14.0-3.14.2, 3.15.0, 3.16.0, 3.17.0, 3.18.0, 3.19.0, 3.20.0-3.20.1, 3.21.0, 4.0.0-4.0.6] or uninstalled
 ├─restricted to versions 4 by an explicit requirement, leaving only versions 4.0.0-4.0.6
 └─restricted by compatibility requirements with NeuralPDE [315f7962] to versions: [3.11.0-3.11.1, 3.12.0-3.12.2, 3.13.0, 3.14.0-3.14.2, 3.15.0, 3.16.0, 3.17.0, 3.18.0, 3.19.0, 3.20.0-3.20.1, 3.21.0] — no versions left
   └─NeuralPDE [315f7962] log:
     ├─possible versions are: [2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0-2.4.1, 2.5.0] or uninstalled
     └─restricted to versions * by an explicit requirement, leaving only versions [2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0-2.4.1, 2.5.0]

[1] I tried -f, --force, --force=true

The issue seems to be that I had missed a tag and a lower bound. Thanks for helping us find that. I just setup a new release of NeuralPDE that will fix this.

Thank you for fixing this.

On a related note, I might as well ask it here. The documentation for NeuralPDE implicitly assumes one knows about installing packages, and that NeuralPDE and the relevant requirements for the tutorial examples are installed.

I understand that this might be the norm for Julia packages as it should be obvious to an experienced user, but would you appreciate patches to the documentation that clarifies this for novices?

Yes, any improvements would be appreciated.

I ran into a similar issue trying to run NeuralPDE. Is there a minimum julia version for ModelingToolkit to get version 4.x.y? I am currently using 1.4.1 and am wondering if I need to upgrade to a newer release, although I would prefer to stick with an LTS if possible.

Thank you for your help.

Julia v1.5 is required for the latest versions of the symbolic libraries. I’d just recommend v1.6 nowadays though. v1.6 is really really good.

Thank you Chris. I upgraded to Julia 1.6.0 and the examples are working now.

1 Like