Windows7: figure window "not responding"

Hi,

Sorry for breaking the thread, I have just subscribed to the list and I
don't know how to respond to a message that predates my subscription. I
hope this messages makes its way.

I believe I have a similar setup (Windows + emacs + Qt5Agg, python 3.5
and matplotlib 2+). I also see freezes when starting ipython from
within emacs.

The way I work around that is by using org-mode and ob-ipython
(https://github.com/gregsexton/ob-ipython).

To work with matplotlib, I do the following:

1 - Open my org file, which starts with something like:

···

,----

#+PROPERTY: header-args :eval no-export :session Python

#+NAME: py-startup-0
#+BEGIN_SRC ipython :results silent :exports none
# %% Standard imports
# General
import os
import sys
import re
import matplotlib as mpl
mpl.use('Qt5Agg')
#+END_SRC

`----

2 - Execute the source block (move point at the beginning of the
"BEGIN_SRC line" and C-c C-c)

I then get a warning about the interpreter which I ignore. Note that it
sometimes hangs at that point, in which case I use C-g.

3 - The *Python* buffer then contains the ipython session, in which I
can use matplotlib: I get not freezes and calls do not block the ipython
instance. Note that I have to run `plt.ion()` once to get matplotlib
figures to show up.

4 - I usually write most of my code in org-mode anyway, but after
running the source block I can open any .py file and work with it ignoring
the org-mode part.

For completeness, my emacs init file contains the following:
,----

(when (eq system-type 'windows-nt)
      (progn
        (setq python-shell-interpreter-args "--simple-prompt -i")
        (setq ob-ipython-command "ipython")))

`----

I hope this helps.

thibault

On Sat, Aug 5, 2017 at 12:39 PM Strozzi, David J. <strozzi2-i2BcT+NCU+M at public.gmane.org> wrote:

This problem has been driving me nuts, posted it elsewhere, so far no one's been able to help. I am running Python 3.6.1 from Anaconda (all packages updated to latest and greatest) on
Windows 7. ipython and mpl figure windows work fine from a console, or spyder. The problem is when I try running ipython within emacs using elpy.

To back up, the workflow I'm shooting for is using emacs as my IDE, and running python within emacs. I've done this for many years with the Yorick interpreter, and it's quite addictive. I get
the same problem whether I use the GNU windows build of emacs, or emacs -nw (terminal, no X) from cygwin (ver 25.2 both cases). elpy seems to be a good Python package for emacs, and
nominally supports using ipython.

OK, so - I can use ipython + emacs + elpy. The only problem is matplotlib figures. When I do figure(), a figure window appears, but is not fully rendered (e.g. no buttons), and the window title
says "Not responding". If I do a plot(), nothing is plotted. Playing with ion() and show() doesn't help.

I've posted this on the elpy github, various stackexchange forums, no one has had any ideas yet.

Any help is greatly appreciated!

Dave