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.
Related
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.
(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).
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?
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.)
See strange behavior in this youtube video
Most of the time I have issues visualizing the preview inline in Rstudio notebook. The problem is that the output of the chunks remains fixed in the screen.
I didnt change the configuration.
Is this a bug or is normal for rstudio notebook?
Additional info
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] tables_0.7.79 Hmisc_4.0-0 Formula_1.2-1 survival_2.40-1 lattice_0.20-33 lubridate_1.5.6 dplyr_0.5.0 purrr_0.2.2 readr_0.2.2
[10] tidyr_0.6.0 tibble_1.2 ggplot2_2.1.0 tidyverse_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.5 formatR_1.4 RColorBrewer_1.1-2 plyr_1.8.4 base64enc_0.1-3 tools_3.2.3 rpart_4.1-10
[8] digest_0.6.9 jsonlite_0.9.22 evaluate_0.9 gtable_0.2.0 htmlTable_1.7 Matrix_1.2-6 DBI_0.4-1
[15] yaml_2.1.13 gridExtra_2.2.1 stringr_1.0.0 knitr_1.14 cluster_2.0.4 grid_3.2.3 nnet_7.3-12
[22] data.table_1.9.6 R6_2.1.2 rmarkdown_1.1 foreign_0.8-66 latticeExtra_0.6-28 magrittr_1.5 scales_0.4.0
[29] htmltools_0.3.5 splines_3.2.3 rsconnect_0.5 assertthat_0.1 colorspace_1.2-6 labeling_0.3 stringi_1.1.1
[36] acepack_1.3-3.3 lazyeval_0.2.0 munsell_0.4.3 chron_2.3-47