Error adding PyPlot

question
plotting
pyplot
#1

Hi !

When I execute the first code from this page : https://julialang.org/downloads/plotting.html , i get thie error message. Can you help me ? Because I get this error message on adding lots of packages

Updating registry at `~/.julia/registries/General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
Installed Requires ─────────── v0.5.2
Installed PlotUtils ────────── v0.5.5
Installed OrderedCollections ─ v1.0.2
Installed Plots ────────────── v0.23.2
Installed Contour ──────────── v0.5.1
Installed DataStructures ───── v0.15.0
Installed GR ───────────────── v0.38.1
Installed StatsBase ────────── v0.29.0
Installed RecipesBase ──────── v0.6.0
Installed SortingAlgorithms ── v0.3.1
Installed Missings ─────────── v0.4.0
Installed PlotThemes ───────── v0.3.0
Installed Measures ─────────── v0.3.0
Installed Showoff ──────────── v0.2.1
Installed StaticArrays ─────── v0.10.3
Updating `~/.julia/environments/v1.1/Project.toml`
[91a5bcdd] + Plots v0.23.2
Updating `~/.julia/environments/v1.1/Manifest.toml`
[d38c429a] + Contour v0.5.1
[864edb3b] + DataStructures v0.15.0
[28b8d3ca] + GR v0.38.1
[442fdcdd] + Measures v0.3.0
[e1d29d7a] + Missings v0.4.0
[bac558e1] + OrderedCollections v1.0.2
[ccf2f8ad] + PlotThemes v0.3.0
[995b91a9] + PlotUtils v0.5.5
[91a5bcdd] + Plots v0.23.2
[3cdcf5f2] + RecipesBase v0.6.0
[ae029012] + Requires v0.5.2
[992d4aef] + Showoff v0.2.1
[a2af1166] + SortingAlgorithms v0.3.1
[90137ffa] + StaticArrays v0.10.3
[2913bbd2] + StatsBase v0.29.0
Building GR ───→ `~/.julia/packages/GR/IVBgs/deps/build.log`
Building Plots → `~/.julia/packages/Plots/QYETN/deps/build.log`
ERROR: LoadError: syntax: incomplete: premature end of input
Stacktrace:
[1] top-level scope at none:2
in expression starting at /home/louis/.julia/packages/Compat/HiX6E/src/Compat.jl:3
ERROR: LoadError: Failed to precompile Compat [34da2185-b29b-5c13-b0c7-acf172513d20]
to /home/louis/.julia/compiled/v1.1/Compat/GSFWK.ji.
Stacktrace:
[1] top-level scope at none:2
in expression starting at /home/louis/.julia/packages/Showoff/0KxsS/src/Showoff.jl:5
ERROR: LoadError: Failed to precompile Showoff [992d4aef-0814-514b-bc4d-f2e9a6c4116f] to /home/louis/.julia/compiled/v1.1/Showoff/vyYkR.ji.
Stacktrace:
[1] top-level scope at none:2
in expression starting at /home/louis/.julia/packages/Plots/QYETN/src/Plots.jl:16
ERROR: LoadError: Failed to precompile Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80] to /home/louis/.julia/compiled/v1.1/Plots/ld3vC.ji.
in expression starting at /home/louis/Dokumentoj/dev/jul/test_plot.jl:3`

#2

Can you post the output of:

using Pkg
Pkg.status()

?

That will help us figure out what’s going on.

#3
  julia> Pkg.status()
  Status `~/.julia/environments/v1.1/Project.toml`
  [34da2185] Compat v2.0.0
  [8f4d0f93] Conda v1.2.0
  [4c0ca9eb] Gtk v0.16.5
  [91a5bcdd] Plots v0.23.2
  [438e738f] PyCall v1.91.0
#4

Hm, that all looks fine. From your original post, it looks like something is wrong with the source code of the Compat.jl package–did you edit that by hand at some point? You may be able to resolve the issue by deleting ~/.julia/packages/Compat and then re-running:

using Pkg
Pkg.add("Compat")
#5

So if you just add Compat without deleting then what would happen ?

#6

Sorry for the answer time.

I’ve deleted and then readded Compat. The adding has worked right, and I relaunch julia test_plot.jl which is the program whose code is in the link I’ve given above, and … I get an error (after at least one minute) telling me that I have to rebuild Conda. I’ve done, and I do same for PyPlot and Plots.
And now, that takes really long time to run, but I get this warning message :

┌ Warning: getindex(o::PyObject, s::AbstractString) is deprecated in favor of dot overloading (getproperty) so elements should now be accessed as e.g. o."s" instead of o["s"].
│ caller = top-level scope at none:0
└ @ Core none:0

but that seems working right. But now, when I run this :

julia> using Plots
julia> plotly()
Plots.PlotlyBackend()
julia> plot(rand(5,5),linewidth=2,title="MyPlot")

That plots nothing, what did I do wrong ?

And, I’ve a question : using Plots takes long time (between two and ten seconds), is it normal ?

Thanks for all replies ! =)

#7

I am also facing this warning. This warnings is appearing in case of skcore.jl line 120 and line 158.

#8

This seems to fixed on Plots#master
(see https://github.com/JuliaPlots/Plots.jl/commit/968b8109ddf0a0156b4e88211b1912525a1368c0)

1 Like
#9

If you use the GR backend by running gr() instead of plotly() is there any difference?

And yes, the slow start-up for plots is unfortunate but expected. There is a lot of work being done now on tools like PackageCompiler to improve the situation, but it’s not a fully solved problem yet.

#10

There was a recent update in the PyCall API — a bunch of Julia packages that use Python via PyCall will see deprecation warnings for a little while until they are updated. Plots.jl was just fixed, but SciKitLearn has not been updated yet:

#11

Is there any other way to call Python in Julia? I mean other than using PyCall. Apologies if this appears to be silly question.

#12

Well, you could run the python executable through a pipe. For example, the IJulia package can launch the Python jupyter notebook program, and used to require jupyter command-line program to build in order to get the Jupyter version and install the kernel specification file, but it never used PyCall.