JuliaIO / JLD2.jl

HDF5-compatible file format in pure Julia
Other
560 stars 92 forks source link

unable to precompile JLD2 (Windows 7 - Julia 1.6.5) #383

Closed Drachta closed 2 years ago

Drachta commented 2 years ago

Hello,

I'm having trouble using JLD2. It seems to complain about a permission on a temp file during precompile, but running Julia command prompt as admin didn't solve the issue.

I'm not sure what else I can try to solve this issue.

julia> using JLD2
[ Info: Precompiling JLD2 [033835bb-8acc-5ee8-8aae-3f567f8a3819]
┌ Error: mktemp cleanup
│   exception =
│    IOError: unlink("C:\\Users\\Etudiant\\AppData\\Local\\Temp\\jl_2605.tmp"): resource busy or locked (EBUSY)
│    Stacktrace:
│      [1] uv_error
│        @ .\libuv.jl:97 [inlined]
│      [2] unlink(p::String)
│        @ Base.Filesystem .\file.jl:934
│      [3] rm(path::String; force::Bool, recursive::Bool)
│        @ Base.Filesystem .\file.jl:272
│      [4] rm
│        @ .\file.jl:263 [inlined]
│      [5] mktemp(fn::JLD2.var"#81#85", parent::String)
│        @ Base.Filesystem .\file.jl:707
│      [6] mktemp(fn::Function)
│        @ Base.Filesystem .\file.jl:701
│      [7] top-level scope
│        @ C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\precompile.jl:2
│      [8] include(mod::Module, _path::String)
│        @ Base .\Base.jl:384
│      [9] include
│        @ C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\JLD2.jl:1 [inlined]
│     [10] top-level scope
│        @ C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\JLD2.jl:539
│     [11] include
│        @ .\Base.jl:384 [inlined]
│     [12] 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:1235
│     [13] top-level scope
│        @ none:1
│     [14] eval
│        @ .\boot.jl:360 [inlined]
│     [15] eval(x::Expr)
│        @ Base.MainInclude .\client.jl:446
│     [16] top-level scope
│        @ none:1
│     [17] eval
│        @ .\boot.jl:360 [inlined]
│     [18] exec_options(opts::Base.JLOptions)
│        @ Base .\client.jl:261
│     [19] _start()
│        @ Base .\client.jl:485
└ @ Base.Filesystem file.jl:709
ERROR: LoadError: LoadError: IOError: realpath("C:\\Users\\Etudiant\\AppData\\Local\\Temp\\jl_2605.tmp"): resource busy or locked (EBUSY)
Stacktrace:
  [1] uv_error
    @ .\libuv.jl:97 [inlined]
  [2] realpath(path::String)
    @ Base.Filesystem .\path.jl:448
  [3] jldopen(fname::String, wr::Bool, create::Bool, truncate::Bool, iotype::Type{JLD2.MmapIO}; fallback::Type{IOStream}, compress::Bool, mmaparrays::Bool, typemap::Dict{String, Any})
    @ JLD2 C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\JLD2.jl:292
  [4] jldopen(fname::String, mode::String; iotype::Type, kwargs::Base.Iterators.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:compress,), Tuple{Bool}}})
    @ JLD2 C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\JLD2.jl:356
  [5] jldopen(::Function, ::String, ::Vararg{String, N} where N; kws::Base.Iterators.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:compress, :iotype), Tuple{Bool, DataType}}})
    @ JLD2 C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\loadsave.jl:2
  [6] #jldsave#49
    @ C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\loadsave.jl:243 [inlined]
  [7] (::JLD2.var"#81#85")(path::String, #unused#::IOStream)
    @ JLD2 C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\precompile.jl:14
  [8] mktemp(fn::JLD2.var"#81#85", parent::String)
    @ Base.Filesystem .\file.jl:703
  [9] mktemp(fn::Function)
    @ Base.Filesystem .\file.jl:701
 [10] top-level scope
    @ C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\precompile.jl:2
 [11] include(mod::Module, _path::String)
    @ Base .\Base.jl:384
 [12] include
    @ C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\JLD2.jl:1 [inlined]
 [13] top-level scope
    @ C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\JLD2.jl:539
 [14] include
    @ .\Base.jl:384 [inlined]
 [15] 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:1235
 [16] top-level scope
    @ none:1
 [17] eval
    @ .\boot.jl:360 [inlined]
 [18] eval(x::Expr)
    @ Base.MainInclude .\client.jl:446
 [19] top-level scope
    @ none:1
in expression starting at C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\precompile.jl:1
in expression starting at C:\Users\Etudiant\.julia\packages\JLD2\MXv8x\src\JLD2.jl:1
┌ Warning: temp cleanup
│   exception =
│    IOError: unlink("C:\\Users\\Etudiant\\AppData\\Local\\Temp\\jl_2605.tmp"): permission denied (EACCES)
│    Stacktrace:
│     [1] uv_error
│       @ .\libuv.jl:97 [inlined]
│     [2] unlink(p::String)
│       @ Base.Filesystem .\file.jl:934
│     [3] rm(path::String; force::Bool, recursive::Bool)
│       @ Base.Filesystem .\file.jl:272
│     [4] temp_cleanup_purge(; force::Bool)
│       @ Base.Filesystem .\file.jl:518
│     [5] (::Base.var"#786#787")()
│       @ Base .\initdefs.jl:322
│     [6] _atexit()
│       @ Base .\initdefs.jl:343
│     [7] exit
│       @ .\initdefs.jl:28 [inlined]
│     [8] _start()
│       @ Base .\client.jl:488
└ @ Base.Filesystem file.jl:522
ERROR: Failed to precompile JLD2 [033835bb-8acc-5ee8-8aae-3f567f8a3819] to C:\Users\Etudiant\.julia\compiled\v1.6\JLD2\jl_187E.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] eval
    @ .\Base.jl:39 [inlined]
  [9] repleval(m::Module, code::Expr, #unused#::String)
    @ VSCodeServer c:\Users\Etudiant\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:157
 [10] (::VSCodeServer.var"#69#71"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer c:\Users\Etudiant\.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:491
 [12] with_logger
    @ .\logging.jl:603 [inlined]
 [13] (::VSCodeServer.var"#68#70"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
    @ VSCodeServer c:\Users\Etudiant\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\repl.jl:124
 [14] #invokelatest#2
    @ .\essentials.jl:708 [inlined]
 [15] invokelatest(::Any)
    @ Base .\essentials.jl:706
 [16] macro expansion
    @ c:\Users\Etudiant\.vscode\extensions\julialang.language-julia-1.5.11\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
 [17] (::VSCodeServer.var"#53#54")()
    @ VSCodeServer .\task.jl:411
JonasIsensee commented 2 years ago

Hi @Drachta, thanks for reporting this. Does this happen every time?

It looks very similar to this: https://github.com/JuliaLang/julia/issues/39457

Drachta commented 2 years ago

Yes, it happens every time. I tried to restart my computer just in case, but it still happens. It seems I also have the same problem with version 1.7.2 of Julia.

I can delete the temporary file from within windows explorer without any popup saying that the file is used somewhere.

Is there any folder / files I can remove so I can start from a fresh envirronement ? Or reinstalling Julia is enough ?

EDIT: after reinstalling Julia and deleting the folder: C:\Users\Etudiant\.julia, the issue persists. Other packages seem to work fine. JLD2 is installed as a dependency and its target version is 0.4.21

JonasIsensee commented 2 years ago

The error sadly has little to do with JLD2 - only that JLD2 uses mktempdir during precompilation. This was introduced in JLD2 v0.4.20 for better performance. 0.4.19 shouldn't have this issue.

Drachta commented 2 years ago

@JonasIsensee Thank you very much! It works with version 0.4.19.

kagalenko-m-b commented 1 year ago

This issue prevents me from installing the latest version on Windows7

julia> versioninfo() Julia Version 1.9.2 Commit e4ee485e90 (2023-07-05 09:39 UTC) Platform Info: OS: Windows (x86_64-w64-mingw32) CPU: 4 × Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-14.0.6 (ORCJIT, ivybridge) Threads: 1 on 4 virtual cores Environment: JULIA_IMAGE_THREADS = 1

julia> using JLD2 [ Info: Precompiling JLD2 [033835bb-8acc-5ee8-8aae-3f567f8a3819] ┌ Error: mktemp cleanup │ exception = │ IOError: unlink("C:\Users\kmb\AppData\Local\Temp\jl_2127.tmp"): resou rce busy or locked (EBUSY) │ Stacktrace: │ [1] uv_error │ @ .\libuv.jl:100 [inlined] │ [2] unlink(p::String) │ @ Base.Filesystem .\file.jl:972 │ [3] rm(path::String; force::Bool, recursive::Bool) │ @ Base.Filesystem .\file.jl:283 │ [4] rm │ @ .\file.jl:273 [inlined] │ [5] mktemp(fn::JLD2.var"#121#125", parent::String) │ @ Base.Filesystem .\file.jl:736 │ [6] mktemp(fn::Function) │ @ Base.Filesystem .\file.jl:730 │ [7] top-level scope │ @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\precompile.jl:2 │ [8] include(mod::Module, _path::String) │ @ Base .\Base.jl:457 │ [9] include │ @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\JLD2.jl:1 [inlined] │ [10] top-level scope │ @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\JLD2.jl:616 │ [11] include │ @ .\Base.jl:457 [inlined] │ [12] include_package_for_output(pkg::Base.PkgId, input::String, depot_path ::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concr ete_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing) │ @ Base .\loading.jl:2049 │ [13] top-level scope │ @ stdin:3 │ [14] eval │ @ .\boot.jl:370 [inlined] │ [15] include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) │ @ Base .\loading.jl:1903 │ [16] include_string │ @ .\loading.jl:1913 [inlined] │ [17] exec_options(opts::Base.JLOptions) │ @ Base .\client.jl:305 │ [18] _start() │ @ Base .\client.jl:522 └ @ Base.Filesystem file.jl:738 ERROR: LoadError: IOError: realpath("C:\Users\kmb\AppData\Local\Temp\jl_21 27.tmp"): resource busy or locked (EBUSY) Stacktrace: [1] uv_error @ .\libuv.jl:100 [inlined] [2] realpath(path::String) @ Base.Filesystem .\path.jl:487 [3] jldopen(fname::String, wr::Bool, create::Bool, truncate::Bool, iotype::Typ e{JLD2.MmapIO}; fallback::Type{IOStream}, compress::Bool, mmaparrays::Bool, type map::Dict{String, Any}, parallel_read::Bool) @ JLD2 C:\Users\kmb.julia\packages\JLD2\cHcDY\src\JLD2.jl:357 [4] jldopen(fname::String, mode::String; iotype::Type, kwargs::Base.Pairs{Symb ol, Bool, Tuple{Symbol}, NamedTuple{(:compress,), Tuple{Bool}}}) @ JLD2 C:\Users\kmb.julia\packages\JLD2\cHcDY\src\JLD2.jl:439 [5] jldopen(::Function, ::String, ::Vararg{String}; kws::Base.Pairs{Symbol, An y, Tuple{Symbol, Symbol}, NamedTuple{(:compress, :iotype), Tuple{Bool, DataType} }}) @ JLD2 C:\Users\kmb.julia\packages\JLD2\cHcDY\src\loadsave.jl:2 [6] jldopen @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\loadsave.jl:1 [inlined] [7] #jldsave#81 @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\loadsave.jl:243 [inlined] [8] jldsave (repeats 2 times) @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\loadsave.jl:240 [inlined] [9] (::JLD2.var"#121#125")(path::String, #unused#::IOStream) @ JLD2 C:\Users\kmb.julia\packages\JLD2\cHcDY\src\precompile.jl:14 [10] mktemp(fn::JLD2.var"#121#125", parent::String) @ Base.Filesystem .\file.jl:732 [11] mktemp(fn::Function) @ Base.Filesystem .\file.jl:730 [12] top-level scope @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\precompile.jl:2 [13] include(mod::Module, _path::String) @ Base .\Base.jl:457 [14] include @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\JLD2.jl:1 [inlined] [15] top-level scope @ C:\Users\kmb.julia\packages\JLD2\cHcDY\src\JLD2.jl:616 [16] include @ .\Base.jl:457 [inlined] [17] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vec tor{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_d eps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing) @ Base .\loading.jl:2049 [18] top-level scope @ stdin:3 in expression starting at C:\Users\kmb.julia\packages\JLD2\cHcDY\src\precompile .jl:1 in expression starting at C:\Users\kmb.julia\packages\JLD2\cHcDY\src\JLD2.jl:1 in expression starting at stdin:3 ┌ Warning: temp cleanup │ exception = │ IOError: unlink("C:\Users\kmb\AppData\Local\Temp\jl_2127.tmp"): permi ssion denied (EACCES) │ Stacktrace: │ [1] uv_error │ @ .\libuv.jl:100 [inlined] │ [2] unlink(p::String) │ @ Base.Filesystem .\file.jl:972 │ [3] rm(path::String; force::Bool, recursive::Bool) │ @ Base.Filesystem .\file.jl:283 │ [4] rm │ @ .\file.jl:273 [inlined] │ [5] temp_cleanup_purge(; force::Bool) │ @ Base.Filesystem .\file.jl:543 │ [6] temp_cleanup_purge │ @ .\file.jl:535 [inlined] │ [7] (::Base.var"#930#931")() │ @ Base .\initdefs.jl:354 │ [8] _atexit(exitcode::Int32) │ @ Base .\initdefs.jl:416 │ [9] exit │ @ .\initdefs.jl:28 [inlined] │ [10] exec_options(opts::Base.JLOptions) │ @ Base .\client.jl:312 │ [11] _start() │ @ Base .\client.jl:522 └ @ Base.Filesystem file.jl:547 ERROR: Failed to precompile JLD2 [033835bb-8acc-5ee8-8aae-3f567f8a3819] to "C:\ Users\kmb\.julia\compiled\v1.9\JLD2\jl_F81D.tmp". Stacktrace: [1] error(s::String) @ Base .\error.jl:35 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_s tdout::IO, keep_loaded_modules::Bool) @ Base .\loading.jl:2300 [3] compilecache @ .\loading.jl:2167 [inlined] [4] _require(pkg::Base.PkgId, env::String) @ Base .\loading.jl:1805 [5] _require_prelocked(uuidkey::Base.PkgId, env::String) @ Base .\loading.jl:1660 [6] macro expansion @ .\loading.jl:1648 [inlined] [7] macro expansion @ .\lock.jl:267 [inlined] [8] require(into::Module, mod::Symbol) @ Base .\loading.jl:1611

mkitti commented 11 months ago

See https://github.com/JuliaLang/julia/issues/47730#issuecomment-1826388212

HongBinYu-hub commented 11 months ago

Hello, this problem may be caused by the jldopen() function under win7 being unable to write. Under win7, iotype = IOStream is required to write. It is likely that this problem causes the precompilation to fail under win7.

mkitti commented 11 months ago

Both users here are showing problems with unlink. That is Julia is unable to remove the temporary files.