3

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.

  • Do you get the same error when you install it via the REPL? So type `]` (your prompt should change to `(@v1.5) pkg>`) and then just `add Plots`. – Jonas Mar 20 '21 at 08:35
  • yes, unfortunately even when I type `]` and then just `add Plots` I still get the error. – Peter Thompson Mar 20 '21 at 19:31
  • Could you post your Project.toml file? You can find the location `pkg> status`, based on theParseError I would expect something weird/corrupted on the second line. You could try to rename your `Project.toml` to `Project.toml.backup` and then try again. Julia will then generate a new one if you add packages. – Jonas Mar 20 '21 at 20:08
  • I edited my original message - it has the Project.toml there now. I renamed it and tried again, and it still doesn't work but gives a different stack trace now. My guess for this is that there was no TOML file generated (when I type `status` again it gives the same directory but say `(Empty project)` in parentheses. I can install any other package I want (e.g., Colors that was already there) and even after that installing Plots yields the second stacktrace now (there is now a TOML file that's been generated). – Peter Thompson Mar 21 '21 at 02:52
  • Is this just about the Plots Package, or does it appear as well when you try to install other packages? – Wouter Mar 22 '21 at 02:48
  • Only Plots - everything else installs and works perfectly. – Peter Thompson Mar 22 '21 at 04:12
  • If possible, you can try to use Julia 1.6, which should include the file location and line number triggering the error – David Sainez Mar 25 '21 at 15:14

0 Answers0