julia on windows 11 doesn't deserialize julia serilized file on windows 10 - windows

Julia on windows 11 doesn't deserialize julia serilized file on windows 10.
The file creadted on Julia about 1.7.3 and it's right file.
But if I try deserialize the file on Julia v1.8.5, it made an error.
ERROR: ArgumentError: array must be non-empty
Stacktrace:
[1] pop!
# .\array.jl:1314 [inlined]
[2] deserialize_cycle
[6] handle_deserialize(s::Serializer{IOStream}, b::Int32)
# Serialization C:\Users\adjun\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\Serialization\src\Serialization.jl:919
[7] deserialize
# C:\Users\adjun\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\Serialization\src\Serialization.jl:813 [inlined]
[8] deserialize(s::IOStream)
# Serialization C:\Users\adjun\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\Serialization\src\Serialization.jl:800
[9] open(f::typeof(deserialize), args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
# Base .\io.jl:384
[10] open
# .\io.jl:381 [inlined]
[11] deserialize(filename::String)
# Serialization C:\Users\adjun\AppData\Local\Programs\Julia-1.8.5\share\julia\stdlib\v1.8\Serialization\src\Serialization.jl:810
[12] top-level scope
# d:\OneDrive\catO\다섯\AD 고 2 참\ori_4.jl:1522

https://docs.julialang.org/en/v1/stdlib/Serialization/#Serialization.serialize
In some cases, the word size (32- or 64-bit) of the reading and writing machines must match. In rarer cases the OS or architecture must also match, for example when using packages that contain platform-dependent code.

Related

Get UndefRefError, when step into function

(I asked the same question in the Julia forum, this is the post link, if you are interested)
ubuntu 16.04.5 + julia 0.6.4 + atom 1.41.0 + juno
Hi all, I am new to julia. I try to run and debug the code “test/runtests.jl” from https://github.com/jgorham/SteinDiscrepancy.jl (I mainly want to single-line debug this code and study how it works.)
I have reviewed the relevant documentation, including https://docs.junolab.org/latest/man/debugging/
“test/runtests.jl” can run successfully,
In addition, because juno does not support debugging the non-function file,so I made a small change.
……
……
# Graph Stein discrepancy bounded test
function gsdbt()
res = gsd(points=UNIFORM_TESTDATA[:,1],
gradlogdensity=uniform_gradlogp,
solver=solver,
supportlowerbounds=[0.0],
supportupperbounds=[1.0])
end
At this point it still runs successfully, including the debug mode.
but my purpose is to step into the gsd function(which defined in https://github.com/jgorham/SteinDiscrepancy.jl/blob/master/src/discrepancy/stein_discrepancy.jl)
so i set the breakpoint and Juno.#enter gsdbt() in repl. Then i press “next expression” button until the moment i think can enter this function(as shown below), and i press “step into the function”.The error came out like below.
image 1
julia> Juno.#enter gsdbt()
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] startdebugging(::Array{ASTInterpreter2.JuliaStackFrame,1}) at /home/nick/.julia/v0.6/Atom/src/debugger/stepper.jl:104
[2] macro expansion at /home/nick/.julia/v0.6/Atom/src/repl.jl:118 [inlined]
[3] anonymous at ./<missing>:?
[4] eval(::Module, ::Any) at ./boot.jl:235
[5] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:66
[6] macro expansion at ./REPL.jl:97 [inlined]
[7] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
I want to step into the gsd function, but i got UndefRefError.
How can I solve it? Thank you very much.
——————Here are some weird phenomena that may be helpful to you.——————
Also, i try to enter Juno.#enter gsd()( not gsdbt ), I am surprised that Atom automatically switches out a file(.julia/v0.6/SteingDiscrepancy/src/disvrepancy), But I put this project on the desktop, that means they are two files (although the content is the same).
Then an expected error occurred.
ERROR: Must provide non-empty array of sample points
If i type Juno.#enter gsd(……) in repl, got UndefRefError directly
julia> Juno.#enter gsd(points=UNIFORM_TESTDATA[:,1],gradlogdensity=uniform_gradlogp,solver=solver,supportlowerbounds=[0.0],supportupperbounds=[1.0])
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] lookup_var(::ASTInterpreter2.JuliaStackFrame, ::SSAValue) at /home/nick/.julia/v0.6/ASTInterpreter2/src/interpret.jl:3
[2] evaluate_call(::ASTInterpreter2.JuliaStackFrame, ::Expr) at /home/nick/.julia/v0.6/ASTInterpreter2/src/interpret.jl:32
[3] _step_expr(::ASTInterpreter2.JuliaStackFrame, ::ASTInterpreter2.JuliaProgramCounter) at /home/nick/.julia/v0.6/ASTInterpreter2/src/interpret.jl:87
[4] next_until!(::ASTInterpreter2.##7#8, ::ASTInterpreter2.JuliaStackFrame, ::ASTInterpreter2.JuliaProgramCounter) at /home/nick/.julia/v0.6/ASTInterpreter2/src/interpret.jl:144
[5] maybe_step_through_wrapper!(::Array{ASTInterpreter2.JuliaStackFrame,1}) at /home/nick/.julia/v0.6/ASTInterpreter2/src/ASTInterpreter2.jl:429
[6] macro expansion at /home/nick/.julia/v0.6/Atom/src/repl.jl:118 [inlined]
[7] anonymous at ./<missing>:?
This looks like a bug in the debugger. You can try file a (reproducible) issue at https://github.com/JuliaDebug/JuliaInterpreter.jl (which is the backend for the debugger).

Problem in installing Julia in atom editor, Error: "unknown package Atom"?

My Julia version is 0.6.4. I am facing problem of installing Julia. I had it installing for so long, but all of a sudden julia stopped starting in REPL. Therefore, I deleted the julia and Atom, an trying to reinstall it eversince. Please give me suggestions. Below is the output when I start Julia in REPL:
Hold on tight while we're installing some packages for you.
This should only take a few seconds...
ERROR:LoadError: unknown package Atom
macro expansion at .\pkg\entry.jl:53 [inlined]
(::Base.Pkg.Entry.##1#3{String,Base.Pkg.Types.VersionSet})() at .\task.jl:335
Stacktrace:
[1]
sync_end()
at .\task.jl:287
[2] macro expansion at .\task.jl:303 [inlined]
[3] add(::String, ::Base.Pkg.Types.VersionSet) at .\pkg\entry.jl:51
[4] (::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}})() at .\pkg\dir.jl:36
[5] cd(::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}}, ::String) at .\file.jl:59
[6] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{String,N} where N) at .\pkg\dir.jl:36
[7] add(::String) at .\pkg\pkg.jl:117
[8] include_from_node1(::String) at .\loading.jl:576
[9] include(::String) at .\sysimg.jl:14
[10] process_options(::Base.JLOptions) at .\client.jl:305
[11] _start() at .\client.jl:371
while loading C:\Users\Nitin\.atom\packages\julia-client\script\boot_sync.jl, in expression starting on line 22
Julia has stopped: 1
Have you tried installing Atom directly on your computer? The error lines seems to suggest you tried installing Atom through the Julia package manager Pkg, which would be odd as Atom is a general text editor and not a package ment for usage in Julia.
Also, on related note, any particular reason for using Julia 0.6 instead of the now standard 1.0 branches?

Julia: Cannot install "Pkg" package in Julia

I have a problem with installing the "Pkg" package in Julia.
The following is the error I get after using Pkg.add("Pkg"):
unknown package Pkg
macro expansion at ./pkg/entry.jl:53 [inlined]
(::Base.Pkg.Entry.##1#3{String,Base.Pkg.Types.VersionSet})() at ./task.jl:335
Stacktrace:
[1] sync_end() at ./task.jl:287
[2] macro expansion at ./task.jl:303 [inlined]
[3] add(::String, ::Base.Pkg.Types.VersionSet) at ./pkg/entry.jl:51
[4] (::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}})() at ./pkg/dir.jl:36
[5] cd(::Base.Pkg.Dir.##4#7{Array{Any,1},Base.Pkg.Entry.#add,Tuple{String}}, ::String) at ./file.jl:70
[6] #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{String,N} where N) at ./pkg/dir.jl:36
[7] add(::String) at ./pkg/pkg.jl:117
[8] include_string(::String, ::String) at ./loading.jl:522
Also, it would be great if you tell me how I can find the Package directory of Julia in my mac. I am using Jupyter.
From Julia v0. 7 on, Pkg is a standard library (a package that ships with julia) and doesn't need to be installed. Just do using Pkg and you are good to go.
To your second question, by default you can find everything Julia related in your home folder under ~/.julia.

How do I compile Julia natively for my CPU?

I have installed Julia a while ago and I realized that it used by default a pre-compiled binary. After reading about it, I realized that I could compile it natively using the PackageCompiler module. Indeed, upon loading the module, I get this message:
julia> using PackageCompiler
WARNING: Your Julia system image is not compiled natively for this CPU architecture.
Please run `PackageCompiler.force_native_image!()` for optimal Julia performance
So I proceed with using PackageCompiler.force_native_image!(). However, this gives me this error after some compiling:
julia> PackageCompiler.force_native_image!()
INFO: Copying system image: /home/user/.julia/v0.6/PackageCompiler/sysimg/backup/native/sys.o to /usr/lib/julia/sys.o
ERROR: open: permission denied (EACCES)
Stacktrace:
[1] uv_error at ./libuv.jl:68 [inlined]
[2] open(::String, ::UInt16, ::UInt16) at ./filesystem.jl:81
[3] sendfile(::String, ::String) at ./file.jl:523
[4] #cp#10(::Bool, ::Bool, ::Function, ::String, ::String) at ./file.jl:227
[5] (::Base.Filesystem.#kw##cp)(::Array{Any,1}, ::Base.Filesystem.#cp, ::String, ::String) at ./<missing>:0
[6] copy_system_image(::String, ::String, ::Bool) at /home/user/.julia/v0.6/PackageCompiler/src/PackageCompiler.jl:49
[7] force_native_image!() at /home/user/.julia/v0.6/PackageCompiler/src/api.jl:116
[8] macro expansion at ./REPL.jl:97 [inlined]
[9] (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:73
So basically it's trying to copy something to a root-access-only directory: /usr/lib/.
Coming from Python, I never had issues like that, and when I did it meant I was doing something wrong. So I'm weary of running Julia with sudo and doing the same steps (which I think will solve this issue but possibly create other permission issues down the road).
My question is: what is the right way to do this? Is the right way really running Julia as root?! (The docs weren't helpful at all with this.)

quantstrat_0.10.7 warning message: .updatePosPL / Modifies end results

I was previously using quantsrat_0.9.1739 & blotter_0.9.1741 for some time and it worked fine until I updated them to the latest version 0.10.7 with blotter 0.12.4.
Most of the simulations that I previously wrote throw in the following message:
(This one has been extracted from the demo(macd))
Warning message:
In .updatePosPL(Portfolio = pname, Symbol = as.character(symbol), :
Could not parse ::2018-01-12 as ISO8601 string, or one/bothends of the range were outside the available prices: 2007-01-03/2014-05-30. Using all data instead.
It modifies the end results of nearly 50% of the backtest I generated in the past.
If I go back to the previous version of quantstrat and run the same strategies everything goes back to normal.
I would appreciate if anyone who might have faced the same situation as me could let me know how this problem can be fixed.
Here is more info regarding my session:
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] quantstrat_0.10.7 foreach_1.4.4 blotter_0.12.4
[4] PerformanceAnalytics_1.4.3541 FinancialInstrument_1.3.1 quantmod_0.4-12
[7] TTR_0.23-2 xts_0.10-1 zoo_1.8-1
[10] devtools_1.13.4
loaded via a namespace (and not attached):
[1] codetools_0.2-15 lattice_0.20-35 digest_0.6.13 withr_2.1.1 MASS_7.3-47 grid_3.4.3 R6_2.2.2
[8] git2r_0.21.0 httr_1.3.1 curl_3.1 boot_1.3-20 iterators_1.0.9 tools_3.4.3 compiler_3.4.3
[15] memoise_1.1.0
Thanks in advance for any help you may provide !

Resources