# Error adding PyPlot

**URL:** <https://discourse.julialang.org/t/error-adding-pyplot/22284>\
**Category:** New to Julia\
**Tags:** question, plotting, pyplot\
**Created:** [March 24, 2019, 8:23pm UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284 "2019-03-24T20:23:16Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![maestox](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@maestox](https://discourse.julialang.org/u/maestox)\
**Post date:** [March 24, 2019, 8:23pm UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/1 "2019-03-24T20:23:16Z")

</div>

Hi !

When I execute the first code from this page : [https://julialang.org/downloads/plotting.html](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` `

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 24, 2019, 8:35pm UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/2 "2019-03-24T20:35:26Z")

</div>

Can you post the output of:

```julia
using Pkg
Pkg.status()

```

?

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

---

<div class="post-metadata">

**Author:** ![maestox](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@maestox](https://discourse.julialang.org/u/maestox)\
**Post date:** [March 24, 2019, 8:43pm UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/3 "2019-03-24T20:43:40Z")

</div>

```julia
  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
```

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 27, 2019, 3:47am UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/4 "2019-03-27T03:47:28Z")

</div>

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:

```julia
using Pkg
Pkg.add("Compat")

```

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [March 27, 2019, 4:23am UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/5 "2019-03-27T04:23:17Z")

</div>

> [@rdeits](#):
>
> You may be able to resolve the issue by deleting `~/.julia/packages/Compat` and then re-running:

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

---

<div class="post-metadata">

**Author:** ![maestox](https://avatars.discourse-cdn.com/v4/letter/m/cdc98d/32.png) [@maestox](https://discourse.julialang.org/u/maestox)\
**Post date:** [March 27, 2019, 10:46am UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/6 "2019-03-27T10:46:20Z")

</div>

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 ! =)

---

<div class="post-metadata">

**Author:** ![Ajaychat3](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Post date:** [March 27, 2019, 11:06am UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/7 "2019-03-27T11:06:11Z")

</div>

> [@maestox](#):
>
> 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"]` .

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

---

<div class="post-metadata">

**Author:** ![Paul\_Soderlind](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_soderlind/32/1753_2.png) [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Post date:** [March 27, 2019, 11:23am UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/8 "2019-03-27T11:23:56Z")

</div>

This seems to fixed on Plots#master  
(see [Merge pull request #1956 from daschw/pyplot-update · JuliaPlots/Plots.jl@968b810 · GitHub](https://github.com/JuliaPlots/Plots.jl/commit/968b8109ddf0a0156b4e88211b1912525a1368c0))

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 27, 2019, 12:06pm UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/9 "2019-03-27T12:06:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 27, 2019, 12:07pm UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/10 "2019-03-27T12:07:18Z")

</div>

> [@Ajaychat3](#):
>
> I am also facing this warning. This warnings is appearing in case of skcore.jl line 120 and line 158.

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:

> <https://github.com/cstjean/ScikitLearn.jl/issues/52>
>
> PyCall 1.90.0 is now released, which change \`o\[:foo\]\` and \`o\["foo"\]\` to \`o.foo\` …and \`o."foo"\`, respectively, for python objects \`o\`; see also JuliaPy/PyCall.jl#629.
> 
> The old \`getindex\` methods still work but are deprecated, so you'll want to put out a new release that uses the new methods and REQUIREs PyCall 1.90.0 to avoid having zillions of deprecation messages.

---

<div class="post-metadata">

**Author:** ![Ajaychat3](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Post date:** [March 27, 2019, 12:12pm UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/11 "2019-03-27T12:12:33Z")

</div>

> [@stevengj](#):
>
> Julia packages that use Python via PyCall

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

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 27, 2019, 12:19pm UTC](https://discourse.julialang.org/t/error-adding-pyplot/22284/12 "2019-03-27T12:19:45Z")

</div>

> [@Ajaychat3](#):
>
> Is there any other way to call Python in Julia? I mean other than using PyCall. Apologies if this appears to be silly question.

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.
