Precompilation error for CSV package - PosLen not defined

I have spent about an hour trying to fix a precompilation error related to the CSV package (full stacktrace at bottom).

As far as I can tell:

  • Deleting the compiled folder doesn’t help.
  • Neither does starting a new environment from fresh.
  • A bunch of other packages don’t pre-compile, but CSV actually gives me an error.
  • It’s due to my package, GEPPR.jl, which has CSV.jl as a dependency but I don’t know why. I’ve restricted CSV to >= 0.8.2 in my Project.toml, but I can’t see how that could be an issue, and I don’t understand why this started happening.
[ Info: Precompiling CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b]
ERROR: LoadError: LoadError: UndefVarError: PosLen not defined
Stacktrace:
  [1] top-level scope
    @ ~/.julia/packages/WeakRefStrings/EDA28/src/poslenstrings.jl:6
  [2] include(mod::Module, _path::String)
    @ Base ./Base.jl:386
  [3] include(x::String)
    @ WeakRefStrings ~/.julia/packages/WeakRefStrings/EDA28/src/WeakRefStrings.jl:1
  [4] top-level scope
    @ ~/.julia/packages/WeakRefStrings/EDA28/src/WeakRefStrings.jl:543
  [5] include
    @ ./Base.jl:386 [inlined]
  [6] 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:1213
  [7] top-level scope
    @ none:1
  [8] eval
    @ ./boot.jl:360 [inlined]
  [9] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [10] top-level scope
    @ none:1
in expression starting at /home/u0128861/.julia/packages/WeakRefStrings/EDA28/src/poslenstrings.jl:6
in expression starting at /home/u0128861/.julia/packages/WeakRefStrings/EDA28/src/WeakRefStrings.jl:1
ERROR: LoadError: Failed to precompile WeakRefStrings [ea10d353-3f73-51f8-a26c-33c1cb351aa5] to /home/u0128861/.julia/compiled/v1.6/WeakRefStrings/jl_DqGy3W.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
    @ Base ./loading.jl:1360
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1306
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1021
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:914
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:901
  [7] include
    @ ./Base.jl:386 [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:1213
  [9] top-level scope
    @ none:1
 [10] eval
    @ ./boot.jl:360 [inlined]
 [11] eval(x::Expr)
    @ Base.MainInclude ./client.jl:446
 [12] top-level scope
    @ none:1
in expression starting at /home/u0128861/.julia/packages/CSV/bLdMU/src/CSV.jl:1
ERROR: Failed to precompile CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b] to /home/u0128861/.julia/compiled/v1.6/CSV/jl_UAge9I.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
    @ Base ./loading.jl:1360
  [3] compilecache(pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1306
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1021
  [5] require(uuidkey::Base.PkgId)
    @ Base ./loading.jl:914
  [6] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:901
  [7] eval
    @ ./boot.jl:360 [inlined]
  [8] eval
    @ ./Base.jl:39 [inlined]
  [9] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.3.33/scripts/packages/VSCodeServer/src/repl.jl:157
 [10] (::VSCodeServer.var"#69#71"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.3.33/scripts/packages/VSCodeServer/src/repl.jl:123
 [11] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:491
 [12] with_logger
    @ ./logging.jl:603 [inlined]
 [13] (::VSCodeServer.var"#68#70"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.3.33/scripts/packages/VSCodeServer/src/repl.jl:124
 [14] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [15] invokelatest(::Any)
    @ Base ./essentials.jl:706
 [16] macro expansion
    @ ~/.vscode/extensions/julialang.language-julia-1.3.33/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
 [17] (::VSCodeServer.var"#53#54")()
    @ VSCodeServer ./task.jl:411
3 Likes

This appears to be a due to my environment having many packages, and some of them eventually breaking each other. Will report back.

I managed to fix this by doing pkg> pin CSV@0.8.5. I think the error is due to WeakRefStrings, hopefully gets fixed soon.

3 Likes

Do you have the output of ]st?

So I got quite excited and opened some Git issues, and timholy pointed me to this bug.

Those Git issues:
https://github.com/JuliaArrays/ArrayInterface.jl/issues/208
https://github.com/JuliaData/CSV.jl/issues/912

No, I have just 3 packages installed and am getting the same PosLen related error. Given the recency of your post and the fact that I am experiencing the same error, I’d recommend downgrading the CSV package.

Thanks, this worked for me too.

I’m having the same problem after installing julia 1.7.1 on linux mint. Thanks for the downgrade tip. I hope it gets fixed soon.