gregsexton / ob-ipython

org-babel integration with Jupyter for evaluation of (Python by default) code blocks
739 stars 109 forks source link

ob-ipython not working #140

Closed ludicludo closed 6 years ago

ludicludo commented 6 years ago

Hi, I have installed ob-ipython from melpa ( emacs 25.3.1, macosx 10.12.6). When running a simple ipython code in orgmode file i get this message in debug buffer: File "/Users/ludo/.emacs.d/elpa/ob-ipython-20171111.740/client.py", line 1, in <module> import jupyter_client as client ImportError: No module named jupyter_client I have manually checked in a terminal that I could import this module and it's ok.

when looking at ob-ipython-kernel I got a message like so: File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/jupyter_console/interactiveshell.py", line 129, in init_completer self.Completer = ZMQCompleter(self, self.client, config=self.config) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/jupyter_console/completer.py", line 36, in __init__ if self.readline: AttributeError: 'ZMQCompleter' object has no attribute 'readline' I don't know how to fix that. any hint ? Cheers Ludovic

yitang commented 6 years ago

have you tried to install jupyter_client?

ludicludo commented 6 years ago

Yes, jupyter is working nicely and I also could import jupyter_client on either python 2 or 3 console or ipython console. But, by running ipython or even a python script inside emacs via org-babel, I get the same import error Is there an other hidden python installation in emacs ? Thanks. Ludovic

ludicludo commented 6 years ago

I have moved one step. I realized that I should customize my .emacs file in order to emacs uses python and ipython I'd like. So, I changed Python Shell Interpreter variable to point to my local version of python and Ipython (macport). I changed 2 variables like so:

'(python-shell-exec-path (quote ("/opt/local/bin"))) '(python-shell-interpreter "/opt/local/bin/python"

I tried with org-babel

+BEGIN_SRC ipython :session :results output

%matplotlib inline import jupyter_client as client print 'hellooooo'

+END_SRC

+RESULTS:

: hellooooo

and python script:

import jupyter_client as client print 'hello'
Perfect, so nice !