I'm new to Julia programming and am trying to install the Plots package; this should be rather simple but it has not been so. Every time I try to do it I get the following error message:
ERROR: Pkg.TOML.ParserError(2, 2, "expected a key but found an empty string")
The only code I have run prior to the Pkg.add("Plots") line is import Pkg, so I can't picture how this problem would come about.
Additional information: I'm working on Julia 1.5.4 and running it through the Juno IDE via Atom v1.55.0. Here is the (potentially very uninformative) entire stack trace below:
Stacktrace:
[1] parse(::Base.GenericIOBuffer{Array{UInt8,1}}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\ext\TOML\src\TOML.jl:37
[2] parsefile at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\ext\TOML\src\TOML.jl:50 [inlined]
[3] #parse_toml#10 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:154 [inlined]
[4] parse_toml at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:153 [inlined]
[5] #load_artifacts_toml#18 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Artifacts.jl:471 [inlined]
[6] ensure_all_artifacts_installed(::String; platform::Pkg.BinaryPlatforms.Platform, pkg_uuid::Nothing, include_lazy::Bool, verbose::Bool, quiet_download::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Artifacts.jl:948
[7] download_artifacts(::Pkg.Types.Context, ::Array{String,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Operations.jl:663
[8] download_artifacts(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Operations.jl:642
[9] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Operations.jl:1141
[10] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:188
[11] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:139
[12] #add#21 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:67 [inlined]
[13] add at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:67 [inlined]
[14] #add#20 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:66 [inlined]
[15] add at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:66 [inlined]
[16] add(::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:65
[17] add(::String) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:65
[18] top-level scope at none:1
Here is the project.TOML file that was there originally.
[deps]
Atom = "c52e3926-4ff0-5f6e-af25-54175e0327b1"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Juno = "e5e0dc1b-0480-54bc-9374-aad01c23163d"
PDMats = "90014a1f-27ba-587c-ab20-58faa44d9150"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
When I renamed it project.toml.backup per request, and tried installing again, it still failed, with the same error message, but a different (longer) stack trace.
Stacktrace:
[1] parse(::Base.GenericIOBuffer{Array{UInt8,1}}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\ext\TOML\src\TOML.jl:37
[2] parsefile at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\ext\TOML\src\TOML.jl:50 [inlined]
[3] #parse_toml#10 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:154 [inlined]
[4] parse_toml at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:153 [inlined]
[5] #load_artifacts_toml#18 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Artifacts.jl:471 [inlined]
[6] ensure_all_artifacts_installed(::String; platform::Pkg.BinaryPlatforms.Platform, pkg_uuid::Nothing, include_lazy::Bool, verbose::Bool, quiet_download::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Artifacts.jl:948
[7] download_artifacts(::Pkg.Types.Context, ::Array{String,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Operations.jl:663
[8] download_artifacts(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; platform::Pkg.BinaryPlatforms.Windows, verbose::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Operations.jl:642
[9] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\Operations.jl:1141
[10] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:188
[11] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:139
[12] #add#21 at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:67 [inlined]
[13] add(::Array{Pkg.Types.PackageSpec,1}) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:67
[14] do_cmd!(::Pkg.REPLMode.Command, ::REPL.LineEditREPL) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\REPLMode\REPLMode.jl:404
[15] do_cmd(::REPL.LineEditREPL, ::String; do_rethrow::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\REPLMode\REPLMode.jl:382
[16] do_cmd at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\REPLMode\REPLMode.jl:377 [inlined]
[17] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\Pkg\src\REPLMode\REPLMode.jl:546
[18] (::Atom.var"#4#15"{Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL,REPL.LineEdit.Prompt}})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at C:\Users\pthom\.julia\packages\Atom\BPtI0\src\Atom.jl:31 [19] #invokelatest#1 at .\essentials.jl:710 [inlined]
[20] invokelatest at .\essentials.jl:709 [inlined]
[21] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\REPL\src\LineEdit.jl:2355
[22] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.5\REPL\src\REPL.jl:1144
[23] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at .\task.jl:356
Let me know if I've omitted any information or if anyone has any ideas. Thanks very much.
Related
I tried using Julia 1.7.3 kernel with Jupiter lab and VS code but had no luck. I got the following error in the console when I clicked on the run in the Jupiter lab cell. I have installed ipykernel and added IJulia to Pkg. I don't think the problem is in that.
in expression starting at /home/rohit/.julia/packages/IJulia/AQu2H/src/kernel.jl:1
[I 2022-11-15 10:54:57.314 ServerApp] AsyncIOLoopKernelRestarter: restarting kernel (1/5), new random ports
[ Info: Precompiling IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a]
ERROR: LoadError: ArgumentError: Package Parsers does not have SnoopPrecompile in its dependencies:
- If you have Parsers checked out for development and have
added SnoopPrecompile 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 Parsers
Stacktrace:
[1] require(into::Module, mod::Symbol)
# Base ./loading.jl:980
[2] include(mod::Module, _path::String)
# Base ./Base.jl:418
[3] include(x::String)
# Parsers ~/.julia/packages/Parsers/bEa0b/src/Parsers.jl:1
[4] top-level scope
# ~/.julia/packages/Parsers/bEa0b/src/Parsers.jl:393
[5] include
# ./Base.jl:418 [inlined]
[6] 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
[7] top-level scope
# none:1
[8] eval
# ./boot.jl:373 [inlined]
[9] eval(x::Expr)
# Base.MainInclude ./client.jl:453
[10] top-level scope
# none:1
in expression starting at /home/rohit/.julia/packages/Parsers/bEa0b/src/precompile.jl:1
in expression starting at /home/rohit/.julia/packages/Parsers/bEa0b/src/Parsers.jl:1
ERROR: LoadError: Failed to precompile Parsers [69de0a69-1ddd-5017-9359-2bf0b02dc9f0] to /home/rohit/.julia/compiled/v1.7/Parsers/jl_7qWIcC.
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(mod::Module, _path::String)
# Base ./Base.jl:418
[8] include(x::String)
# JSON ~/.julia/packages/JSON/NeJ9k/src/JSON.jl:3
[9] top-level scope
# ~/.julia/packages/JSON/NeJ9k/src/JSON.jl:11
[10] include
# ./Base.jl:418 [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::String)
# Base ./loading.jl:1318
[12] top-level scope
# none:1
[13] eval
# ./boot.jl:373 [inlined]
[14] eval(x::Expr)
# Base.MainInclude ./client.jl:453
[15] top-level scope
# none:1
in expression starting at /home/rohit/.julia/packages/JSON/NeJ9k/src/Parser.jl:1
in expression starting at /home/rohit/.julia/packages/JSON/NeJ9k/src/JSON.jl:3
ERROR: LoadError: Failed to precompile JSON [682c06a0-de6a-54ab-a142-c8b1cf79cde6] to /home/rohit/.julia/compiled/v1.7/JSON/jl_CxGVlg.
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::String)
# 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 /home/rohit/.julia/packages/IJulia/AQu2H/src/IJulia.jl:1
ERROR: LoadError: Failed to precompile IJulia [7073ff75-c697-5162-941a-fcdaad2a7d2a] to /home/rohit/.julia/compiled/v1.7/IJulia/jl_f8oPcc.
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)
In VS code, nothing happens when I run it and I see no error.
The reasons might differ, depends on what you're using (conda, etc.). I recently installed Julia 1.8.2 on Ubuntu and it opens with jupyter via the following procedure (I had Jupyter installed on my laptop):
using Pkg
Pkg.add(“IJulia”)
using IJulia
installkernel("Julia")
If you have not-a-Linux machine (I suspect it is Mac), I strongly recommend to check these answers:
Julia's website and one more
Post from Stackoverflow and this one
Good luck!
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'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...
I am trying to do optimisation using Flux's logitbinarycrossentropy function on a fully-convolutional network on GPU:
Flux.train!(loss, params(UNet_model), train_batch, optimiser)
Where loss is defined as:
loss(x, y) = mean(logitbinarycrossentropy.(model(x) |> gpu, y))
However, I'm getting a ERROR: LoadError: scalar getindex is disallowed error. I have verified that my model runs correctly (returns right output, etc), and that the loss function is able to compute a value. I tried rewriting logitbinarycrossentropy as a custom loss function but it still fails with the same error in the line update!(opt, ps, gs). I also tried using σ with binarycrossentropy instead of logitbinarycrossentropy, and got the same error.
I am using Julia 1.3.0, Flux 0.10.3, Zygote 0.4.6.
I speculate that this might have something to do with my use of cat in the model definition, is this likely? Here is roughly how I defined my model:
function (t::test)(x)
enc1 = t.conv_block1[1](x)
bn = t.bottle(enc1)
dec1 = t.upconv_block[1](bn)
dec1 = cat(dims=3, dec1, enc1)
dec1 = t.conv_block[2](dec1)
dec1 = t.conv(dec1)
end
Full stacktrace:
ERROR: LoadError: scalar getindex is disallowed
Stacktrace:
[1] error(::String) at .\error.jl:33
[2] assertscalar(::String) at C:\Users\CCL\.julia\packages\GPUArrays\1wgPO\src\indexing.jl:14
[3] getindex at C:\Users\CCL\.julia\packages\GPUArrays\1wgPO\src\indexing.jl:54 [inlined]
[4] _getindex at .\abstractarray.jl:1004 [inlined]
[5] getindex at .\abstractarray.jl:981 [inlined]
[6] hash(::CuArray{Float32,4,Nothing}, ::UInt64) at .\abstractarray.jl:2203
[7] hash at .\hashing.jl:18 [inlined]
[8] hashindex at .\dict.jl:168 [inlined]
[9] ht_keyindex(::Dict{Any,Any}, ::CuArray{Float32,4,Nothing}) at .\dict.jl:282
[10] get(::Dict{Any,Any}, ::CuArray{Float32,4,Nothing}, ::Nothing) at .\dict.jl:500
[11] (::Zygote.var"#876#877"{Zygote.Context,IdDict{Any,Any},CuArray{Float32,4,Nothing}})(::Nothing) at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\lib\base.jl:44
[12] (::Zygote.var"#2375#back#878"{Zygote.var"#876#877"{Zygote.Context,IdDict{Any,Any},CuArray{Float32,4,Nothing}}})(::Nothing) at C:\Users\CCL\.julia\packages\ZygoteRules\6nssF\src\adjoint.jl:49
[13] #fmap#53 at C:\Users\CCL\.julia\packages\Flux\NpkMm\src\functor.jl:37 [inlined]
[14] (::typeof(∂(#fmap#53)))(::CuArray{Float32,4,Nothing}) at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\compiler\interface2.jl:0
[15] fmap at C:\Users\CCL\.julia\packages\Flux\NpkMm\src\functor.jl:36 [inlined]
[16] (::typeof(∂(fmap)))(::CuArray{Float32,4,Nothing}) at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\compiler\interface2.jl:0
[17] gpu at C:\Users\CCL\.julia\packages\Flux\NpkMm\src\functor.jl:108 [inlined]
[18] (::typeof(∂(gpu)))(::CuArray{Float32,4,Nothing}) at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\compiler\interface2.jl:0
[19] |> at .\operators.jl:854 [inlined]
[20] (::typeof(∂(|>)))(::CuArray{Float32,4,Nothing}) at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\compiler\interface2.jl:0
[21] (::typeof(∂(loss)))(::Float32) at C:\Users\CCL\fcn\main_flux2.jl:47
[22] #157 at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\lib\lib.jl:156 [inlined]
[23] #297#back at C:\Users\CCL\.julia\packages\ZygoteRules\6nssF\src\adjoint.jl:49 [inlined]
[24] #17 at C:\Users\CCL\.julia\packages\Flux\NpkMm\src\optimise\train.jl:88 [inlined]
[25] (::typeof(∂(λ)))(::Float32) at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\compiler\interface2.jl:0
[26] (::Zygote.var"#38#39"{Zygote.Params,Zygote.Context,typeof(∂(λ))})(::Float32) at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\compiler\interface.jl:101
[27] gradient(::Function, ::Zygote.Params) at C:\Users\CCL\.julia\packages\Zygote\oMScO\src\compiler\interface.jl:47
[28] macro expansion at C:\Users\CCL\.julia\packages\Flux\NpkMm\src\optimise\train.jl:87 [inlined]
[29] macro expansion at C:\Users\CCL\.julia\packages\Juno\f8hj2\src\progress.jl:134 [inlined]
[30] #train!#12(::Flux.Optimise.var"#18#26", ::typeof(Flux.Optimise.train!), ::typeof(loss), ::Zygote.Params, ::Array{Tuple{CuArray{Float32,4,Nothing},CuArray{Float32,4,Nothing}},1}, ::ADAM) at C:\Users\CCL\.julia\packages\Flux\NpkMm\src\optimise\train.jl:80
[31] train!(::Function, ::Zygote.Params, ::Array{Tuple{CuArray{Float32,4,Nothing},CuArray{Float32,4,Nothing}},1}, ::ADAM) at C:\Users\CCL\.julia\packages\Flux\NpkMm\src\optimise\train.jl:78
[32] top-level scope at C:\Users\CCL\fcn\main_flux2.jl:83
[33] include at .\boot.jl:328 [inlined]
[34] include_relative(::Module, ::String) at .\loading.jl:1105
[35] include(::Module, ::String) at .\Base.jl:31
[36] exec_options(::Base.JLOptions) at .\client.jl:287
[37] _start() at .\client.jl:460
in expression starting at C:\Users\CCL\fcn\main_flux2.jl:74
Thanks!
Objective: To get installed package particulars using status command of Pkg module
Procedure:
$ julia
julia> ]
(v1.1) pkg> status
Output:
ERROR: Pkg.TOML.ParserError(258, 263, "duplicate key `Dates`")
Stacktrace:
[1] parse(::IOStream) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/ext/TOML/src/TOML.jl:33
[2] #open#310(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::typeof(Pkg.TOML.parse), ::String, ::Vararg{String,N} where N) at ./iostream.jl:369
[3] open at ./iostream.jl:367 [inlined]
[4] parsefile(::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/ext/TOML/src/TOML.jl:46
[5] load_stdlib() at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:338
[6] Pkg.Types.Context() at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:347
[7] Context!(::Array{Pair{Symbol,Any},1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:368
[8] Context! at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:526 [inlined]
[9] do_status!(::Dict{Symbol,Any}, ::Array{Pkg.Types.PackageSpec,1}, ::Dict{Symbol,Any}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:603
[10] #invokelatest#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:742
[11] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:741
[12] do_cmd!(::Pkg.REPLMode.PkgCommand, ::REPL.LineEditREPL) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:561
[13] #do_cmd#30(::Bool, ::Function, ::REPL.LineEditREPL, ::String) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:536
[14] do_cmd at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:532 [inlined]
[15] (::getfield(Pkg.REPLMode, Symbol("##48#51")){REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/REPLMode.jl:967
[16] #invokelatest#1 at ./essentials.jl:742 [inlined]
[17] invokelatest at ./essentials.jl:741 [inlined]
[18] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2273
[19] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:1035
[20] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:192
[21] (::getfield(Base, Symbol("##734#736")){Bool,Bool,Bool,Bool})(::Module) at ./client.jl:362
[22] #invokelatest#1 at ./essentials.jl:742 [inlined]
[23] invokelatest at ./essentials.jl:741 [inlined]
[24] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:346
[25] exec_options(::Base.JLOptions) at ./client.jl:284
[26] _start() at ./client.jl:436
Observation:
Dates and its dependent packages have only one uuid as follows:
Contents of "/opt/julia/julia-1.1.0/share/julia/stdlib/v1.1/Dates/Project.toml"
name = "Dates"
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
...
and for its dependent packages:
Content of "/opt/julia/julia-1.1.0/share/julia/stdlib/v1.1/<PACKAGE_NAME>/Project.toml"
...
[deps]
...
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
...
Please help me in resolving the duplicate key issue of Pkg!