# Precompilation error for CSV package - PosLen not defined

**URL:** <https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480>\
**Category:** General Usage\
**Created:** [September 20, 2021, 4:27pm UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480 "2021-09-20T16:27:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gobs](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gobs](https://discourse.julialang.org/u/gobs)\
**Post date:** [September 20, 2021, 4:27pm UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480/1 "2021-09-20T16:27:48Z")

</div>

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.

```julia
[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

```

---

<div class="post-metadata">

**Author:** ![gobs](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gobs](https://discourse.julialang.org/u/gobs)\
**Post date:** [September 21, 2021, 8:17am UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480/2 "2021-09-21T08:17:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gobs](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gobs](https://discourse.julialang.org/u/gobs)\
**Post date:** [September 21, 2021, 9:22am UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480/3 "2021-09-21T09:22:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [September 21, 2021, 9:48am UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480/4 "2021-09-21T09:48:35Z")

</div>

> [@gobs](#):
>
> This appears to be a due to my environment having many packages, and some of them eventually breaking each other.

Do you have the output of `]st`?

---

<div class="post-metadata">

**Author:** ![gobs](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@gobs](https://discourse.julialang.org/u/gobs)\
**Post date:** [September 21, 2021, 2:52pm UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480/5 "2021-09-21T14:52:22Z")

</div>

So I got quite excited and opened some Git issues, and timholy pointed me to [this bug](https://github.com/JuliaLang/julia/issues/35663).

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

---

<div class="post-metadata">

**Author:** ![aiqc](https://avatars.discourse-cdn.com/v4/letter/a/2acd7d/32.png) [@aiqc](https://discourse.julialang.org/u/aiqc)\
**Post date:** [October 7, 2021, 7:38pm UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480/6 "2021-10-07T19:38:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![linde-fr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/linde-fr/32/20455_2.png) [@linde-fr](https://discourse.julialang.org/u/linde-fr)\
**Post date:** [October 22, 2021, 8:16am UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480/7 "2021-10-22T08:16:57Z")

</div>

Thanks, this worked for me too.

---

<div class="post-metadata">

**Author:** ![mcbro](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@mcbro](https://discourse.julialang.org/u/mcbro)\
**Post date:** [January 5, 2022, 2:08am UTC](https://discourse.julialang.org/t/precompilation-error-for-csv-package-poslen-not-defined/68480/8 "2022-01-05T02:08:58Z")

</div>

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.
