Arpack error when trying to use StatsPlots in a Bayesian Linear Regression example

Hi

New user of Julia. I’m using Julia1.7.3 on a Linux Ubuntu 21.04 machine.

I created a new environment for testing simple and advanced Bayesian Models using Turing. These are models I have previously tested in R (brms and rstan) and Python (pymc). Prior to that, I wanted to replicate a simple linear regression example illustrated in Turing documentation. See this Turing Bayesian Linear Regression example.

In the very first set of the commands, I run into an Arpack error originating from precompiling StatsPlots. Any help is much appreciated. I have tried reinstalling StatsPlots, Arpack, and Arpack_jll. However no success yet. I have also tried Pkg.instantiate() and ] instantiate -p without success

The command is using MCMCChains, Plots, StatsPlots

The complete error output is

Info: Precompiling StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd]
└ @ Base loading.jl:1423
ERROR: LoadError: InitError: Artifact "Arpack" was not installed correctly. Try `using Pkg; Pkg.instantiate()` to re-install all missing resources.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] _artifact_str(__module__::Module, artifacts_toml::String, name::SubString{String}, path_tail::String, artifact_dict::Dict{String, Any}, hash::Base.SHA1, platform::Base.BinaryPlatforms.Platform, lazyartifacts::Any)
    @ Artifacts ~/julia-1.7.2/share/julia/stdlib/v1.7/Artifacts/src/Artifacts.jl:551
  [3] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./essentials.jl:716
  [4] invokelatest(::Any, ::Any, ::Vararg{Any})
    @ Base ./essentials.jl:714
  [5] macro expansion
    @ ~/julia-1.7.2/share/julia/stdlib/v1.7/Artifacts/src/Artifacts.jl:680 [inlined]
  [6] find_artifact_dir()
    @ Arpack_jll ~/.julia/packages/JLLWrappers/QpMQW/src/wrapper_generators.jl:17
  [7] __init__()
    @ Arpack_jll ~/.julia/packages/Arpack_jll/zfgpQ/src/wrappers/x86_64-linux-gnu-libgfortran5.jl:9
  [8] _include_from_serialized(path::String, depmods::Vector{Any})
    @ Base ./loading.jl:768
  [9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
    @ Base ./loading.jl:854
 [10] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1097
 [11] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
 [12] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
 [13] include
    @ ./Base.jl:418 [inlined]
 [14] 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:1318
 [15] top-level scope
    @ none:1
 [16] eval
    @ ./boot.jl:373 [inlined]
 [17] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [18] top-level scope
    @ none:1
during initialization of module Arpack_jll
in expression starting at /home/sreedta/.julia/packages/Arpack/pLziT/src/Arpack.jl:2
ERROR: LoadError: Failed to precompile Arpack [7d9fca2a-8960-54d3-9f78-7d1dccf2cb97] to /home/sreedta/.julia/compiled/v1.7/Arpack/jl_843nW2.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include(mod::Module, _path::String)
    @ Base ./Base.jl:418
  [8] include(x::String)
    @ MultivariateStats ~/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:1
  [9] top-level scope
    @ ~/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:113
 [10] include
    @ ./Base.jl:418 [inlined]
 [11] 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:1318
 [12] top-level scope
    @ none:1
 [13] eval
    @ ./boot.jl:373 [inlined]
 [14] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [15] top-level scope
    @ none:1
in expression starting at /home/sreedta/.julia/packages/MultivariateStats/zLpz8/src/kpca.jl:3
in expression starting at /home/sreedta/.julia/packages/MultivariateStats/zLpz8/src/MultivariateStats.jl:1
ERROR: LoadError: Failed to precompile MultivariateStats [6f286f6a-111f-5878-ab1e-185364afe411] to /home/sreedta/.julia/compiled/v1.7/MultivariateStats/jl_G4yfXk.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
    @ Base ./loading.jl:1466
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1410
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1120
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1013
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:997
  [7] include
    @ ./Base.jl:418 [inlined]
  [8] 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:1318
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:373 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:453
 [12] top-level scope
    @ none:1
in expression starting at /home/sreedta/.julia/packages/StatsPlots/8DjQs/src/StatsPlots.jl:1
Failed to precompile StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd] to /home/sreedta/.julia/compiled/v1.7/StatsPlots/jl_xR0OpT.

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)
   @ Base ./loading.jl:1466
 [3] compilecache(pkg::Base.PkgId, path::String)
   @ Base ./loading.jl:1410
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1120
 [5] require(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1013
 [6] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:997
 [7] eval
   @ ./boot.jl:373 [inlined]
 [8] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base ./loading.jl:1196 ```

Hi All

For what it is worth, I created a new project and installed only DataFrames.jl, Plots.jl, and StatsPlots.jl - I could test basic charts such as a Scatter plot or a Histogram without any problems. All of the Arpack related errors were gone. So the original error, I have reported above must be the result of clash between requirements of one or more of the additional packages I installed. I would have expected that Pkg package manager, would manage the requirements checking process as Conda does in Anaconda

As a new user of Julia, these type of errors are very frustrating. I will continue working through these errors. Is this type of behavior typical, where package/library installation happens without errors but errors emerge at the time of actually using the libraries? I understand that both R and Python have a longer lead time in sorting out these issues to have their current level of efficiency in package installation and dependency checking. In the past 3 days, I have encountered these problems multiple times with multiple libraries across both Linux and Windows based machines.

I look forward to hearing from others who are more experienced than I’m in Julia.