Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV fails to compile #981

Closed
nilshg opened this issue Feb 17, 2022 · 17 comments · Fixed by #986
Closed

CSV fails to compile #981

nilshg opened this issue Feb 17, 2022 · 17 comments · Fixed by #986

Comments

@nilshg
Copy link

nilshg commented Feb 17, 2022

Quite a few people have reported this recently:

Failed to precompile CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b] to C:\Users\ngudat\.julia\compiled\v1.7\CSV\jl_C39B.tmp.

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

(there's a discussion on Slack where three people are seeing it, and a Discourse discussion here [note the discussion initially is about the old Parsers issue, but further down people are reporting this new issue).

Unfortunately it's hard to reproduce because it appears it is generally solved by doing either ] build CSV or just repeatedly calling using CSV.

@chenweichen
Copy link

chenweichen commented Feb 17, 2022

I got the same problem here.
The following is my error message:

      Status `C:\Users\m1749\.julia\environments\v1.7_csv\Project.toml` (empty project)

(@v1.7_csv) pkg> add CSV
    Updating registry at `C:\Users\m1749\.julia\registries\General`
    Updating git-repo `https://github.com/JuliaRegistries/General.git`
   Resolving package versions...
   Installed CSV ─ v0.10.2
    Updating `C:\Users\m1749\.julia\environments\v1.7_csv\Project.toml`
  [336ed68f] + CSV v0.10.2
    Updating `C:\Users\m1749\.julia\environments\v1.7_csv\Manifest.toml`
  [336ed68f] + CSV v0.10.2
  [944b1d66] + CodecZlib v0.7.0
  [34da2185] + Compat v3.41.0
  [9a962f9c] + DataAPI v1.9.0
  [e2d170a0] + DataValueInterfaces v1.0.0
  [48062228] + FilePathsBase v0.9.17
  [842dd82b] + InlineStrings v1.1.2
  [82899510] + IteratorInterfaceExtensions v1.0.0
  [69de0a69] + Parsers v2.2.2
  [2dfb63ee] + PooledArrays v1.4.0
  [91c51154] + SentinelArrays v1.3.12
  [3783bdb8] + TableTraits v1.0.1
  [bd369af6] + Tables v1.6.1
  [3bb67fe8] + TranscodingStreams v0.9.6
  [ea10d353] + WeakRefStrings v1.4.1
  [0dad84c5] + ArgTools
  [56f22d72] + Artifacts
  [2a0f44e3] + Base64
  [ade2ca70] + Dates
  [8bb1440f] + DelimitedFiles
  [8ba89e20] + Distributed     
  [f43a241f] + Downloads       
  [9fa8497b] + Future
  [b77e0a4c] + InteractiveUtils
  [b27032c2] + LibCURL
  [76f85450] + LibGit2
  [8f399da3] + Libdl
  [37e2e46d] + LinearAlgebra   
  [56ddb016] + Logging
  [d6f4376e] + Markdown        
  [a63ad114] + Mmap
  [ca575930] + NetworkOptions  
  [44cfe95a] + Pkg
  [de0858da] + Printf
  [3fa0cd96] + REPL
  [9a3f8284] + Random
  [ea8e919c] + SHA
  [9e88b42a] + Serialization
  [1a1011a3] + SharedArrays
  [6462fe0b] + Sockets
  [2f01184e] + SparseArrays
  [10745b16] + Statistics
  [fa267f1f] + TOML
  [a4e569a6] + Tar
  [8dfed614] + Test
  [cf7118a7] + UUIDs
  [4ec0a83e] + Unicode
  [e66e0078] + CompilerSupportLibraries_jll
  [deac9b47] + LibCURL_jll
  [29816b5a] + LibSSH2_jll
  [c8ffd9c3] + MbedTLS_jll
  [14a3606d] + MozillaCACerts_jll
  [4536629a] + OpenBLAS_jll
  [83775a58] + Zlib_jll
  [8e850b90] + libblastrampoline_jll
  [8e850ede] + nghttp2_jll
  [3f19e933] + p7zip_jll
Precompiling project...
  ✗ CSV
  0 dependencies successfully precompiled in 6 seconds (20 already precompiled)
  1 dependency errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the package

(@v1.7_csv) pkg> st
      Status `C:\Users\m1749\.julia\environments\v1.7_csv\Project.toml`
  [336ed68f] CSV v0.10.2

julia> using CSV
[ Info: Precompiling CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b]
ERROR: Failed to precompile CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b] to C:\Users\m1749\.julia\compiled\v1.7\CSV\jl_80B1.tmp.
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] eval
    @ .\Base.jl:68 [inlined]
  [9] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer c:\Users\m1749\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:157
 [10] (::VSCodeServer.var"#71#73"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer c:\Users\m1749\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:123
 [11] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:511
 [12] with_logger
    @ .\logging.jl:623 [inlined]
 [13] (::VSCodeServer.var"#70#72"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer c:\Users\m1749\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:124
 [14] #invokelatest#2
    @ .\essentials.jl:716 [inlined]
 [15] invokelatest(::Any)
    @ Base .\essentials.jl:714
 [16] macro expansion
    @ c:\Users\m1749\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
 [17] (::VSCodeServer.var"#55#56")()
    @ VSCodeServer .\task.jl:423"

and my version information is

`julia> versioninfo()
Julia Version 1.7.2
Commit bf53498635 (2022-02-06 15:21 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 4

@DvHerwerden
Copy link

We are currently giving a statistics course where we are using Julia and we are seeing a trend that people that are using Windows 11 are running into an error with precompiling the CSV package. I am not sure if this is also the case for your computers?

@nilshg
Copy link
Author

nilshg commented Feb 17, 2022

What's the stacktrace? Would be good to know if it's the same.

FWIW I'm on Windows 10,

@DvHerwerden
Copy link

[ Info: Precompiling CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b]
ERROR: Failed to precompile CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b] to C:\Users\karin.julia\compiled\v1.7\CSV\jl_F9C9.tmp.
Stacktrace:
[1] error(s::String)
[6] require(into::Module, mod::Symbol)
@ Base .\loading.jl:997

@nilshg
Copy link
Author

nilshg commented Feb 17, 2022

Thanks, looks like it's the same thing then! Does repeatedly calling using CSV solve it?

@DvHerwerden
Copy link

When I try that the following shows up everytime:

20220217_110806

@el-oso
Copy link

el-oso commented Feb 17, 2022

I had the same, I just kept insisting on using CSV until it worked

@DvHerwerden
Copy link

After running using CSV at least 60 times the issue still persists

@davnn
Copy link

davnn commented Feb 17, 2022

The ccall in https://github.com/JuliaData/CSV.jl/blob/main/src/precompile.jl#L3 is breaking precompilation, don't know why, yet.
Dev the package and comment out that line if you want a quick fix.

Edit: Coincidence? 🤷‍♂️

@Song921012
Copy link

After adding parsers@2.2.0 and pining Parsers, CSV can be precompiled.

@chenweichen
Copy link

After adding parsers@2.2.0 and pining Parsers, CSV can be precompiled.

Following your suggestion, CSV can be precompiled successfully.
Thank you.

@RobbieMackenzie
Copy link

Hi all,

Can confirm I've seen this too, though the file mentioned is different. Scripts with using CSV were working fine yesterday, although I've package-added ImplicitPlots since then. I followed @Song921012 's advice by doing
] add Parsers@2.2.0
] pin Parsers

Which worked once I re-started Julia. The stacktrace I had been getting was: -

julia> using CSV
[ Info: Precompiling CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b]
ERROR: Failed to precompile CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b] to C:\Users\gm12172.julia\compiled\v1.5\CSV\HHBkp_BN1zX.ji.
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] compilecache(::Base.PkgId, ::String) at .\loading.jl:1305
[3] _require(::Base.PkgId) at .\loading.jl:1030
[4] require(::Base.PkgId) at .\loading.jl:928
[5] require(::Module, ::Symbol) at .\loading.jl:923
[6] eval at .\boot.jl:331 [inlined]
[7] eval at .\Base.jl:39 [inlined]
[8] repleval(::Module, ::Expr, ::String) at c:\Users\gm12172.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:157
[9] (::VSCodeServer.var"#69#71"{Module,Expr,REPL.LineEditREPL,REPL.LineEdit.Prompt})() at c:\Users\gm12172.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:123
[10] with_logstate(::Function, ::Any) at .\logging.jl:408
[11] with_logger at .\logging.jl:514 [inlined]
[12] (::VSCodeServer.var"#68#70"{Module,Expr,REPL.LineEditREPL,REPL.LineEdit.Prompt})() at c:\Users\gm12172.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:124
[13] #invokelatest#1 at .\essentials.jl:710 [inlined]
[14] invokelatest(::Any) at .\essentials.jl:709
[15] macro expansion at c:\Users\gm12172.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
[16] (::VSCodeServer.var"#53#54")() at .\task.jl:356

@niclasmattsson
Copy link

Same problem here on my Windows system, triggered when Parsers updated from v2.2.0 to v2.2.2. And the same fix worked for me except that I did it by fixing the version of Parsers in Project.toml:

[compat]
Parsers = "=2.2.0"

If you can't find the root of the problem I think you should consider tagging a quick release of CSV.jl that constrains the Parsers version in a similar way. Many people seem to be having this issue and CSV.jl is pretty important in Julia's ecosystem.

@nickrobinson251
Copy link
Collaborator

nickrobinson251 commented Mar 2, 2022

Parsers.jl v2.2.2 did change what gets called during precompilation, so that could well be related
JuliaData/Parsers.jl@v2.2.1...v2.2.2 (cc @rafaqz)

it might be helpful to know if anyone sees this issue on v2.2.1

@rafaqz
Copy link

rafaqz commented Mar 2, 2022

From the random/hard to reproduce nature of this my guess would be a memory problem on Windows, especially with reports that using a terminal instead if vscode/atom fixes it?

I imagine the combination of Parsers.jl and CSV.jl precompilation would use a lot of memory.

We should probably rewrite those Parsers.jl functions and Context here to decrease the overheads, instead of brute forcing it with precompilation.

These functions are sometimes 100s of lines each with too much type instability.

@niclasmattsson
Copy link

niclasmattsson commented Mar 2, 2022

For what it's worth, I had the problem while running Julia inside Windows Terminal. I didn't try it in VScode.

@dawbarton
Copy link
Contributor

Does anyone know if this is Julia version specific? I'm getting this problem in VSCode on v1.7.1 and v1.7.2. It's quite annoying since not only does precompilation not work in VSCode, I also see random (what I assume are) segfaults when loading large-ish CSV files. All seems to work fine in Windows Terminal but when I connect it to VSCode as an external REPL, the language server frequently dies.

quinnj added a commit to JuliaData/Parsers.jl that referenced this issue Mar 6, 2022
Diagnosed to be causing CSV.jl precompile to fail on windows for an
unknown reason (JuliaData/CSV.jl#981).
Removing the precompiles for now until further investigation can be done
to figure out the root cause.
quinnj added a commit that referenced this issue Mar 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.