rafaqz / DEBplant

Scripts for a Dynamic Energy Budget plant model with microclimate interaction
9 stars 3 forks source link

ui.jl Producing Errors on Julia Version 1.6.1 (UPDATED: and Julia 1.4.1) #4

Closed Daiio closed 1 year ago

Daiio commented 3 years ago

I am running Julia 1.6.1 on Windows via Windows Powershell and when I tried to utilize the ui.jl script as per the Read Me document, I received several warnings and a Load Error. I attached a .txt document that was copied and pasted from my session that shows the outputs of running include("ui.jl")

As a disclaimer, I am a new Julia (and GitHub) user so it is possible any errors may be from my end, however I believe at least some of these issues originate from the code (perhaps the newest Julia version creates some incompatibilities).

Thank you in advance for anyone that has any ideas on solutions, I am really interested in the applications of this package!

Julia_UI_Script_Error.txt

Daiio commented 3 years ago

The text copied and pasted for anyone who is loathe to download a random file (though it is a little difficult to read and format):

julia> include("ui.jl")
[ Info: Precompiling Setfield [efcf1570-3423-57d1-acb7-fd33fddbac46]
[ Info: Precompiling Interact [c601a237-2ae4-5e1e-952c-7a85b0c7eef1]
┌ Warning: `@get!(dict, key, default)` at C:\Users\17654\.julia\packages\WebIO\nTMDV\src\scope.jl:160 is deprecated, use `get!(()->default, dict, key)` instead.
└ @ Base deprecated.jl:204
┌ Warning: `@get!(dict, key, default)` at C:\Users\17654\.julia\packages\WebIO\nTMDV\src\scope.jl:357 is deprecated, use `get!(()->default, dict, key)` instead.
└ @ Base deprecated.jl:204
[ Info: Precompiling Blink [ad839575-38b3-5650-b840-f874b8c74a25]
┌ Warning: `@get!(dict, key, default)` at C:\Users\17654\.julia\packages\Lazy\mAoZN\src\collections.jl:49 is deprecated, use `get!(()->default, dict, key)` instead.
└ @ Base deprecated.jl:204
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
[ Info: Precompiling UnitfulRecipes [42071c24-d89e-48dd-8a24-8a12d9b8861f]
[ Info: Precompiling StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd]
[ Info: Precompiling PlotNested [d85c2341-301b-47ea-8a8c-4cd93df2bebe]
[ Info: Precompiling Codify [67e8a8f0-3181-11e9-0720-1d07a4d049a5]
[ Info: Precompiling Select [9af9b3ce-3316-11e9-0fa8-7b2e06453de4]
[ Info: Precompiling DimensionalData [0703355e-b756-11e9-17c0-8b28908087d0]
[ Info: Precompiling Microclimate [e0eb800d-4a9f-54ae-b0f8-217228d9d7c3]
[ Info: Precompiling Flatten [4c728ea3-d9ee-5c9a-9642-b6f7d7dc04fa]
[ Info: Precompiling OrdinaryDiffEq [1dea7af3-3e70-54e6-95c3-0bf5283fa5ed]
[ Info: Precompiling Photosynthesis [5e10c064-2706-53a3-a67d-d473e313a663]
WARNING: Method definition default(Type{var"#s304"} where var"#s304"<:(Photosynthesis.TuzetStomatalConductance{MoM2S, GS, SM} where SM where GS where MoM2S), Type{Base.Val{:gs_submodel}}) in module Photosynthesis at C:\Users\17654\.julia\packages\FieldMetadata\kDbg8\src\FieldMetadata.jl:214 overwritten on the same line (check for duplicate calls to `include`).
  ** incremental compilation may be fatally broken for this module **

[ Info: Precompiling DynamicEnergyBudgets [6ffd65d2-8b0b-5314-9c5b-6efe83b0316c]
WARNING: Method definition (::Type{DynamicEnergyBudgets.ParentTardieu{Δ, Al, T, A} where A where T where Al where Δ})(Any, Any, Any, Any) in module DynamicEnergyBudgets at C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\components\temperature_correction.jl:86 overwritten at C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\components\temperature_correction.jl:92.
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition (::Type{DynamicEnergyBudgets.KooijmanSLAPhotosynthesis{μMoMoS, MoL, μMoMS, MoMS, V, MG} where MG where V where MoMS where μMoMS where MoL where μMoMoS})() in module DynamicEnergyBudgets at C:\Users\17654\.julia\packages\FieldDefaults\OEouz\src\FieldDefaults.jl:40 overwritten on the same line (check for duplicate calls to `include`).
  ** incremental compilation may be fatally broken for this module **

WARNING: Method definition Type##kw(Any, Type{DynamicEnergyBudgets.KooijmanSLAPhotosynthesis{μMoMoS, MoL, μMoMS, MoMS, V, MG} where MG where V where MoMS where μMoMS where MoL where μMoMoS}) in module DynamicEnergyBudgets at C:\Users\17654\.julia\packages\FieldDefaults\OEouz\src\FieldDefaults.jl:40 overwritten on the same line (check for duplicate calls to `include`).
  ** incremental compilation may be fatally broken for this module **

WARNING: using Photosynthesis.flux in module DynamicEnergyBudgets conflicts with an existing identifier.
[ Info: Precompiling JLD2 [033835bb-8acc-5ee8-8aae-3f567f8a3819]
[ Info: For saving to png with the Plotly backend ORCA has to be installed.
┌ Warning: Root for rate not found at t = 2
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\components\rate.jl:24
┌ Warning: Root for rate not found at t = 2
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\components\rate.jl:24
┌ Warning: dead at 2 hr due to growth rate
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\model.jl:111
┌ Warning: Root for rate not found at t = 2
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\components\rate.jl:24
┌ Warning: Root for rate not found at t = 2
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\components\rate.jl:24
┌ Warning: dead at 2 hr due to growth rate
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\model.jl:111
┌ Warning: Root for rate not found at t = 2
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\components\rate.jl:24
┌ Warning: Root for rate not found at t = 2
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\components\rate.jl:24
┌ Warning: dead at 2 hr due to growth rate
└ @ DynamicEnergyBudgets C:\Users\17654\.julia\packages\DynamicEnergyBudgets\4fTbT\src\model.jl:111
ERROR: LoadError: UndefVarError: window_defaults not defined
Stacktrace:
  [1] raw_window(a::Electron, opts::Dict{Any, Any})
    @ Blink.AtomShell C:\Users\17654\.julia\packages\Blink\u1xcH\src\AtomShell\window.jl:41
  [2] Window(a::Electron, content::Page, opts::Dict{Any, Any}; async::Bool)
    @ Blink.AtomShell C:\Users\17654\.julia\packages\Blink\u1xcH\src\AtomShell\window.jl:56
  [3] Window(a::Electron, opts::Dict{Any, Any}; async::Bool)
    @ Blink.AtomShell C:\Users\17654\.julia\packages\Blink\u1xcH\src\AtomShell\window.jl:45
  [4] Window (repeats 2 times)
    @ C:\Users\17654\.julia\packages\Blink\u1xcH\src\AtomShell\window.jl:45 [inlined]
  [5] #Window#14
    @ C:\Users\17654\.julia\packages\Blink\u1xcH\src\AtomShell\window.jl:89 [inlined]
  [6] Window
    @ C:\Users\17654\.julia\packages\Blink\u1xcH\src\AtomShell\window.jl:89 [inlined]
  [7] electronapp(app::ModelApp{OrderedDict{Any, Any}, OrderedDict{Symbol, Any}, Tuple{Int64, Int64}, StepRange{Quantity{Int64, 𝐓, Unitful.FreeUnits{(hr,), 𝐓, nothing}}, Quantity{Int64, 𝐓, Unitful.FreeUnits{(hr,), 𝐓,     nothing}}}}; zoom::Float64)
    @ Main C:\Users\17654\Documents\GitHub\DEBplant\src\app.jl:380
  [8] top-level scope
    @ C:\Users\17654\Documents\GitHub\DEBplant\ui.jl:53
  [9] include(fname::String)
    @ Base.MainInclude .\client.jl:444
 [10] top-level scope
    @ REPL[18]:1
in expression starting at C:\Users\17654\Documents\GitHub\DEBplant\ui.jl:53

julia>
rafaqz commented 3 years ago

Hi @Daiio Dont worry about the warnings, the error is the problem. Did you activate the project before you used include? Start a new julia session and run ] instantiate (] gets you in packge mode) then still in package mode run activate and exit with backspace. Then try.That should get you an exact version of the packages. I've had this working quite recently.

Im also wondering out of interest what you would like to do with the model. One problem with it is that it's complicated. And more complicated with the interface involved, but I needed the interface to be able to explore the dynamics, because it's so complicated...

But its probably not very friendly for someone new to Julia. The DynamicEnergyBudgets.jl package this runs is more polished and less complicated, but doesnt have the interface.

I've built simpler ways to do all of this now, the tools really were not available at the time. But I havent had time to work on DEB. I could implement it one day if people were interested.

Daiio commented 3 years ago

I did try running ] instantiate followed by activate before leaving package mode. When I did that, I was told there was 1 dependency error and 3 dependency failures. To be sure, I just ran it again and I have the same errors as before.

I wasn't positive if this was the correct package for me yet, I wanted to play around with it to find out. I am trying to find an appropriate package for running mechanistic niche modeling of a closed microbial ecosystem within a plant's root system. I had read the paper associated with this package and thought that maybe it could work for what I was trying to figure out. I am definitely open to suggestions about other packages to try instead though!

Previously my team has used Lotka-Volterra Predator Prey models to infer symbiont microbes (between any given two microbes), but I was exploring the idea of using mechanistic niche modeling to infer symbiont microbes (between given microbes and the plant itself) within the system instead. At the very least, I would want to utilize the model to identify which microbes can exist under the same conditions as each other and the plant in a closed microecosystem (hydroponics space travel system). The main difference between my goals and with the model and other researchers, is that the ecosystem does not exist yet, and would theoretically be constructed based on the conditions with the most favorable outputs for as many of the target species as are compatible.

If you have any suggestions on packages or better models to reach that goal, I would be happy to hear them! Thank you for your help.

rafaqz commented 3 years ago

Ok interesting, I think maybe I've written the order wrong... its actually activate then instantiate! Post the error if that doesn't work.

This code does a lot of things and is a good demonstration of DEB/Julia for this kind of thing, but isn't very user friendly. But I don't know of any other packages unfortunately!

Daiio commented 3 years ago

I switched to my Linux laptop and tried again. This time, it gave the error: ERROR: failed to clone from https://github.com/JuliaMath/FFTW.jl.git, error: GitError(Code:ERROR, Class:SSL, SSL error: 0xffffffff - UNKNOWN ERROR CODE (0001)) after following the instructions on the Read Me. I have not tried to run ui.jl yet, this is just what occurred after instantiating.

Daiio commented 3 years ago

After several days of debugging, I have sorted out the dependency issues on my machine. I ended up having to download Conda as well as Node.js in order to get some of the packages functioning. However, I have hit a major road block with this when I run ui.jl:

ERROR: LoadError: Invalid dependency (must be a url, file, or AssetRegistry path): /home/arkinlab/.julia/packages/Knockout/IP1uR/src/../assets/knockout.js
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] path2url(path::SubString{String})
    @ WebIO ~/.julia/packages/WebIO/Fy9h1/src/asset.jl:209
  [3] dep2url(dep::String)
    @ WebIO ~/.julia/packages/WebIO/Fy9h1/src/asset.jl:226
  [4] lower
    @ ~/.julia/packages/WebIO/Fy9h1/src/asset.jl:51 [inlined]
  [5] lowerassets(x::Asset)
    @ WebIO ~/.julia/packages/WebIO/Fy9h1/src/asset.jl:118
  [6] iterate
    @ ./generator.jl:47 [inlined]
  [7] _collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, typeof(WebIO.lowerassets)}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
    @ Base ./array.jl:691
  [8] collect_similar(cont::Vector{Any}, itr::Base.Generator{Vector{Any}, typeof(WebIO.lowerassets)})
    @ Base ./array.jl:606
  [9] map(f::Function, A::Vector{Any})
    @ Base ./abstractarray.jl:2294
 [10] lowerassets(x::Async)
    @ WebIO ~/.julia/packages/WebIO/Fy9h1/src/asset.jl:119
 [11] (::WebIO.var"#23#24"{Async})(io::IOBuffer)
    @ WebIO ~/.julia/packages/WebIO/Fy9h1/src/syntax.jl:221
 [12] sprint(::Function; context::Nothing, sizehint::Int64)
    @ Base ./strings/io.jl:105
 [13] sprint
    @ ./strings/io.jl:101 [inlined]
 [14] tojs
    @ ~/.julia/packages/WebIO/Fy9h1/src/asset.jl:112 [inlined]
 [15] (::WebIO.var"#42#43"{Scope, WebIO.JSString})(io::IOBuffer)
    @ WebIO ~/.julia/packages/WebIO/Fy9h1/src/syntax.jl:221
 [16] sprint(::Function; context::Nothing, sizehint::Int64)
    @ Base ./strings/io.jl:105
 [17] sprint
    @ ./strings/io.jl:101 [inlined]
 [18] onimport
    @ ~/.julia/packages/WebIO/Fy9h1/src/scope.jl:313 [inlined]
 [19] knockout(template::Node{WebIO.DOM}, data::Vector{Pair{String, Any}}, extra_js::WebIO.JSString; computed::Vector{Any}, methods::Vector{Any})
    @ Knockout ~/.julia/packages/Knockout/IP1uR/src/Knockout.jl:124
 [20] input(::Interact.Bulma, o::String; extra_js::WebIO.JSString, extra_obs::Vector{Any}, label::String, typ::String, wdgtyp::String, className::String, style::Dict{Any, Any}, isnumeric::Bool, computed::Vector{Any}, attributes::Dict{Any, Any}, bind::String, bindto::String, valueUpdate::String, changes::Int64, kwargs::Base.Iterators.Pairs{Symbol, String, Tuple{Symbol}, NamedTuple{(:placeholder,), Tuple{String}}})
    @ InteractBase ~/.julia/packages/InteractBase/sOe2Z/src/input.jl:259
 [21] input(args::String; kwargs::Base.Iterators.Pairs{Symbol, String, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:typ, :placeholder, :label), Tuple{String, String, String}}})
    @ Widgets ~/.julia/packages/Widgets/0HInz/src/defaults.jl:10
 [22] textbox(::Interact.Bulma, hint::String; multiline::Bool, placeholder::String, value::String, typ::String, kwargs::Base.Iterators.Pairs{Symbol, String, Tuple{Symbol}, NamedTuple{(:label,), Tuple{String}}})
    @ InteractBase ~/.julia/packages/InteractBase/sOe2Z/src/input.jl:354
 [23] textbox(; kwargs::Base.Iterators.Pairs{Symbol, String, Tuple{Symbol, Symbol}, NamedTuple{(:value, :label), Tuple{String, String}}})
    @ Widgets ~/.julia/packages/Widgets/0HInz/src/defaults.jl:10
 [24] (::ModelApp{OrderedDict{Any, Any}, OrderedDict{Symbol, Any}, Tuple{Int64, Int64}, StepRange{Quantity{Int64, 𝐓, Unitful.FreeUnits{(hr,), 𝐓, nothing}}, Quantity{Int64, 𝐓, Unitful.FreeUnits{(hr,), 𝐓, nothing}}}})(req::Nothing)
    @ Main ~/git/DEBplant/src/app.jl:187
 [25] electronapp(app::ModelApp{OrderedDict{Any, Any}, OrderedDict{Symbol, Any}, Tuple{Int64, Int64}, StepRange{Quantity{Int64, 𝐓, Unitful.FreeUnits{(hr,), 𝐓, nothing}}, Quantity{Int64, 𝐓, Unitful.FreeUnits{(hr,), 𝐓, nothing}}}}; zoom::Float64)
    @ Main ~/git/DEBplant/src/app.jl:379
 [26] top-level scope
    @ ~/git/DEBplant/ui.jl:53
in expression starting at /home/arkinlab/git/DEBplant/ui.jl:53

My guess is that WebIO, a dependency of Knockout, is in a rocky state based on the types of issues on the GitHub page and is in turn creating issues with Knockout. That would be my best guess, but I could be wrong. For reference I am using Visual Studio Code on Linux to run this program. Does anyone have any suggestions for this issue? Alternatively, is there a better version of WebIO or Knockout to be using (assuming they are related to the problem)? I have tried 0.8.15 and 0.8.14 for WebIO and 0.2.4 for Knockout thus far.

rafaqz commented 3 years ago

I know this probably wont help much, but with Julia you should not have to deal with any of these lower level dependencies manually. For comparison, I have never installed anything you mention even once. It should just work when you install the packages.

When I get time I will look at updating the Project.toml here and making sure it just works, but unfortunately I'm in the middle of moving countries so I can't put any time to this for a while. Sorry about the time this has wasted for you.

rafaqz commented 3 years ago

It may also be down to the version of Julia. I guess it may break on newer versions. This was probably updated for 1.3 or 1.4, and may not work on 1.6.

Daiio commented 3 years ago

Don't feel bad about not being able to immediately give support, I completely understand the nature of having multiple projects (and life events) ongoing. I consider any timely help with troubleshooting a gift and not a requirement. Thank you for putting this together and sharing it in the first place! I am in the process of trying with Julia 1.4.1 and will give you an update and let you know if it works to help with any future troubleshooting or issues from other potential users.

Daiio commented 3 years ago

I still had issues with running the program using Julia 1.4.1 with the following error (once again via Visual Studio Code on Linux):

ERROR: LoadError: LoadError: LoadError: UndefVarError: FvCBEnergyBalance not defined
Stacktrace:
 [1] top-level scope at /home/arkinlab/git/DEBplant/models/bb.jl:1
in expression starting at /home/arkinlab/git/DEBplant/models/bb.jl:1
in expression starting at /home/arkinlab/git/DEBplant/ui.jl:33
in expression starting at REPL[8]:1
giannamars commented 2 years ago

@rafaqz is there a version of Photosynthesis.jl that is still compatible with DynamicEnergyBudgets.jl or DEBplant.jl? I've been trying to go through the Photosynthesis.jl version history, but didn't understand when and how major restructuring happened. The DEBplant Manifest.toml links to the current version that does not define FvCBEnergyBalance.

It would be awesome, if we could get a working version of DynamicEnergyBudgets.jl possibly with an older Julia version. Would you have time to take a look? I find it hard to understand all dependencies, as some of the structures, e.g. FieldMetadata.jl seem to be outdated as well.

[[Photosynthesis]] deps = ["Distributions", "DocStringExtensions", "FieldDefaults", "FieldDocTables", "FieldMetadata", "Mixers", "SimpleRoots", "Unitful"] git-tree-sha1 = "0469a84a201898a37cf542292d8722f8ed05e49c" repo-rev = "master" repo-url = "https://github.com/rafaqz/Photosynthesis.jl" uuid = "5e10c064-2706-53a3-a67d-d473e313a663" version = "0.1.0"

rafaqz commented 2 years ago

There is always a version, because the full history of every package is available in git

The paper had a zenodo record attached. It probably needs julia 1.3. But it should point to all the old versions on github that work together: https://zenodo.org/record/4255263

But I will also endevour to get this updated too. I had to write a lot of tools from scratch for this project, and now have written much better and more tools for building the internals of these models and for data handling - Rasters.jl/ModelParameters.jl and others - and those are what I currently use.

These older packages that inspired the new registered ones haven't been updated because I'm stretched pretty thin, and I'm my own PhD which doesn't use these pacakges at all.

rafaqz commented 2 years ago

Also, to clarify, this repository is just the scripts to produce the paper and the analysis I did for it. This is not a package!

Photosynthesis.jl and DynamicEnergyBudgets.jl are the packages, and they both still work fine! They also need updating, but they would be moving away from compatibility with these scripts, not towards it.

rafaqz commented 2 years ago

I will be more able to help if we focus on using the packages these scripts use - they're much simpler and more structured than these scripts.

giannamars commented 2 years ago

Thanks a lot for the link to the zenodo record and clarification! I got the user interface to work with Julia Version 1.3.1 and making minor changes to ui.jl, namely JLD2's readdir() function, and renaming the environments variable (ll.26-27) to environment. The build for DynamicEnergyBudgets.jl with later versions (somehow connected to OrdinaryDiffEq and Julia 1.5) still fail for me, but all I need is a working version of the model at this point.

rafaqz commented 2 years ago

Ah ok. Glad you got it working. For getting DynamicEnerguBudgets.jl working lets make issues over there. It should be a minor fix.