# Error in using PyPlot - windows

**URL:** https://discourse.julialang.org/t/error-in-using-pyplot-windows/6614
**Category:** General Usage
**Created:** [October 22, 2017, 6:08pm UTC](https://discourse.julialang.org/t/error-in-using-pyplot-windows/6614 "2017-10-22T18:08:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)
#### Post date: [October 22, 2017, 6:08pm UTC](https://discourse.julialang.org/t/error-in-using-pyplot-windows/6614/1 "2017-10-22T18:08:28Z")

</div>

can anyone nows how to solve this ? in windows 10 x64

julia\> using PyPlot  
sys:1: UserWarning:  
This call to matplotlib.use() has no effect because the backend has already  
been chosen; matplotlib.use() must be called _before_ pylab, matplotlib.pyplot,  
or matplotlib.backends is imported for the first time.

The backend was _originally_ set to u’Qt5Agg’ by the following code:  
File “C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\__init_\_.py”, line 14, in   
line for line in traceback.format\_stack()

ERROR: InitError: PyError (ccall(@pysym(:PyImport\_ImportModule), PyPtr, (Cstring,), name)

The Python package matplotlib.pyplot could not be found by pyimport. Usually this means  
that you did not install matplotlib.pyplot in the Python version being used by PyCall.

PyCall is currently configured to use the Julia-specific Python distribution  
installed by the Conda.jl package. To install the matplotlib.pyplot module, you can  
use `pyimport_conda("matplotlib.pyplot", PKG)`, where PKG is the Anaconda  
package the contains the module matplotlib.pyplot, or alternatively you can use the  
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).

Alternatively, if you want to use a different Python distribution on your  
system, such as a system-wide Python (as opposed to the Julia-specific Python),  
you can re-configure PyCall with that Python. As explained in the PyCall  
documentation, set ENV[“PYTHON”] to the path/name of the python executable  
you want to use, run Pkg.build(“PyCall”), and re-launch Julia.

) \<type ‘exceptions.ImportError’\>  
ImportError(u’Matplotlib qt-based backends require an external PyQt4, PyQt5,\nPySide or PySide2 package to be installed, but it was not found.',)  
File “C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\pyplot.py”, line 113, in   
\_backend\_mod, new\_figure\_manager, draw\_if\_interactive, _show = pylab\_setup()  
File "C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\_init_.py", line 60, in pylab\_setup  
[backend\_name], 0)  
File “C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\backend\_qt5agg.py”, line 16, in   
from .backend\_qt5 import (  
File “C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\backend\_qt5.py”, line 18, in   
import matplotlib.backends.qt\_editor.figureoptions as figureoptions  
File “C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\qt\_editor\figureoptions.py”, line 20, in   
import matplotlib.backends.qt\_editor.formlayout as formlayout  
File “C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\qt\_editor\formlayout.py”, line 56, in   
from matplotlib.backends.qt\_compat import QtGui, QtWidgets, QtCore  
File “C:\Users\Lucas.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\qt\_compat.py”, line 201, in   
“Matplotlib qt-based backends require an external PyQt4, PyQt5,\n”

Stacktrace:  
[1] pyerr\_check at C:\Users\Lucas.julia\v0.6\PyCall\src\exception.jl:56 [inlined]  
[2] pyerr\_check at C:\Users\Lucas.julia\v0.6\PyCall\src\exception.jl:61 [inlined]  
[3] macro expansion at C:\Users\Lucas.julia\v0.6\PyCall\src\exception.jl:81 [inlined]  
[4] pyimport(::String) at C:\Users\Lucas.julia\v0.6\PyCall\src\PyCall.jl:374  
[5] **init** () at C:\Users\Lucas.julia\v0.6\PyPlot\src\init.jl:189  
[6] \_include\_from\_serialized(::String) at .\loading.jl:157  
[7] \_require\_from\_serialized(::Int64, ::Symbol, ::String, ::Bool) at .\loading.jl:200  
[8] \_require\_search\_from\_serialized(::Int64, ::Symbol, ::String, ::Bool) at .\loading.jl:236  
[9] \_require(::Symbol) at .\loading.jl:434  
[10] require(::Symbol) at .\loading.jl:398  
during initialization of module PyPlot

---

<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: [October 22, 2017, 7:24pm UTC](https://discourse.julialang.org/t/error-in-using-pyplot-windows/6614/2 "2017-10-22T19:24:42Z")

</div>

Try a different backend? e.g.

```julia
ENV["MPLBACKEND"]="tkagg"
using PyPlot

```

(in a new Julia session).

---

<div class="post-metadata">

### Author: ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)
#### Post date: [October 22, 2017, 7:27pm UTC](https://discourse.julialang.org/t/error-in-using-pyplot-windows/6614/3 "2017-10-22T19:27:52Z")

</div>

i got this after try to do a plot

> 1-element Array{PyCall.PyObject,1}:  
> PyObject \<matplotlib.lines.Line2D object at 0x0000000029DAC4E0\>
