I have just started to use Julia a few days back.
While trying to plot, I am getting the following error:
using Plots
x = 1:10; y = rand(10); # These are the plotting data
plot(x, y)
ERROR:
UndefVarError: Grisu not defined
Stacktrace:
[1] getproperty
# .\Base.jl:26 [inlined]
[2] plain_precision_heuristic(xs::Vector{Float64})
# Showoff C:\Users\Administrator\.julia\packages\Showoff\RaPxi\src\Showoff.jl:84
[3] showoff(xs::Vector{Float64}, style::Symbol)
# Showoff C:\Users\Administrator\.julia\packages\Showoff\RaPxi\src\Showoff.jl:117
[4] optimal_ticks_and_labels(sp::Plots.Subplot{Plots.GRBackend}, axis::Plots.Axis, ticks::Nothing)
# Plots C:\Users\Administrator\.julia\packages\Plots\5srrj\src\axes.jl:187
[5] optimal_ticks_and_labels
# C:\Users\Administrator\.julia\packages\Plots\5srrj\src\axes.jl:128 [inlined]
[6] get_ticks(sp::Plots.Subplot{Plots.GRBackend}, axis::Plots.Axis)
# Plots C:\Users\Administrator\.julia\packages\Plots\5srrj\src\axes.jl:238
[7] _update_min_padding!(sp::Plots.Subplot{Plots.GRBackend})
# Plots C:\Users\Administrator\.julia\packages\Plots\5srrj\src\backends\gr.jl:890
[8] iterate
# .\generator.jl:47 [inlined]
[9] _collect(c::Matrix{AbstractLayout}, itr::Base.Generator{Matrix{AbstractLayout},
typeof(Plots._update_min_padding!)}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{2})
# Base .\array.jl:691
[10] collect_similar
# .\array.jl:606 [inlined]
[11] map
# .\abstractarray.jl:2294 [inlined]
[12] _update_min_padding!(layout::Plots.GridLayout)
# Plots C:\Users\Administrator\.julia\packages\Plots\5srrj\src\layouts.jl:310
[13] prepare_output(plt::Plots.Plot{Plots.GRBackend})
# Plots C:\Users\Administrator\.julia\packages\Plots\5srrj\src\plot.jl:184
[14] show(io::Base64.Base64EncodePipe, m::MIME{Symbol("image/png")},
plt::Plots.Plot{Plots.GRBackend})
# Plots C:\Users\Administrator\.julia\packages\Plots\5srrj\src\output.jl:214
[15] base64encode(::Function, ::MIME{Symbol("image/png")}, ::Vararg{Any, N} where N;
context::Nothing)
# Base64
C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Base64\src\encode.jl:209
[16] base64encode
# C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Base64\src\encode.jl:206
[inlined]
[17] _ijulia_display_dict(plt::Plots.Plot{Plots.GRBackend})
# Plots C:\Users\Administrator\.julia\packages\Plots\5srrj\src\ijulia.jl:50
[18] display_dict(plt::Plots.Plot{Plots.GRBackend})
# Plots C:\Users\Administrator\.julia\packages\Plots\5srrj\src\init.jl:81
[19] #invokelatest#2
# .\essentials.jl:708 [inlined]
[20] invokelatest
# .\essentials.jl:706 [inlined]
[21] execute_request(socket::ZMQ.Socket, msg::IJulia.Msg)
# IJulia C:\Users\Administrator\.julia\packages\IJulia\e8kqU\src\execute_request.jl:112
[22] #invokelatest#2
# .\essentials.jl:708 [inlined]
[23] invokelatest
# .\essentials.jl:706 [inlined]
[24] eventloop(socket::ZMQ.Socket)
# IJulia C:\Users\Administrator\.julia\packages\IJulia\e8kqU\src\eventloop.jl:8
[25] (::IJulia.var"#15#18")()
# IJulia .\task.jl:411
Googles it for a few hours. Saw some similar queries but couldn't find a satisfactory solution. Have got both Plot and Grisu packages installed.
Following up on some of the conversation in the comments, the correct steps to resolve this would be:
# Type "]" to enter the package manager and then
remove plots
add plots
which should resolve this issue.
apparently Grisu was removed from Julia base after Julia 1.6. However, some older packages might still refer to it, so you need to add the now stand-alone Grisu package if you need to use older package versions.
https://juliahub.com/ui/Packages/Grisu/T2ZVU
Pkg.add("Grisu")
if isdefined(Base, :Grisu)
import Base.Grisu
else
import Grisu
end
Related
After I excute Pkg.precompile(), the REPL return the information like following:
julia> using Pkg
julia> Pkg.precompile()
Precompiling project...
✗ GR
✗ Plots
0 dependencies successfully precompiled in 40 seconds (130 already precompiled)
ERROR: The following 1 direct dependency failed to precompile:
Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to C:\Users\Administrator\.julia\compiled\v1.6\Plots\jl_DB20.tmp.
ERROR: LoadError: ArgumentError: not a path: \`C:\Users\Administrator\.julia\packages\GR\xhzFJ\deps\deps.jl\`
ERROR: LoadError: ArgumentError: not a path: `C:\Users\Administrator\.julia\packages\GR\xhzFJ\deps\deps.jl`
Stacktrace:
[1] RelocatableFolders.Path(mod::Module, dir::String, path::String)
# RelocatableFolders C:\Users\Administrator\.julia\packages\RelocatableFolders\PYUl8\src\RelocatableFolders.jl:51
[2] top-level scope
# C:\Users\Administrator\.julia\packages\GR\xhzFJ\src\GR.jl:36
[3] include
# .\Base.jl:384 [inlined]
[4] 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::String)
# Base .\loading.jl:1235
[5] top-level scope
# none:1
[6] eval
# .\boot.jl:360 [inlined]
[7] eval(x::Expr)
# Base.MainInclude .\client.jl:446
[8] top-level scope
# none:1
in expression starting at C:\Users\Administrator\.julia\packages\GR\xhzFJ\src\GR.jl:2
ERROR: LoadError: LoadError: Failed to precompile GR [28b8d3ca-fb5f-59d9-8090-bfdbd6d07a71] to C:\Users\Administrator\.julia\compiled\v1.6\GR\jl_B11E.tmp.
Stacktrace:
[1] error(s::String)
# Base .\error.jl:33
[2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IOContext{Base.PipeEndpoint}, internal_stdout::IOContext{IOStream}, 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] include(mod::Module, _path::String)
# Base .\Base.jl:384
[8] include(x::String)
# Plots C:\Users\Administrator\.julia\packages\Plots\E2187\src\Plots.jl:1
[9] top-level scope
# C:\Users\Administrator\.julia\packages\Plots\E2187\src\Plots.jl:227
[10] include
# .\Base.jl:384 [inlined]
[11] 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
[12] top-level scope
# none:1
[13] eval
# .\boot.jl:360 [inlined]
[14] eval(x::Expr)
# Base.MainInclude .\client.jl:446
[15] top-level scope
# none:1
in expression starting at C:\Users\Administrator\.julia\packages\Plots\E2187\src\backends\gr.jl:6
in expression starting at C:\Users\Administrator\.julia\packages\Plots\E2187\src\Plots.jl:1
Stacktrace:
[1] pkgerror(msg::String)
# Pkg.Types C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\Types.jl:55
[2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, warn_loaded::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
# Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:1265
[3] precompile
# C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:921 [inlined]
[4] #precompile#196
# C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:919 [inlined]
[5] precompile()
# Pkg.API C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\Pkg\src\API.jl:919
[6] top-level scope
# REPL[2]:1
Please help me!
More details:
Microsoft Windows [10.0.17763.2803]
Julia Version 1.6.6 (2022-03-28). Julia is installed by the installer downloaded from https://julialang.org/downloads/
I am a postgraduate majoring in physics. I am interested in computing and programming. From my classmates the julia lang is a programming language facing futrue because of its advanced programming philosophy. However, what I did not expect is that I meet the problem I can not resolve so soon. (This paragraph is for the prompt "Most is code, please add more details")
I do not even know what have happened till now. However I find the solution for my question and I have succeed in resolving it. Having excute Pkg.add("Plots"), just excute the following codes:
using Pkg
Pkg.add("GR")
Pkg.build("GR")
Pkg.precompile()
The answer is from here
I am encountering an error on Julia while trying to install and use Distributions module. I am not facing any errors while installing the module but it displays this error when I try to use the Distributions module. I have no idea what this PDMats or Manifest files are. I'd love to have some advice. Thanks!
This is the entire error:
julia> using Distributions
│ Package Distributions not found, but a package named Distributions is available from a registry.
│ Install package?
│ (#v1.7) pkg> add Distributions
└ (y/n) [y]: y
Updating registry at `C:\Users\rajaissacsamuel.k\.julia\registries\General.toml`
Resolving package versions...
Updating `C:\Users\rajaissacsamuel.k\.julia\environments\v1.7\Project.toml`
[31c24e10] + Distributions v0.21.12
No Changes to `C:\Users\rajaissacsamuel.k\.julia\environments\v1.7\Manifest.toml`
[ Info: Precompiling Distributions [31c24e10-a181-5473-b8eb-7969acd0382f]
ERROR: LoadError: ArgumentError: Package PDMats does not have IterativeEigensolvers in its dependencies:
- If you have PDMats checked out for development and have
added IterativeEigensolvers as a dependency but haven't updated your primary
environment's manifest file, try `Pkg.resolve()`.
- Otherwise you may need to report an issue with PDMats
Stacktrace:
[1] require(into::Module, mod::Symbol)
# Base .\loading.jl:980
[2] include
# .\Base.jl:418 [inlined]
[3] 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::String)
# Base .\loading.jl:1318
[4] top-level scope
# none:1
[5] eval
# .\boot.jl:373 [inlined]
[6] eval(x::Expr)
# Base.MainInclude .\client.jl:453
[7] top-level scope
# none:1
in expression starting at C:\Users\rajaissacsamuel.k\.julia\packages\PDMats\jTYWO\src\PDMats.jl:3
ERROR: LoadError: Failed to precompile PDMats [90014a1f-27ba-587c-ab20-58faa44d9150] to C:\Users\rajaissacsamuel.k\.julia\compiled\v1.7\PDMats\jl_565F.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] include
# .\Base.jl:418 [inlined]
[8] 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:1318
[9] top-level scope
# none:1
[10] eval
# .\boot.jl:373 [inlined]
[11] eval(x::Expr)
# Base.MainInclude .\client.jl:453
[12] top-level scope
# none:1
in expression starting at C:\Users\rajaissacsamuel.k\.julia\packages\Distributions\KjaXI\src\Distributions.jl:1
ERROR: Failed to precompile Distributions [31c24e10-a181-5473-b8eb-7969acd0382f] to C:\Users\rajaissacsamuel.k\.julia\compiled\v1.7\Distributions\jl_52F6.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\rajaissacsamuel.k\.vscode\extensions\julialang.language-julia-1.6.17\scripts\packages\VSCodeServer\src\repl.jl:157
[10] (::VSCodeServer.var"#78#80"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
# VSCodeServer c:\Users\rajaissacsamuel.k\.vscode\extensions\julialang.language-julia-1.6.17\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"#77#79"{Module, Expr, REPL.LineEditREPL, REPL.LineEdit.Prompt})()
# VSCodeServer c:\Users\rajaissacsamuel.k\.vscode\extensions\julialang.language-julia-1.6.17\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\rajaissacsamuel.k\.vscode\extensions\julialang.language-julia-1.6.17\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
[17] (::VSCodeServer.var"#60#61")()
# VSCodeServer .\task.jl:423
try Pkg.resolve() or Pkg.update(), if that fails try resetting the Julia registry
I want to install Julia in my jupyter notebook. I am getting this. I am not able to find what means the reference to 'no active Project'. Any help will be very welcomed. Thanks
julia> using Pkg
julia> Pkg.add("IJulia")
ERROR: no active project
Stacktrace:
[1] pkgerror(msg::String)
# Pkg.Types C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\Types.jl:68
[2] find_project_file(env::Nothing)
# Pkg.Types C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\Types.jl:200
[3] Pkg.Types.EnvCache(env::Nothing) (repeats 2 times)
# Pkg.Types C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\Types.jl:319
[4] Pkg.Types.Context()
# Pkg.Types .\util.jl:478
[5] add(pkgs::Vector{Pkg.Types.PackageSpec}; io::Base.TTY, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
# Pkg.API C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:145
[6] add(pkgs::Vector{Pkg.Types.PackageSpec})
# Pkg.API C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:144
[7] #add#27
# C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:142 [inlined]
[8] add
# C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:142 [inlined]
[9] #add#26
# C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:141 [inlined]
[10] add(pkg::String)
# Pkg.API C:\Users\madel\Julia-1.7.2\share\julia\stdlib\v1.7\Pkg\src\API.jl:141
[11] top-level scope
# REPL[36]:1
julia>
I tried to add a new environment user path as JULIA_HOME to the following route:
C:\Users\madel\Julia-1.7.2\bin and works now. It seems like I was not pointing the right path.
I am experiencing slightly strange behaviour from a visualisation routine I have written using Plots.jl. The module I have written uses code of the following form (with some irrelevant details removed). It is intended to produce a 2D animation of the results of a 2D partial differential equation.
anim = #animate for (i,u) in enumerate(sol.u)
heatmap(u)
end
gif(anim,"output/anim_u.gif",fps=5)
If I run my program with this code at the end, the program hangs indefinitely after opening a "gksqt" application in the dock. Killing the program produces the following stacktrace.
Stacktrace:
[1] poptask(W::Base.InvasiveLinkedListSynchronized{Task})
# Base ./task.jl:760
[2] wait
# ./task.jl:768 [inlined]
[3] wait(c::Base.GenericCondition{Base.Threads.SpinLock})
# Base ./condition.jl:106
[4] wait(x::Base.Process)
# Base ./process.jl:621
[5] success
# ./process.jl:483 [inlined]
[6] run(::Cmd; wait::Bool)
# Base ./process.jl:440
[7] run
# ./process.jl:438 [inlined]
[8] (::FFMPEG.var"#4#6"{Cmd})(command_path::String)
# FFMPEG ~/.julia/packages/FFMPEG/OUpap/src/FFMPEG.jl:112
[9] (::JLLWrappers.var"#2#3"{FFMPEG.var"#4#6"{Cmd}, String})()
# JLLWrappers ~/.julia/packages/JLLWrappers/bkwIo/src/runtime.jl:49
[10] withenv(::JLLWrappers.var"#2#3"{FFMPEG.var"#4#6"{Cmd}, String}, ::Pair{String, String}, ::Vararg{Pair{String, String}, N} where N)
# Base ./env.jl:161
[11] withenv_executable_wrapper(f::Function, executable_path::String, PATH::String, LIBPATH::String, adjust_PATH::Bool, adjust_LIBPATH::Bool)
# JLLWrappers ~/.julia/packages/JLLWrappers/bkwIo/src/runtime.jl:48
[12] #invokelatest#2
# ./essentials.jl:708 [inlined]
[13] invokelatest
# ./essentials.jl:706 [inlined]
[14] #ffmpeg#7
# ~/.julia/packages/JLLWrappers/bkwIo/src/products/executable_generators.jl:7 [inlined]
[15] ffmpeg
# ~/.julia/packages/JLLWrappers/bkwIo/src/products/executable_generators.jl:7 [inlined]
[16] #exe#2
# ~/.julia/packages/FFMPEG/OUpap/src/FFMPEG.jl:111 [inlined]
[17] ffmpeg_exe
# ~/.julia/packages/FFMPEG/OUpap/src/FFMPEG.jl:123 [inlined]
[18] buildanimation(anim::Plots.Animation, fn::String, is_animated_gif::Bool; fps::Int64, loop::Int64, variable_palette::Bool, verbose::Bool, show_msg::Bool)
# Plots ~/.julia/packages/Plots/S2aH5/src/animation.jl:96
I am completely baffled by this behaviour - if anyone has any suggestions it would be greatly appreciated.
Running on MacOS 11.2.3 with Julia 1.6.2.
I'm trying to create a POMDP model and solve it. But during the solving process, I get this error:
Got exception outside of a #test
UndefRefError: access to undefined reference
Stacktrace:
[1] getindex
# ./array.jl:801 [inlined]
[2] iterate
# ./array.jl:777 [inlined]
[3] iterate
# ./iterators.jl:159 [inlined]
[4] write(io::IOStream, pomdp::AccPOMDP)
# POMDPFiles ~/.julia/packages/POMDPFiles/vOfxh/src/write.jl:64
[5] #3
# ~/.julia/packages/POMDPSolve/LzAMF/src/solver.jl:175 [inlined]
[6] open(::POMDPSolve.var"#3#4"{AccPOMDP}, ::String, ::Vararg{String, N} where N; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
# Base ./io.jl:330
[7] open
# ./io.jl:328 [inlined]
[8] solve(solver::POMDPSolveSolver, pomdp::AccPOMDP)
# POMDPSolve ~/.julia/packages/POMDPSolve/LzAMF/src/solver.jl:174
[9] macro expansion
# ~/jl/acc/acc_dev.jl:556 [inlined]
[10] macro expansion
# /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Test/src/Test.jl:1151 [inlined]
[11] top-level scope
# ~/jl/acc/acc_dev.jl:546
[12] include(mod::Module, _path::String)
# Base ./Base.jl:386
[13] exec_options(opts::Base.JLOptions)
# Base ./client.jl:285
[14] _start()
# Base ./client.jl:485
I'm not so familiar with the Julia Stacktrace, so could you please help me fix this problem?
Caused by stateindex(...) and states(...) wrong implementation in my POMDP model. But after I fix this ans start to solve the problem, the solving just kept run and finally failed. Just want to complain, Julia POMDP is really hard to use in reality...