BecksLab / EcologicalNetworksDynamics.jl

A simulator for ecological dynamics written in Julia.
GNU Affero General Public License v3.0
18 stars 1 forks source link

`spzeros MethodError` when building docs #17

Closed evadelmas closed 2 years ago

evadelmas commented 2 years ago

When building the documentation (julia --project=docs docs/make.jl), code blocks fail with the following message:doctest failure in ~/projets/BEFWM2/src/...Seems to be because of this:

ERROR: MethodError: no method matching spzeros(::Type{Float64}, ::Tuple{Int64, Int64})
│ Closest candidates are:
│   spzeros(::Type{Tv}, !Matched::Type{Ti}, !Matched::Tuple{Integer, Integer}) where {Tv, Ti} at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/SparseArrays/src/sparsematrix.jl:1678
│   spzeros(::Type{T}, !Matched::Integer) where T at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/SparseArrays/src/sparsevector.jl:128
│   spzeros(::Type{Tv}, !Matched::Integer, !Matched::Integer) where Tv at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/SparseArrays/src/sparsematrix.jl:1672
ismael-lajaaiti commented 2 years ago

I never had this error when building the documentation, and I tried to reproduce this error but I couldn't. Do you have the same error when you run the tests? ((BEFWM2) pkg> test in the REPL) Also, could you run send the package list of the environment BEFWM2 and the environment docs (to be sure everything is good) and also in both of these environments run pkg> instantiate to be sure that all the dependencies are up to date (if not already done).

evadelmas commented 2 years ago

I have the same error when running the tests. Here is (one of) the stacktrace:

ERROR: MethodError: no method matching spzeros(::Type{Float64}, ::Tuple{Int64, Int64})
│    Closest candidates are:
│      spzeros(::Type{Tv}, !Matched::Type{Ti}, !Matched::Tuple{Integer, Integer}) where {Tv, Ti} at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/SparseArrays/src/sparsematrix.jl:1678
│      spzeros(::Type{T}, !Matched::Integer) where T at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/SparseArrays/src/sparsevector.jl:128
│      spzeros(::Type{Tv}, !Matched::Integer, !Matched::Integer) where Tv at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/SparseArrays/src/sparsematrix.jl:1672
│      ...
│    Stacktrace:
│     [1] assimilation_efficiency(foodweb::FoodWeb; e_herbivore::Float64, e_carnivore::Float64)
│       @ BEFWM2 ~/projets/BEFWM2/src/inputs/functional_response.jl:121
│     [2] assimilation_efficiency(foodweb::FoodWeb)
│       @ BEFWM2 ~/projets/BEFWM2/src/inputs/functional_response.jl:120
│     [3] BioRates(foodweb::FoodWeb)
│       @ BEFWM2 ~/projets/BEFWM2/src/inputs/biological_rates.jl:181
│     [4] ModelParameters(foodweb::FoodWeb)
│       @ BEFWM2 ~/projets/BEFWM2/src/model/model_parameters.jl:100
│     [5] top-level scope
│       @ none:1
└ @ Documenter.DocTests ~/projets/BEFWM2/src/model/model_parameters.jl:55

And my env.:

(BEFWM2) pkg> st
     Project BEFWM2 v0.1.0
      Status `~/projets/BEFWM2/Project.toml`
  [2b5f629d] DiffEqBase v6.83.2
  [0c46a032] DifferentialEquations v6.20.0
  [f03a62fe] EcologicalNetworks v0.5.2
  [2f01184e] SparseArrays
  [10745b16] Statistics

I will have a more thorough look into it later today, it's probably an easy fix, seems to be nothing more than a method error. One of the thing that may be causing this is that I think you are working and running tests on your own fork (ilajaait/BEFWM2)? Can you reproduce the error if you clone BecksLab/BEFWM2 and run the tests from it?

ismael-lajaaiti commented 2 years ago

I cloned BecksLab/BEFWM2, run the tests and I had no error. Do you work also with Julia 1.7.2? If you do a new clone of the repo BecksLab/BEFWM2 and run the tests do you still have the error? PS: you are working from the develop branch, right? I assume so, but I ask just to be sure.

evadelmas commented 2 years ago

If I change spzeros(Float64, (S, S)) to spzeros(Float64, S, S) it has the desired behavior, it's strange that the former works for you... (yes, I'm on the develop branch)

ismael-lajaaiti commented 2 years ago

It's weird. Can you tell me what is your Julia version ? As SparseArrays is now included in Base (I think) maybe it comes from that (a method of spzeros that has been deleted or added). Anyway, the syntax spzeros(Float64, S, S) also works for me so we can switch to this to avoid the bug.

evadelmas commented 2 years ago

Ha, I haven't updated to 1.7 yet, that may be what's causing the problem.

evadelmas commented 2 years ago

Closed by #20