NamedArrays REPL Issue

Hello everyone,

All my code isn’t working anymore since today, with the following simple MWE:

x = NamedArray([0,4,5],["a","b","c"])

Now output’s:

ERROR: ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
  [1] _empty_reduce_error()
    @ Base .\reduce.jl:301
  [2] reduce_empty(op::Function, #unused#::Type{Int64})
    @ Base .\reduce.jl:311
  [3] mapreduce_empty(#unused#::typeof(identity), op::Function, T::Type)
    @ Base .\reduce.jl:345
  [4] reduce_empty(op::Base.MappingRF{typeof(identity), typeof(max)}, #unused#::Type{Int64})
    @ Base .\reduce.jl:331
  [5] reduce_empty_iter
    @ .\reduce.jl:357 [inlined]
  [6] mapreduce_empty_iter(f::Function, op::Function, itr::Vector{Int64}, ItrEltype::Base.HasEltype)
    @ Base .\reduce.jl:353
  [7] _mapreduce
    @ .\reduce.jl:402 [inlined]
  [8] _mapreduce_dim
    @ .\reducedim.jl:330 [inlined]
  [9] #mapreduce#725
    @ .\reducedim.jl:322 [inlined]
 [10] mapreduce
    @ .\reducedim.jl:322 [inlined]
 [11] #_maximum#743
    @ .\reducedim.jl:894 [inlined]
 [12] _maximum
    @ .\reducedim.jl:894 [inlined]
 [13] #_maximum#742
    @ .\reducedim.jl:893 [inlined]
 [14] _maximum
    @ .\reducedim.jl:893 [inlined]
 [15] #maximum#740
    @ .\reducedim.jl:889 [inlined]
 [16] maximum
    @ .\reducedim.jl:889 [inlined]
 [17] show(io::IOContext{Base.TTY}, v::NamedVector{Int64, Vector{Int64}, Tuple{OrderedCollections.OrderedDict{String, Int64}}}, maxnrow::Int64)     
    @ NamedArrays C:\Users\tlorans\.julia\packages\NamedArrays\TuJLn\src\show.jl:203
 [18] show(io::IOContext{Base.TTY}, v::NamedVector{Int64, Vector{Int64}, Tuple{OrderedCollections.OrderedDict{String, Int64}}})
    @ NamedArrays C:\Users\tlorans\.julia\packages\NamedArrays\TuJLn\src\show.jl:73
 [19] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, n::NamedVector{Int64, Vector{Int64}, Tuple{OrderedCollections.OrderedDict{String, Int64}}})
    @ NamedArrays C:\Users\tlorans\.julia\packages\NamedArrays\TuJLn\src\show.jl:24

BUT, the data exists:

sum(x .+ 1)

will gives:

12

I suspect this is coming from uncompatility between packages, but nothing appeared regarding potential compilation erros.
My Pkg st is:

  [a93c6f00] DataFrames v1.3.2
  [31c24e10] Distributions v0.24.18
  [38e38edf] GLM v1.6.1
  [4076af6c] JuMP v0.23.2
  [e4e893b0] Mimi v1.4.0
  [b3ba11de] MimiFUND v3.13.0
  [86f7a689] NamedArrays v0.9.6
  [91a5bcdd] Plots v1.26.0
  [c3e4b0f8] Pluto v0.18.1
  [7f904dfe] PlutoUI v0.7.23
  [92933f4c] ProgressMeter v1.7.1
  [c6596682] QuantileRegressions v0.1.10
  [1463e38c] StatFiles v0.8.0
  [2913bbd2] StatsBase v0.33.16
  [f3b207a7] StatsPlots v0.14.33
  [fdbf4ff8] XLSX v0.7.9

Anyone has an idea about the source of the issue please?

On a completely fresh session in a clean environment, I get

julia> using NamedArrays

julia> x = NamedArray([0,4,5],["a","b","c"])
3-element Named Vector{Int64}
A  │
───┼──
a  │ 0
b  │ 4
c  │ 5

This is with NamedArrays v0.9.6 as you have. Have you tried restarting your REPL?

1 Like

Yes, I tried to restart the REPL, and VS code also.
I’ve also reinstalled most of the packages, including NamedArrays.
But I still have the issue.
At the moment I just don’t try to output NamedArrays in the REPL anymore, with the use of a simple ; at the end of the line…

Have you migrated julia versions? Which are you running?

Ok, I started another fresh environment and REPL and added all of your listed packages except the two involving Mimi. It still works fine for me.

[a93c6f00] DataFrames v1.3.2
[31c24e10] Distributions v0.25.53
[38e38edf] GLM v1.6.1
[4076af6c] JuMP v1.0.0
[86f7a689] NamedArrays v0.9.6
[91a5bcdd] Plots v1.27.3
[c3e4b0f8] Pluto v0.18.4
[7f904dfe] PlutoUI v0.7.38
[92933f4c] ProgressMeter v1.7.2
[c6596682] QuantileRegressions v0.1.10
[1463e38c] StatFiles v0.8.0
[2913bbd2] StatsBase v0.33.16
[f3b207a7] StatsPlots v0.14.33
[fdbf4ff8] XLSX v0.7.9
2 Likes

Okay, thank you everyone for having tested this.

I will certainly need to remove all packages then. Hope it will work.

Just to add your error is in showing the NamedArray, which is also why x is defined for you - the operation of creating the object runs fine, but then the REPL fails to print the result. You might want to look for anything in your code or the packages you’re loading that overloads show.

tlorans wrote:

Okay, thank you everyone for having tested this.
I will certainly need to remove all packages then. Hope it will work.

Or try another type of arrays.
i.e. the “ComponentArrays”…IMHO more universal than the “NamedArrays”
and easier to use.

Thank you for the suggestion, I will check about it.