# Error Messages

**URL:** https://discourse.julialang.org/t/error-messages/96019
**Category:** New to Julia
**Created:** [March 13, 2023, 5:58pm UTC](https://discourse.julialang.org/t/error-messages/96019 "2023-03-13T17:58:40Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![luol3](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@luol3](https://discourse.julialang.org/u/luol3)
#### Post date: [March 13, 2023, 5:58pm UTC](https://discourse.julialang.org/t/error-messages/96019/1 "2023-03-13T17:58:40Z")

</div>

I am trying to run the trained simulation from the following neuroscience paper ([Distributing task-related neural activity across a cortical network through task-independent connections](https://www.biorxiv.org/content/10.1101/2022.06.17.496618v1.full) and my script currently looks like this

```julia
using JLD
include("load_files.jl")
include("runtest.jl")
p, w0Index, w0Weights, nc0, wpIndexIn, wpIndexOut, wpIndexConvert, wpWeightIn, wpWeightOut, ncpIn, ncpOut, stim, almOrd, matchedCells, ffwdRate, wpWeightFfwd = load_files("/Users/luol3/Downloads/distributedActivity-main/data_network/", "right")
xtotal, xebal, xibal, xplastic, times, ns, vtotal_exccell, vtotal_inhcell, vebal_exccell, vibal_exccell, vebal_inhcell, vibal_inhcell, vplastic_exccell, vplastic_inhcell = runtest(p,w0Index,w0Weights,nc0,wpIndexOut,wpWeightOut,ncpOut,stim,ffwdRate,wpWeightFfwd)

```

Both loadfiles and runtest are from the following github repository: [GitHub - SpikingNetwork/distributedActivity](https://github.com/SpikingNetwork/distributedActivity/).  
When I run loadfiles, I get the following warning message

```julia
Warning: type paramType not present in workspace; reconstructing
└ @ JLD ~/.julia/packages/JLD/S6t6A/src/jld_types.jl:697

```

and when the script runs the function runtest, I get the following error message

```julia
33ERROR: LoadError: MethodError: no method matching isless(::Float64, ::Matrix{Float64})
Closest candidates are:
  isless(::T, ::T) where T<:Union{Float16, Float32, Float64} at float.jl:424
  isless(::Real, ::DualNumbers.Dual{<:Real}) at ~/.julia/packages/DualNumbers/5knFX/src/dual.jl:182
  isless(::AbstractFloat, ::AbstractFloat) at operators.jl:184
  ...
Stacktrace:
 [1] <(x::Float64, y::Matrix{Float64})
   @ Base ./operators.jl:356
 [2] runtest(p::JLD.var"##paramType#312", w0Index::Matrix{Int64}, w0Weights::Matrix{Float64}, nc0::Vector{Int64}, wpIndexOut::Matrix{Float64}, wpWeightOut::Matrix{Float64}, ncpOut::Vector{Int64}, stim::Matrix{Float64}, ffwdRate::Vector{Matrix{Float64}}, wpWeightFfwd::Vector{Matrix{Float64}})
   @ Main ~/Downloads/distributedActivity-main/runtest.jl:178
 [3] top-level scope
   @ ~/Downloads/distributedActivity-main/trainedrightactivity.jl:5
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:476
 [5] top-level scope
   @ REPL[2]:1
in expression starting at /Users/luol3/Downloads/distributedActivity-main/trainedrightactivity.jl:5

```

Does anyone have any ideas on what I should do? I have never coded in Julia before.

---

<div class="post-metadata">

### Author: ![awasserman](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@awasserman](https://discourse.julialang.org/u/awasserman)
#### Post date: [March 13, 2023, 7:10pm UTC](https://discourse.julialang.org/t/error-messages/96019/2 "2023-03-13T19:10:07Z")

</div>

Hi there!

It looks like that git repository did not include the environment files (usual called Project.toml and/or Manifest.toml). These files specify what packages to use for a given project. You can read more about environment in the Julia manual here:  
[https://docs.julialang.org/en/v1/manual/code-loading/#Environments](https://docs.julialang.org/en/v1/manual/code-loading/#Environments)

Ideally, the authors should include these files as part of the software repository, as they help with making the analysis more reproducible.

I took a look at the `main.jl` file to try and figure out the dependencies. It looks like the dependencies (packages not included in Julia’s standard library) are: Distributions, JLD, PyCall, PyPlot, and DelimitedFiles. You can set up an environment with these packages by running the following code in Julia (assuming you are working in the top-level directory of the git repository):

```julia
using Pkg
Pkg.activate(".")
Pkg.add(["Distributions", "JLD", "PyCall", "PyPlot", "DelimitedFiles"])

```

Then, when you want to run the code you’re using, start with the following:

```julia
using Pkg
Pkg.activate(".")

```

That will tell Julia to use the project environment that we just defined.

---

<div class="post-metadata">

### Author: ![luol3](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@luol3](https://discourse.julialang.org/u/luol3)
#### Post date: [March 14, 2023, 1:06am UTC](https://discourse.julialang.org/t/error-messages/96019/3 "2023-03-14T01:06:11Z")

</div>

I modified my script to say this

```julia
using JLD
using Distributions
using PyCall
using PyPlot
using DelimitedFiles
using LinearAlgebra
using Random
using SparseArrays
include("load_files.jl")
include("runtest.jl")
p, w0Index, w0Weights, nc0, wpIndexIn, wpIndexOut, wpIndexConvert, wpWeightIn, wpWeightOut, ncpIn, ncpOut, stim, almOrd, matchedCells, ffwdRate, wpWeightFfwd = load_files("/Users/luol3/Downloads/distributedActivity-main/data_network/", "right")
xtotal, xebal, xibal, xplastic, times, ns, vtotal_exccell, vtotal_inhcell, vebal_exccell, vibal_exccell, vebal_inhcell, vibal_inhcell, vplastic_exccell, vplastic_inhcell = runtest(p,w0Index,w0Weights,nc0,wpIndexOut,wpWeightOut,ncpOut,stim,ffwdRate,wpWeightFfwd)

```

because there were a few more dependencies in the main file, but an error message showed up again.

```julia
 Warning: type paramType not present in workspace; reconstructing
└ @ JLD ~/.julia/packages/JLD/S6t6A/src/jld_types.jl:697
33ERROR: LoadError: MethodError: no method matching isless(::Float64, ::Matrix{Float64})
Closest candidates are:
  isless(::T, ::T) where T<:Union{Float16, Float32, Float64} at float.jl:424
  isless(::Real, ::DualNumbers.Dual{<:Real}) at ~/.julia/packages/DualNumbers/5knFX/src/dual.jl:182
  isless(::Real, ::ColorTypes.AbstractGray) at ~/.julia/packages/ColorTypes/1dGw6/src/operations.jl:39
  ...
Stacktrace:
 [1] <(x::Float64, y::Matrix{Float64})
   @ Base ./operators.jl:356
 [2] runtest(p::JLD.var"##paramType#312", w0Index::Matrix{Int64}, w0Weights::Matrix{Float64}, nc0::Vector{Int64}, wpIndexOut::Matrix{Float64}, wpWeightOut::Matrix{Float64}, ncpOut::Vector{Int64}, stim::Matrix{Float64}, ffwdRate::Vector{Matrix{Float64}}, wpWeightFfwd::Vector{Matrix{Float64}})
   @ Main ~/Downloads/distributedActivity-main/runtest.jl:178
 [3] top-level scope
   @ ~/Downloads/distributedActivity-main/trainedrightactivity.jl:12
 [4] include(fname::String)
   @ Base.MainInclude ./client.jl:476
 [5] top-level scope
   @ REPL[2]:1
in expression starting at /Users/luol3/Downloads/distributedActivity-main/trainedrightactivity.jl:12

```

I think this is the exact same error message.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [March 14, 2023, 2:22am UTC](https://discourse.julialang.org/t/error-messages/96019/4 "2023-03-14T02:22:32Z")

</div>

It says `no method matching isless(::Float64, ::Matrix{Float64})`, which is called from `<` on line `~/Downloads/distributedActivity-main/runtest.jl:178`

i.e. you are trying to compare `number < matrix`, and of course it is failing because there is no such comparison operation in Julia.

That line is `if rndFfwd[ci] < ffwdRate[tidx,ci]/(1000/p.dt)`, where `ffwdRate` is one of the parameters you are passing to `runtest`. So it sounds like `ffwdRate[tidx,ci]` is a matrix when it is supposed to be a number?

Indeed the callback says `ffwdRate::Vector{Matrix{Float64}}`, i.e. `ffwdRate` is an array of matrices, which doesn’t make sense if it is used as `ffwdRate[tidx,ci]`. Maybe you’re supposed to be passing _one_ of the matrices in `ffwdRate`, e.g. `ffwdRate[1]` or something? (Similarly for `wpWeightFfwd`.)

---

<div class="post-metadata">

### Author: ![luol3](https://avatars.discourse-cdn.com/v4/letter/l/82dd89/32.png) [@luol3](https://discourse.julialang.org/u/luol3)
#### Post date: [March 14, 2023, 8:07pm UTC](https://discourse.julialang.org/t/error-messages/96019/5 "2023-03-14T20:07:51Z")

</div>

ffwdRate and wpWeightFfwd, when I load them in individually, are dictionary files of the form

```julia
Dict{String, Any} with 1 entry

```

but I don’t know what the keys are for those files or where to find them.

Edit: I found the keys function and got my script to work.
