Stability of ob-ipython and Ipython 5.1.0
Hey,
Tanks
First of all, thank you soo much for this ob-ipython approach. It's what I always wanted to have. Its amazing. The idea is just perfect.
The Issue
I have a couple of nasty stability problems with ob-ipython in my current setup. When I start e REPL I sometimes get a RuntimeError: Kernel didn't respond to kernel_info_request. `
In general it feels like a game of luck it dosn't allways happen. Also the whole thing freezes every once in a while, but I don't know how to reproduce this and I could not capture any debug output from a freeze yet.
I'm using the following packages.
Setup
ipython 5.1.0 emacs 25.1.1 (with spacemacs configuration) python 3.5.2 jupyter 4.2.0 ob-ipython: 20160918.1001 (that's what emacs tells me) I use a virtualenv to separate system python packages and the ones I need for my projects.
Steps to Reproduce
Not super sure sometimes it doesn't happen, but in general I do:
- Open Emacs and a .org file with ipython codeblocks
- Set virtual env with
pyvenv-workon - Execute a block with
C-c C-c - start a REPL with
C-c C-v C-z - Whait ~20s and the
RuntimeErrorappears in the*Python*buffer. - I then usually need to start the REPL again and it will work.
Error Logs
This is what the *Python* buffer shows:
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/jupyter_console/ptshell.py", line 302, in init_kernel_info
reply = self.client.get_shell_msg(timeout=1)
File "/usr/lib/python3.5/site-packages/jupyter_client/client.py", line 77, in get_shell_msg
return self.shell_channel.get_msg(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/jupyter_client/blocking/channels.py", line 57, in get_msg
raise Empty
queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/jupyter-console", line 11, in <module>
sys.exit(main())
File "/usr/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/lib/python3.5/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-113>", line 2, in initialize
File "/usr/lib/python3.5/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/lib/python3.5/site-packages/jupyter_console/app.py", line 137, in initialize
self.init_shell()
File "/usr/lib/python3.5/site-packages/jupyter_console/app.py", line 110, in init_shell
client=self.kernel_client,
File "/usr/lib/python3.5/site-packages/traitlets/config/configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "/usr/lib/python3.5/site-packages/jupyter_console/ptshell.py", line 251, in __init__
self.init_kernel_info()
File "/usr/lib/python3.5/site-packages/jupyter_console/ptshell.py", line 305, in init_kernel_info
raise RuntimeError("Kernel didn't respond to kernel_info_request")
RuntimeError: Kernel didn't respond to kernel_info_request
I also have the known
Warning (python): Python shell prompts cannot be detected.
If your emacs session hangs when starting python shells
recover with ‘keyboard-quit’ and then try fixing the
interactive flag for your interpreter by adjusting the
‘python-shell-interpreter-interactive-arg’ or add regexps
matching shell prompts in the directory-local friendly vars:
+ ‘python-shell-prompt-regexp’
+ ‘python-shell-prompt-block-regexp’
+ ‘python-shell-prompt-output-regexp’
Or alternatively in:
+ ‘python-shell-prompt-input-regexps’
+ ‘python-shell-prompt-output-regexps’