# simple example using Plots following with warnings and an error

**URL:** <https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244>\
**Category:** Visualization\
**Created:** [May 29, 2018, 5:25pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244 "2018-05-29T17:25:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carsten](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Post date:** [May 29, 2018, 5:25pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/1 "2018-05-29T17:25:34Z")

</div>

I am using Julia 0.6.2 (Windows) and the Atom editor

After launching Julia and

```julia
using Plots

```

I’ve got the following warnings:

```julia
WARNING: using Plots.savefig in module Main conflicts with an existing identifier.
WARNING: using Plots.quiver in module Main conflicts with an existing identifier.
WARNING: using Plots.pie in module Main conflicts with an existing identifier.
WARNING: using Plots.barh in module Main conflicts with an existing identifier.
WARNING: using Plots.grid in module Main conflicts with an existing identifier.
WARNING: using Plots.contourf in module Main conflicts with an existing identifier.
WARNING: using Plots.plot in module Main conflicts with an existing identifier.
WARNING: using Plots.spy in module Main conflicts with an existing identifier.
WARNING: using Plots.hexbin in module Main conflicts with an existing identifier.
WARNING: using Plots.scatter in module Main conflicts with an existing identifier.
WARNING: using Plots.bar in module Main conflicts with an existing identifier.
WARNING: using Plots.arrow in module Main conflicts with an existing identifier.
WARNING: using Plots.contour in module Main conflicts with an existing identifier.
WARNING: using Plots.twinx in module Main conflicts with an existing identifier.
WARNING: using Plots.text in module Main conflicts with an existing identifier.
WARNING: using Plots.boxplot in module Main conflicts with an existing identifier.

```

In a next step I applied the following two lines:

```julia
x = 1:10; y = rand(10,2)
plot(x,y,title="Two Lines",label=["Line 1" "Line 2"],lw=3)

```

and I’ve got the error message:

```julia
PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, kw)) <class 'AttributeError'>

```

What is wrong? Is the PyError related to the above warnings? And how can I overcome these difficulties?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 29, 2018, 5:34pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/2 "2018-05-29T17:34:32Z")

</div>

Did you `using PyPlot`? That would cause such issues since now you’d have a bunch of duplicated plot commands.

---

<div class="post-metadata">

**Author:** ![Carsten](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Post date:** [May 29, 2018, 5:57pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/3 "2018-05-29T17:57:06Z")

</div>

thanks for the prompt reply.  
No, I am applied`using Plots`. And how can I get rid of the duplicated commands?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 29, 2018, 6:03pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/4 "2018-05-29T18:03:52Z")

</div>

Those duplications are because you loaded some other plotting library. PyError likely because it was PyPlot. If you only load Plots.jl then this wouldn’t happen.

---

<div class="post-metadata">

**Author:** ![Carsten](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Post date:** [May 29, 2018, 6:14pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/5 "2018-05-29T18:14:13Z")

</div>

I started a fresh Julia session. Within this session the only the module Plots was loaded. Still my question is how to get rid of the duplicated commands?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 29, 2018, 6:35pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/6 "2018-05-29T18:35:57Z")

</div>

What’s in your `.juliarc` file?

> [@Carsten](#):
>
> I started a fresh Julia session. Within this session the only the module Plots was loaded. Still my question is how to get rid of the duplicated commands?

You cannot get rid of the duplicated commands until we know where they are coming from. `using Plots` only runs once, so that’s not what it is. Plots.jl doesn’t have these duplications internally, so in fresh installations with a fresh Julia session this doesn’t pop up. We need to find out what `plot` commands are added to your environment and causing this. The `PyError` is really telling because it would only happen if you had some PyCall package and Plots.jl does not come with PyCall, so there is another source here and I cannot debug what’s going on until I know what that is.

---

<div class="post-metadata">

**Author:** ![Carsten](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Post date:** [May 29, 2018, 6:44pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/7 "2018-05-29T18:44:43Z")

</div>

> [@ChrisRackauckas](#):
>
> juliarc

You are right:

Here is my `juliarc`:

# Set up environment for Julia Windows binary distribution

```julia-auto
ENV["PATH"] = JULIA_HOME*";"*ENV["PATH"]

```

# c:\Users\Carsten\AppData\Local\Julia-0.6.2\etc\julia\juliarc.jl

```julia-auto
if isdir(Pkg.dir("PyPlot"))
    @eval using PyPlot
else
    warn("PyPlot not installed")
end 

```

My question now  
how should I change the above lines if I want to use the package **Plots**

Thanks again for your remarks and the help.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 29, 2018, 6:45pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/8 "2018-05-29T18:45:53Z")

</div>

You’ll need to comment out

```julia
if isdir(Pkg.dir("PyPlot"))
    @eval using PyPlot
else
    warn("PyPlot not installed")
end 

```

---

<div class="post-metadata">

**Author:** ![Carsten](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Carsten](https://discourse.julialang.org/u/Carsten)\
**Post date:** [May 29, 2018, 7:04pm UTC](https://discourse.julialang.org/t/simple-example-using-plots-following-with-warnings-and-an-error/11244/9 "2018-05-29T19:04:12Z")

</div>

It works.  
Thank you for your assistance.
