Error in using PyPlot - windows

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

Try a different backend? e.g.

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

(in a new Julia session).

1 Like

i got this after try to do a plot

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