ThummeTo / FMIFlux.jl

FMIFlux.jl is a free-to-use software library for the Julia programming language, which offers the ability to place FMUs (fmi-standard.org) everywhere inside of your ML topologies and still keep the resulting model trainable with a standard (or custom) FluxML training process.
MIT License
57 stars 15 forks source link

Error when adding FMIFlux #80

Closed gitting-around closed 1 year ago

gitting-around commented 1 year ago

Hi,

I am trying to run the neuralFMUsimple CS example, and have hit a wall when adding the packages. I am using Ubuntu 22.04 as a VM, and julia 1.8. I get an error when adding FMIFlux add FMIFlux, as shown here fmiflux error install

Any ideas on what is going wrong here?

JoKircher commented 1 year ago

Could you run Pkg.precompile() for a more complete error message?

gitting-around commented 1 year ago

This seems to have done the trick. However I had to run it in a terminal, and not from code. The latter quits for whatever reason, and while running the block with imports in ipynb file it quits as well.

Thanks for the prompt response.

gitting-around commented 1 year ago

Spoken too soon I guess, when I try to import I get the following:

julia> using FMI

julia> using FMIFlux
Killed

The Pkg.precompile() run smoothly though, there were no errors.

ThummeTo commented 1 year ago

I am not 100% sure, but this feels more like a package manager problem that a FMIFlux.jl-thing... Best delete your packages folder under C:\Users\[USERNAME]\.julia\packages\, terminate Julia, reopen and recompile all packages again (you don't need to add packages again, simple ] resolve should to the trick)

gitting-around commented 1 year ago

Hi, I followed your instructions and go the following errors:

julia> import FMIFlux
[ Info: Precompiling FMIFlux [fabad875-0d53-4e47-9446-963b74cae21f]
ERROR: LoadError: Failed to precompile SciMLSensitivity [1ed8b502-d754-442c-8d5d-10ac956f44a1] to /home/gita/.julia/compiled/v1.8/SciMLSensitivity/jl_y61N7X.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:1705
  [3] compilecache
    @ ./loading.jl:1649 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [6] macro expansion
    @ ./loading.jl:1180 [inlined]
  [7] macro expansion
    @ ./lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
  [9] include
    @ ./Base.jl:419 [inlined]
 [10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1554
 [11] top-level scope
    @ stdin:1
in expression starting at /home/gita/.julia/packages/DiffEqFlux/jHIee/src/DiffEqFlux.jl:1
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile DiffEqFlux [aae7a2af-3d4f-5e19-a356-7da93b79d9d0] to /home/gita/.julia/compiled/v1.8/DiffEqFlux/jl_Q5bkIC.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:1705
  [3] compilecache
    @ ./loading.jl:1649 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [6] macro expansion
    @ ./loading.jl:1180 [inlined]
  [7] macro expansion
    @ ./lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
  [9] include(mod::Module, _path::String)
    @ Base ./Base.jl:419
 [10] include(x::String)
    @ FMIFlux ~/.julia/packages/FMIFlux/TkeK3/src/FMIFlux.jl:6
 [11] top-level scope
    @ ~/.julia/packages/FMIFlux/TkeK3/src/FMIFlux.jl:23
 [12] include
    @ ./Base.jl:419 [inlined]
 [13] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1554
 [14] top-level scope
    @ stdin:1
in expression starting at /home/gita/.julia/packages/FMIFlux/TkeK3/src/neural.jl:6
in expression starting at /home/gita/.julia/packages/FMIFlux/TkeK3/src/FMIFlux.jl:6
in expression starting at stdin:1
ERROR: Failed to precompile FMIFlux [fabad875-0d53-4e47-9446-963b74cae21f] to /home/gita/.julia/compiled/v1.8/FMIFlux/jl_TZCqBg.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:1705
 [3] compilecache
   @ ./loading.jl:1649 [inlined]
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1337
 [5] _require_prelocked(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1200
 [6] macro expansion
   @ ./loading.jl:1180 [inlined]
 [7] macro expansion
   @ ./lock.jl:223 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1144

julia> 
ThummeTo commented 1 year ago

I have the same issue with FMIImport, see this. It seems like someone checked in a breaking release for SciMLSensitivity (or one of its depndencies...)

gitting-around commented 1 year ago

Ah, I see. What can be done?

ThummeTo commented 1 year ago

Hm... best thing is tracing down the error and file an issue at the corresponding repository... I will check for that, maybe there is a workaround (like manually downgrading to an older version or similar)...

ThummeTo commented 1 year ago

Jap, this is indeed a breaking release thing somewhere in SciMLSensitivity v0.7.25 (or the corresponding Optimisers- or Tracker-Version), in SciMLSensitivity v0.7.27 everything runs as to expect.

Good news is that this does not apply to the next version FMIFlux v0.10.0. Bad news it that v0.10.0 is not released yet because it is waiting on a SciMLSensitivity Patch solving an important issue.

Until that, I am trying a quick fix in PR #81 but I can't guarantee that this will work.

ThummeTo commented 1 year ago

Please check if FMIFlux.jl v0.10.0 together with FMI.jl v0.12.1 (both are the most current releases) resolves your issue

gitting-around commented 1 year ago

Ok, the example works now if I run line by line in the terminal, got the graph at the end :). Running from vscode doesn't seem to work, it quits unexpectedly, but I guess that is a different problem.

Thanks for the help!

ThummeTo commented 1 year ago

Great to hear that!


BTW: If something crashed during package installation/organization, I solve it by deleting the packages folder under .julia\packages. All packages are redownloaded and recompiled at the next start-up of Julia.