Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with PyPlot #5

Closed
ufechner7 opened this issue Mar 19, 2016 · 3 comments
Closed

Compatibility with PyPlot #5

ufechner7 opened this issue Mar 19, 2016 · 3 comments

Comments

@ufechner7
Copy link
Member

Hello,
I already built a nice GUI with QML.jl .
Now I want to use it together with PyPlot to plot the results. This fails:

julia> using QML

julia> using PyPlot
ERROR: InitError: PyError (:PyImport_ImportModule) <type 'exceptions.AttributeError'>
AttributeError("'module' object has no attribute 'new_figure_manager'",)
  File "/home/ufechner/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/pyplot.py", line 114, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/home/ufechner/.julia/v0.4/Conda/deps/usr/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 35, in pylab_setup
    new_figure_manager = backend_mod.new_figure_manager

 [inlined code] from /home/ufechner/.julia/v0.4/PyCall/src/exception.jl:81
 in pyimport at /home/ufechner/.julia/v0.4/PyCall/src/PyCall.jl:285
 in __init__ at /home/ufechner/.julia/v0.4/PyPlot/src/PyPlot.jl:264
 in _require_from_serialized at loading.jl:84
 in _require_from_serialized at ./loading.jl:109
 in require at ./loading.jl:219
during initialization of module PyPlot

julia> 

I know that it might be difficult to get this right. Is there a way to make PyPlot and QML compatible?

@barche
Copy link
Collaborator

barche commented Mar 19, 2016

Hi,

What is the new_figure_manager? Do you get this error just from the two using lines? If I do the same, I get no error.

@ufechner7
Copy link
Member Author

If I use another backend then QT for PyPlot everything works fine. This works:

using PyCall
pygui(:wx)
using PyPlot

This doesn't work with QML:

using PyCall
pygui(:qt)
using PyPlot

While importing still works, plotting crashes with the following error:

ERROR: ReadOnlyMemoryError()
 [inlined code] from /home/ufechner/.julia/v0.4/PyCall/src/exception.jl:78
 in pycall at /home/ufechner/.julia/v0.4/PyCall/src/PyCall.jl:344
 in figure at /home/ufechner/.julia/v0.4/PyPlot/src/PyPlot.jl:442
 in plot_costs_per_watt at /mnt/ssd/ufechner/00PythonSoftware/FastSim/Plotting.jl:211
 in plot_costs_per_watt at /mnt/ssd/ufechner/00PythonSoftware/FastSim/Plotting.jl:210
 in plot_diagrams at /mnt/ssd/ufechner/00PythonSoftware/FastSim/Plotting.jl:259
signal (11): Speicherzugriffsfehler
PyObject_Call at -------src-dir-------/Python-2.7.11/Objects/abstract.c:2544
pycall at /home/ufechner/.julia/v0.4/PyCall/src/exception.jl:78
doevent at /home/ufechner/.julia/v0.4/PyCall/src/gui.jl:102
jl_apply_generic at /usr/bin/../lib/x86_64-linux-gnu/julia/libjulia.so (unknown line)
anonymous at stream.jl:693
unknown function (ip: 0x7fdecc72646a)
unknown function (ip: (nil))
Speicherzugriffsfehler (Speicherabzug geschrieben)
ufechner@uwe-desktop64:~$ 

There should be a way to make sure, that only one QT event loop is used. But I have a work-around for now.

barche added a commit that referenced this issue Apr 15, 2016
Issue #5 and #7
@barche
Copy link
Collaborator

barche commented Dec 7, 2016

There is an example using PyPlot now, so I'm closing this.

@barche barche closed this as completed Dec 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants