6

I previously thought that was the issue with IPython, but today I tested again, here is what I did:

  1. Run emacs -Q in cmd window
  2. Open a .py file
  3. M-x, then run python-shell-switch-to-shell, RET, and RET. Then I have the Python shell ready
  4. I in put the following code then:
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
>>> plt.ion()
>>> plt.plot([1,2,3])
[<matplotlib.lines.Line2D object at 0x03068610>]
>>>

Actually after this, no figure shows up, and the shell is frozen, e.g., when I input:

>>> print("hello")

nothing happened...I haven't tested other plotting tools but matplotlib. I don't know if it is a bug. I've searched for a while, here and though Google, but no luck. My system is: Emacs 24.3 32 bit for Windows, under Windows 7. If others can duplicate same issue as here, I will report this as a bug.

I used IPython as the Python shell by:

C:/Python27/python.exe -i C:/Python27/Scripts/ipython-script.py --pylab

Then, I input figure(); plot([1,2,3]), as expected, the figure popup and freezes. Then I did: C-c C-d which runs comint-send-eof, and the figure actually get updated! But my IPython shell session is also terminated with the following message:

In [6]:
Do you really want to exit ([y]/n)?
Traceback (most recent call last):
File "C:/Python27/Scripts/ipython-script.py", line 9, in <module>
load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython')()
SystemExit

If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
%config Application.verbose_crash=True

Any helpful clue here?!

6
  • I tried it on GNU Emacs 24.2.1 on Fedora 18 and it works fine, sorry. But the hook on my system is python-switch-to-python. Commented Jun 14, 2013 at 22:29
  • you are having issues with the gui main loop. What backend are you using? Try configuring it to use ipython --pylab instead of python Commented Jun 15, 2013 at 3:50
  • @tcaswell i actually tried different backends using matplotlib.use(), does not work. But in cmd window, it works. i also tried ipython, there is a figure window shows up, but it freezes without plot.I believe this post describes the same issue here on Stackoverflow, almost 1 year past, still no true answer to the question... I believe it is duplicable if you dont mind to try it with same configuration Commented Jun 15, 2013 at 15:52
  • I don't have a windows box set up to do any real work. Are you passing python the proper threading arguments when you start the interpreter? matploblib.use() needs to be run before you import plt. I suspect your system is not configured quite right. Commented Jun 15, 2013 at 17:13
  • here is my command for Run Python shell in emacs: C:/Python27/python.exe -i C:/Python27/Scripts/ipython-script.py --pylab , my ipython is 0.13.2, my python is 2.7.5, the default backend is : TkAgg, As i said, it works under cmd window, so i believe it is not the backend cause the problem. I also tried QT. Commented Jun 15, 2013 at 17:24

2 Answers 2

4

one solution is:

(setq python-shell-interpreter "C:\\YourPython3Dist\\python.exe"
      python-shell-interpreter-args "-i C:\\YourPython3Dist\\Scripts\\ipython3-script.py console --pylab=qt")

The Argument console in the call of ipython-script.py is the important one!

In Python 3 with qt backend it works for me. I don't know how it works with py 2.7. (should be no problem if these arguments are supported for ipytho-script.py)

Sign up to request clarification or add additional context in comments.

3 Comments

you are the man made my life easier! it works for python 2.7 as well!
Yea when they introduced the console argument it started working. I had this problem prior to version 1.0 of Ipython
@siegfried I am using the WinPython distribution and ipython3-script.py is not in the distribution. Any idea what this like should look like in this setup? I am experiencing the same hanging behavior.
1

I think it would take sometime until the problem is fixed. Until some Windows user actually debugs python.el.

Until then, why not try Emacs IPython Notebook? It is a better IPython binding for Emacs. You don't need to use the notebook part. You can think it as a replacement for python shell in python.el. (disclaimer: I am the author)

4 Comments

My experience is that ipython is not so great for windows, the notebook often has kernel crash for me, i tried on different machine but same thing happens. I believe that is because the ipython notebook itself requires to set up an http server whose compatibility is not perfect under Windows. Anyway, thanks for making EIN, its a great package for Emacs, and i am actually using it.
If it is kernel, the problem is probably zmq, not http (tornado). Did you send a bug report? I think IPython dev is quicker to fix the problem when it comes to Windows. And glad you like EIN :)
if you have time ,could you please help to take a look at the question updates? i wonder if that can help to solve the problem, thanks!
I don't know much about python.el internal, so I don't know how to fix. I think you can just send a bug report to emacs devel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.