Closed AshtonSBradley closed 6 years ago
What is PyPlot.backend
? Maybe the event loop has become slower for one of the backends.
IJulia doesn't use the event loop at all, since it works via the Jupyter display mechanism. Juno doesn't use this — it has its own render
stuff that PyPlot
knows nothing about. However, if you use PyPlot via Plots.jl, then I think it uses the Juno render
mechanism and skips the event loop.
thanks for this - it seems to work if I call it via Plots
instead.
Backend is
PyPlot.backend
"Qt5Agg"
What happens if you try
ENV["MPLBACKEND"]="tkagg"
before using PyPlot
?
I feel like there have been a lot of problems with the Qt backend lately...
I think I'm seeing the same thing as well, once a plot appears, Julia's CPU goes to ~15% and the interactive plot is super laggy. I'm on Qt4Agg. For me its unrelated to Juno, it happens in normal Julia terminal as well. Switching to tkagg fixes it.
My setup: Julia 0.6.1, PyPlot.jl 2.3.2, Python 3.5.2, matplotlib 2.1.1
EDIT: Oops, I see now "Works fine in IJulia" in the original report so it can't be the same... in any case, maybe this is helpful.
I think I should just change the default to tkagg … hopefully that backend is installed by default on all systems nowadays? I'm never quite sure which backends I can rely on existing.
@stevengj I that that change of backend fixed the lag issue, thanks!
Can you try editing this line in PyCall/src/gui.jl to maxtime = PyObject(1)
to see if that fixes the Qt lagging?
I edited that line, and it didn't fix the lag in Qt
Give matplotlib 2.1.2 a try. Solved Qt problems for me (slow REPL) on 0.6.2/Win 10.
a seemingly related development (in the last day or so):
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 'TkAgg' by the following code:
File "/Users/abradley/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 16, in <module>
line for line in traceback.format_stack()
WARNING: No working GUI backend found for matplotlib
ERROR: InitError: PyError (PyImport_ImportModule
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('dlopen(/Users/abradley/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/ft2font.so, 2): Library not loaded: @rpath/libfreetype.6.dylib\n Referenced from: /Users/abradley/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/ft2font.so\n Reason: Incompatible library version: ft2font.so requires version 22.0.0 or later, but libfreetype.6.dylib provides version 21.0.0',)
File "/Users/abradley/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 31, in <module>
import matplotlib.colorbar
File "/Users/abradley/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/colorbar.py", line 36, in <module>
import matplotlib.contour as contour
File "/Users/abradley/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/contour.py", line 20, in <module>
import matplotlib.font_manager as font_manager
File "/Users/abradley/.julia/v0.6/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/font_manager.py", line 55, in <module>
from matplotlib import afm, cbook, ft2font, rcParams, get_cachedir
Stacktrace:
[1] pyimport(::String) at /Users/abradley/.julia/v0.6/PyCall/src/PyCall.jl:473
[2] __init__() at /Users/abradley/.julia/v0.6/PyPlot/src/init.jl:187
[3] _include_from_serialized(::String) at ./loading.jl:157
[4] _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:200
[5] _require_search_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:236
[6] _require(::Symbol) at ./loading.jl:441
[7] require(::Symbol) at ./loading.jl:405
during initialization of module PyPlot
Maybe TkAgg cannot be relied upon existing anymore either?
julia> versioninfo()
Julia Version 0.6.4
Commit 9d11f62bcb (2018-07-09 19:09 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin14.5.0)
CPU: Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=16)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, broadwell)
I think this is to do with my having a corrupted python installation - a clean install of julia, removing .bash_profile noise to do with previous python installations fixed it
Since the last update Juno has become extremely laggy with PyPlot. Works fine in IJulia, but as soon as I open a figure Juno grinds to an unusable crawl. Happens on both laptop and desktop, both MacOS. It seems to interrupt println commands too, the text comes in smaller chunks rather than a full line.
laptop