# Failed to precompile CSV due to load error

**URL:** <https://discourse.julialang.org/t/failed-to-precompile-csv-due-to-load-error/70146>\
**Category:** Package Management\
**Tags:** package, csv\
**Created:** [October 21, 2021, 12:30pm UTC](https://discourse.julialang.org/t/failed-to-precompile-csv-due-to-load-error/70146 "2021-10-21T12:30:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Temi-Tory](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/temi-tory/32/29716_2.png) [@Temi-Tory](https://discourse.julialang.org/u/Temi-Tory)\
**Post date:** [October 21, 2021, 12:30pm UTC](https://discourse.julialang.org/t/failed-to-precompile-csv-due-to-load-error/70146/1 "2021-10-21T12:30:52Z")

</div>

Hi, I am trying to read a CSV file to a dataframe.  
Every time I try to use the CSV.jl package to read csv file. I am greeted with the following error:  
LoadError: Failed to precompile CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b]

I have tried: updating, resolving, removing and adding back the package and all results in the same error.  
I considered using DelimitedFiles.jl but I am unable to use the first row as header as it imports as a matrix. Which is why I am trying to use CVS.jl paackage.

Full details of the error below:  
ERROR: LoadError: Failed to precompile CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b] to C:\Users\ohian.julia\compiled\v1.6\CSV\jl\_A93C.tmp.  
Stacktrace:  
[1] error(s::String)  
@ Base .\error.jl:33  
[2] compilecache(pkg::Base.PkgId, path::String, internal\_stderr::Base.TTY, internal\_stdout::Base.TTY, ignore\_loaded\_modules::Bool)  
@ Base .\loading.jl:1385  
[3] compilecache(pkg::Base.PkgId, path::String)  
@ Base .\loading.jl:1329  
[4] \_require(pkg::Base.PkgId)  
@ Base .\loading.jl:1043  
[5] require(uuidkey::Base.PkgId)  
@ Base .\loading.jl:936  
[6] require(into::Module, mod::Symbol)  
@ Base .\loading.jl:923  
[7] eval  
@ .\boot.jl:360 [inlined]  
[8] include\_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)  
@ Base .\loading.jl:1116  
[9] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})  
@ Base .\essentials.jl:708  
[10] invokelatest(::Any, ::Any, ::Vararg{Any, N} where N)  
@ Base .\essentials.jl:706  
[11] inlineeval(m::Module, code::String, code\_line::Int32, code\_column::Int32, file::String; softscope::Bool)  
@ VSCodeServer c:\Users\ohian.vscode\extensions\julialang.language-julia-1.4.3\scripts\packages\VSCodeServer\src\eval.jl:207  
[12] (::VSCodeServer.var"#58#62"{Bool, Bool, Module, String, Int32, Int32, String, VSCodeServer.ReplRunCodeRequestParams})()  
@ VSCodeServer c:\Users\ohian.vscode\extensions\julialang.language-julia-1.4.3\scripts\packages\VSCodeServer\src\eval.jl:153  
[13] withpath(f::VSCodeServer.var"#58#62"{Bool, Bool, Module, String, Int32, Int32, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)  
@ VSCodeServer c:\Users\ohian.vscode\extensions\julialang.language-julia-1.4.3\scripts\packages\VSCodeServer\src\repl.jl:185  
[14] (::VSCodeServer.var"#57#61"{Bool, Bool, Bool, Module, String, Int32, Int32, String, VSCodeServer.ReplRunCodeRequestParams})()  
@ VSCodeServer c:\Users\ohian.vscode\extensions\julialang.language-julia-1.4.3\scripts\packages\VSCodeServer\src\eval.jl:151  
[15] hideprompt(f::VSCodeServer.var"#57#61"{Bool, Bool, Bool, Module, String, Int32, Int32, String, VSCodeServer.ReplRunCodeRequestParams})  
@ VSCodeServer c:\Users\ohian.vscode\extensions\julialang.language-julia-1.4.3\scripts\packages\VSCodeServer\src\repl.jl:36  
[16] (::VSCodeServer.var"#56#60"{Bool, Bool, Bool, Module, String, Int32, Int32, String, VSCodeServer.ReplRunCodeRequestParams})()  
@ VSCodeServer c:\Users\ohian.vscode\extensions\julialang.language-julia-1.4.3\scripts\packages\VSCodeServer\src\eval.jl:122  
[17] with\_logstate(f::Function, logstate::Any)  
@ Base.CoreLogging .\logging.jl:491  
[18] with\_logger  
@ .\logging.jl:603 [inlined]  
[19] (::VSCodeServer.var"#55#59"{VSCodeServer.ReplRunCodeRequestParams})()  
@ VSCodeServer c:\Users\ohian.vscode\extensions\julialang.language-julia-1.4.3\scripts\packages\VSCodeServer\src\eval.jl:197  
[20] #invokelatest#2  
@ .\essentials.jl:708 [inlined]  
[21] invokelatest(::Any)  
@ Base .\essentials.jl:706  
[22] macro expansion  
@ c:\Users\ohian.vscode\extensions\julialang.language-julia-1.4.3\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]  
[23] (::VSCodeServer.var"#53#54")()  
@ VSCodeServer .\task.jl:411

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 21, 2021, 1:05pm UTC](https://discourse.julialang.org/t/failed-to-precompile-csv-due-to-load-error/70146/2 "2021-10-21T13:05:54Z")

</div>

What package versions are you on?

For DelimitedFiles you could just do something like:

```julia
data = readdlm("myfile.csv")

df = DataFrame(data[2:end, :], string.(data[1, :]))

```

although some additional type inference might be required as postprocessing.

---

<div class="post-metadata">

**Author:** ![Temi-Tory](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/temi-tory/32/29716_2.png) [@Temi-Tory](https://discourse.julialang.org/u/Temi-Tory)\
**Post date:** [October 21, 2021, 1:22pm UTC](https://discourse.julialang.org/t/failed-to-precompile-csv-due-to-load-error/70146/3 "2021-10-21T13:22:49Z")

</div>

Thank you! This worked  
I ended up with:

```julia
data = (readdlm("myfile.csv", ',' ))
df= DataFrame([[data[2:end,i]...] for i in 1:size(data,2)], Symbol.(data[1,:]))

```

Also: I was using the version of CSV I am using was v0.9.8.

---

<div class="post-metadata">

**Author:** ![Temi-Tory](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/temi-tory/32/29716_2.png) [@Temi-Tory](https://discourse.julialang.org/u/Temi-Tory)\
**Post date:** [October 28, 2021, 4:17pm UTC](https://discourse.julialang.org/t/failed-to-precompile-csv-due-to-load-error/70146/5 "2021-10-28T16:17:59Z")

</div>

I also later found that broadcasting the identity function over the data-frame variable did the trick

```julia
data, header = readdlm("myfile.csv", ',', header= true);
df= DataFrame(data, vec(header));
df_new = identity.( DataFrame(data, vec(header)))

```
