I tried executing some python code in an ipython code block but I kept getting an error. This is a toy example of what an ob-ipython block looks like:
#+BEGIN_SRC ipython :session test :results output
To execute it you'd put your cursor somewhere in the block and enter
This is the error I was getting:
There was a fatal error trying to process the request. See *ob-ipython-debug*
And in the
*ob-ipython-debug* buffer would be this:
Error executing Jupyter command '/home/dogen/.emacs.d/elpa/ob-ipython-20180113.929/client.py': [Errno 2] No such file or directory
I tried googling for the error, which brought up some Jupyter questions on Stack Overflow that didn't seem relevant. There were also some issues on the
ob-ipython github site, but none of them looked exactly the same. They seemed to suggest that the wrong python interpreter was being used, but when I brought up the interpreter in emacs (
C-c C-v C-z) it showed the correct interpreter version and I could import the
jupyter module… but since that was what people said was the problem and I was using a virtualenv I decided to try setting up pyenv, which apparently lets you switch between python versions fairly easily.
So, I jumped on my desktop to test it out (I ran into the org-mode problem on my laptop, but I was home so I figured I'd switch), but first I brought up emacs and tried executing the same code-block that failed on my laptop, and of course it ran perfectly. So then I went into a long death-spiral of trying to download the ob-ipython git repository and going back in the git-history to see if I could find the place where it might work (my desktop version of ob-ipython was from October of 2017, my laptop's version is from January 2018), and of course none of them worked. Then I tried copying my
init.el file from my desktop to my laptop, and suddenly things worked - so it was a configuration problem, but what was it?