Failure to precompile FixedEffectModels

Hi All,
I am new to Julia. I am trying to use the package FixedEffectModels.
After adding the Package I am trying to run the code as provided in the Readme file of the github package:

using DataFrames, RDatasets, FixedEffectModels

df = dataset(“plm”, “Cigar”)

reg(df, @formula(Sales ~ NDI + fe(State) + fe(Year)), Vcov.cluster(:State), weights = :Pop)

The problem is that it is failing to precompile the FixedEffectModels for some reason I cannot figure out why. The following is the error message that I receive:

[ Info: Precompiling FixedEffectModels [9d5cd8c9-2029-5cab-9928-427838db53e3]
ERROR: LoadError: MethodError: no method matching abs2(::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true})
Closest candidates are:
abs2(::Complex) at complex.jl:278
abs2(::DualNumbers.Dual) at C:\Users\lenovo.julia\packages\DualNumbers\5knFX\src\dual.jl:204
abs2(::Bool) at bool.jl:150

Stacktrace:
[1] MappingRF (repeats 2 times)
@ .\reduce.jl:95 [inlined]
[2] _foldl_impl
@ .\reduce.jl:58 [inlined]
[3] foldl_impl(op::Base.MappingRF{Base.var"#242#243"{Vector{Float64}}, Base.MappingRF{typeof(abs2), Base.BottomRF{typeof(Base.add_sum)}}}, nt::Base._InitialValue, itr::Base.OneTo{Int64})
@ Base .\reduce.jl:48
[4] mapfoldl_impl(f::typeof(abs2), op::typeof(Base.add_sum), nt::Base._InitialValue, itr::Base.Generator{Base.OneTo{Int64}, Base.var"#242#243"{Vector{Float64}}})
@ Base .\reduce.jl:44
[5] mapfoldl(f::Function, op::Function, itr::Base.Generator{Base.OneTo{Int64}, Base.var"#242#243"{Vector{Float64}}}; init::Base._InitialValue)
@ Base .\reduce.jl:170
[6] mapfoldl
@ .\reduce.jl:170 [inlined]
[7] #mapreduce#263
@ .\reduce.jl:302 [inlined]
[8] mapreduce
@ .\reduce.jl:302 [inlined]
[9] sum#266
@ .\reduce.jl:528 [inlined]
[10] sum(f::Function, a::Base.Generator{Base.OneTo{Int64}, Base.var"#242#243"{Vector{Float64}}})
@ Base .\reduce.jl:528
[11] (::FixedEffectModels.var"#64#74")(x::Base.Generator{Base.OneTo{Int64}, Base.var"#242#243"{Vector{Float64}}})
@ FixedEffectModels .\none:0
[12] iterate
@ .\generator.jl:47 [inlined]
[13] collect(itr::Base.Generator{Vector{Base.Generator{Base.OneTo{Int64}}}, FixedEffectModels.var"#64#74"})
@ Base .\array.jl:787
[14] fit(::Type{FixedEffectModels.FixedEffectModel}, formula::StatsModels.FormulaTerm, df::Any, vcov::StatsBase.CovarianceEstimator; contrasts::Dict, weights::Union{Nothing, Symbol}, save::Union{Bool, Symbol}, method::Symbol, nthreads::Integer, double_precision::Bool, tol::Real, maxiter::Integer, drop_singletons::Bool, progress_bar::Bool, subset::Union{Nothing, AbstractVector}, first_stage::Bool)
@ FixedEffectModels C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\fit.jl:239
[15] #reg#56
@ C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\fit.jl:64 [inlined]
[16] reg (repeats 2 times)
@ C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\fit.jl:49 [inlined]
[17] macro expansion
@ C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\FixedEffectModels.jl:44 [inlined]
[18] top-level scope
@ C:\Users\lenovo.julia\packages\PrecompileTools\L8A3n\src\workloads.jl:78
[19] include
@ .\Base.jl:419 [inlined]
[20] 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
[21] top-level scope
@ stdin:1
in expression starting at C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\FixedEffectModels.jl:2
in expression starting at stdin:1
ERROR: Failed to precompile FixedEffectModels [9d5cd8c9-2029-5cab-9928-427838db53e3] to C:\Users\lenovo.julia\compiled\v1.8\FixedEffectModels\jl_887C.tmp.
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:1707
[3] compilecache
@ .\loading.jl:1651 [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

Thank you for your help

We’ll need some more information to help. What version of Julia are you running and how did you install Julia?

What happens when you do:

] activate --temp

julia> add DataFrames, RDatasets, FixedEffectModels

I just tried on the current release (1.10.4) and confirmed that the packages install and precompile just fine.

Hi Nils.
Thank you for your reply. I am using Julia 1.8.5.
When I run what you suggested I get the following:
Precompiling project…
✓ TranscodingStreams
✗ FixedEffectModels
✓ CodecZlib
✓ CSV
✓ RData
✓ RDatasets
5 dependencies successfully precompiled in 96 seconds. 66 already precompiled.
5 dependencies precompiled but different versions are currently loaded. Restart julia to access the new versions
1 dependency errored. To see a full report either run import Pkg; Pkg.precompile() or load the package

If I try to precompile again I get the following (similar to before):

Precompiling project…
✗ FixedEffectModels
0 dependencies successfully precompiled in 84 seconds. 71 already precompiled.

ERROR: The following 1 direct dependency failed to precompile:

FixedEffectModels [9d5cd8c9-2029-5cab-9928-427838db53e3]

Failed to precompile FixedEffectModels [9d5cd8c9-2029-5cab-9928-427838db53e3] to C:\Users\lenovo.julia\compiled\v1.8\FixedEffectModels\jl_CB0.tmp.
ERROR: LoadError: MethodError: no method matching abs2(::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true})
Closest candidates are:
abs2(::Complex) at complex.jl:278
abs2(::DualNumbers.Dual) at C:\Users\lenovo.julia\packages\DualNumbers\5knFX\src\dual.jl:204
abs2(::Bool) at bool.jl:150

Stacktrace:
[1] MappingRF (repeats 2 times)
@ .\reduce.jl:95 [inlined]
[2] _foldl_impl
@ .\reduce.jl:58 [inlined]
[3] foldl_impl(op::Base.MappingRF{Base.var"#242#243"{Vector{Float64}}, Base.MappingRF{typeof(abs2), Base.BottomRF{typeof(Base.add_sum)}}}, nt::Base._InitialValue, itr::Base.OneTo{Int64})
@ Base .\reduce.jl:48
[4] mapfoldl_impl(f::typeof(abs2), op::typeof(Base.add_sum), nt::Base._InitialValue, itr::Base.Generator{Base.OneTo{Int64}, Base.var"#242#243"{Vector{Float64}}})
@ Base .\reduce.jl:44
[5] mapfoldl(f::Function, op::Function, itr::Base.Generator{Base.OneTo{Int64}, Base.var"#242#243"{Vector{Float64}}}; init::Base._InitialValue)
@ Base .\reduce.jl:170
[6] mapfoldl
@ .\reduce.jl:170 [inlined]
[7] #mapreduce#263
@ .\reduce.jl:302 [inlined]
[8] mapreduce
@ .\reduce.jl:302 [inlined]
[9] sum#266
@ .\reduce.jl:528 [inlined]
[10] sum(f::Function, a::Base.Generator{Base.OneTo{Int64}, Base.var"#242#243"{Vector{Float64}}})
@ Base .\reduce.jl:528
[11] (::FixedEffectModels.var"#64#74")(x::Base.Generator{Base.OneTo{Int64}, Base.var"#242#243"{Vector{Float64}}})
@ FixedEffectModels .\none:0
[12] iterate
@ .\generator.jl:47 [inlined]
[13] collect(itr::Base.Generator{Vector{Base.Generator{Base.OneTo{Int64}}}, FixedEffectModels.var"#64#74"})
@ Base .\array.jl:787
[14] fit(::Type{FixedEffectModels.FixedEffectModel}, formula::StatsModels.FormulaTerm, df::Any, vcov::StatsBase.CovarianceEstimator; contrasts::Dict, weights::Union{Nothing, Symbol}, save::Union{Bool, Symbol}, method::Symbol, nthreads::Integer, double_precision::Bool, tol::Real, maxiter::Integer, drop_singletons::Bool, progress_bar::Bool, subset::Union{Nothing, AbstractVector}, first_stage::Bool)
@ FixedEffectModels C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\fit.jl:239
[15] #reg#56
@ C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\fit.jl:64 [inlined]
[16] reg (repeats 2 times)
@ C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\fit.jl:49 [inlined]
[17] macro expansion
@ C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\FixedEffectModels.jl:44 [inlined]
[18] top-level scope
@ C:\Users\lenovo.julia\packages\PrecompileTools\L8A3n\src\workloads.jl:78
[19] include
@ .\Base.jl:419 [inlined]
[20] 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
[21] top-level scope
@ stdin:1
in expression starting at C:\Users\lenovo.julia\packages\FixedEffectModels\9B0we\src\FixedEffectModels.jl:2
in expression starting at stdin:1

Do you need anything else? Thank you so much for your help!

How did you install Julia? And why are you using Julia 1.8.5, rather than the current release 1.10?

Hi Nils,
with the current release it works. On the package it says that it should be compatible with Julia 1.6 so I wasn’t thinking the julia version was the problem. Thank you for your help!

And it should, although 1.8 is unsupported - the reason 1.6 is mentioned is because it is the current LTS release, so many packages test against it.

I’ve confirmed there’s an issue on 1.8, but to be honest it’s unlikely that any of the maintainers (of which I am a very part-time one) will put time into fixing an issue on an older Julia version, especially given the new LTS will likely be 1.10 in the very near future.