# PyPlot doesn't do anything

**URL:** https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023
**Category:** New to Julia
**Created:** [September 21, 2017, 1:15pm UTC](https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023 "2017-09-21T13:15:22Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![mhartl](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@mhartl](https://discourse.julialang.org/u/mhartl)
#### Post date: [September 21, 2017, 1:15pm UTC](https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023/1 "2017-09-21T13:15:22Z")

</div>

Hello, I’m very new to Julia, I’m exploring it as an alternative to Matlab.

I’m using Windows 10 professional. I sucessfully installed the Packages PyCall, Plots and PyPlot. When I try to make a plot using the pyplots backend from the REPL, it accepts the command, and it looks like it starts working, but nothing happens. I run for example the following code.

```julia
using Plots
pyplot()
x=1:10; y=rand(10);
plot(x,y)

```

Then it stops. The cursor is blinking in the next line and no new line with Julia\> in the beginning appears. Also it does not accept any new inputs.

I have a version of Python installed on my computer and I think I managed to add matplotlib to it.

I’d be glad if someone could make a suggestion what I might be doing wrong. Thanks.

---

<div class="post-metadata">

### Author: ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)
#### Post date: [September 21, 2017, 1:47pm UTC](https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023/2 "2017-09-21T13:47:35Z")

</div>

You’re not doing anything wrong - there must be an error in your setup. It’s possible it has to do with the PyPlot install - an easy way to narrow that down would be to install a different backend, e.g. `Pkg.add("GR")`, then run the same code as above, replacing `pyplot()` with `gr()`.

---

<div class="post-metadata">

### Author: ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)
#### Post date: [September 21, 2017, 2:32pm UTC](https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023/3 "2017-09-21T14:32:33Z")

</div>

What happens if you try [running PyPlot directly](https://github.com/JuliaPy/PyPlot.jl)?

```julia
using PyPlot
x = linspace(0,2*pi,1000); y = sin(3*x + 4*cos(2*x));
plot(x, y, color="red", linewidth=2.0, linestyle="--")

```

---

<div class="post-metadata">

### Author: ![mhartl](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@mhartl](https://discourse.julialang.org/u/mhartl)
#### Post date: [September 21, 2017, 2:43pm UTC](https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023/4 "2017-09-21T14:43:56Z")

</div>

Thanks for the answer. If I do what you suggest, then I get a plot. How would I “fix” my PyPlot install?

I found on the internet that I should try

```julia
`ENV["PYTHON"]=""
Pkg.build("PyPlot")`

```

But still I have the same issue. Also I tried to set `ENV["PYTHON"]` to that path of a Python version that I installed on my computer, and that has matplotlib installed. Then when I try to build the package, I get a message that no global Python version was found.

---

<div class="post-metadata">

### Author: ![mhartl](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@mhartl](https://discourse.julialang.org/u/mhartl)
#### Post date: [September 21, 2017, 2:44pm UTC](https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023/5 "2017-09-21T14:44:33Z")

</div>

It gives the same issue. Nothing happens.

---

<div class="post-metadata">

### Author: ![mhartl](https://avatars.discourse-cdn.com/v4/letter/m/df788c/32.png) [@mhartl](https://discourse.julialang.org/u/mhartl)
#### Post date: [September 21, 2017, 2:51pm UTC](https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023/6 "2017-09-21T14:51:50Z")

</div>

It works now. I tried again setting the path to a Python version I installed and I built all the packages again. I guess it was just a typo in the path the first times. Thanks for your help.

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [September 22, 2017, 12:35pm UTC](https://discourse.julialang.org/t/pyplot-doesnt-do-anything/6023/7 "2017-09-22T12:35:19Z")

</div>

> [@mhartl](#):
>
> I guess it was just a typo in the path the first times

A (more) friendly error message could be added to PyCall.jl in case of that error saying “no Python installed at {your path}”?

PyCall is just an implementation detail to get PyPlot to work (and even many use Plots, not PyPlot directly…) so some newbies might easily miss those details.
