tkf / emacs-ipython-notebook

IPython notebook client in Emacs
tkf.github.com/emacs-ipython-notebook/
GNU General Public License v3.0
548 stars 51 forks source link

Error when using EIN with IPython 2.0.0-dev #137

Open rhstanton opened 10 years ago

rhstanton commented 10 years ago

Check list

EIN isn't happy working with the latest development version of IPython (2.0.0-dev). When I tryn to execute ein:notebooklist-open, I get an error.

Steps to reproduce the problem

  1. Install IPython 2.0.0-dev
  2. Fire up IPython notebook
  3. Start Emacs and execute ein:notebooklist-open

    Expected output

Notebook list. Instead, I get the error

REQUEST [error] Error from parser ein:json-read: (json-readtable-error) ein: [error] Error (parse-error) while opening notebook list at the server 8888.

(This works fine with IPython 1.2)

Your EIN configuration (in .emacs.d/init.el or somewhere else)

Your IPython configuration

  1. What is your IPython version? (run ipython --version):

2.0.0-dev

  1. How do you start IPython? (e.g., ipython notebook --port 9999):

ipython notebook

  1. What is your IPython notebook port number or URL?:

8888

Additional information (if any)

System info:

("EIN system info"
 :emacs-version
 "GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36)
 of 2013-03-10 on bob.porkrind.org"
 :emacs-bzr-version nil
 :window-system ns
 :emacs-variant nil
 :os
 (:uname
  "Darwin Richards-Mac-Pro-2.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
"
  :lsb-release nil)
 :image-types
 (png gif tiff jpeg xpm xbm pbm)
 :image-types-available
 (png gif tiff jpeg xpm xbm pbm)
 :request
 (:backend curl)
 :ein
 (:version "0.2.1alpha2.30f102c-dirty"
           :source-dir "/Users/stanton/.emacs.d/el-get/ein/lisp/")
 :lib
 ((:name "websocket"
         :path "~/.emacs.d/el-get/websocket/websocket.elc"
         :featurep t
         :version-var websocket-version
         :version "1.0")
  (:name "request"
         :path "~/.emacs.d/el-get/request/request.elc"
         :featurep t
         :version-var request-version
         :version "0.2.0")
  (:name "auto-complete"
         :path "~/.emacs.d/el-get/auto-complete/auto-complete.el"
         :featurep t
         :version-var nil
         :version nil)
  (:name "auto-complete"
         :path "~/.emacs.d/el-get/auto-complete/auto-complete.el"
         :featurep t
         :version-var nil
         :version nil)
  (:name "popup"
         :path "~/.emacs.d/el-get/popup/popup.elc"
         :featurep t
         :version-var popup-version
         :version "0.5.0")
  (:name "fuzzy"
         :path "~/.emacs.d/el-get/fuzzy/fuzzy.elc"
         :featurep nil
         :version-var nil
         :version nil)
  (:name "pos-tip"
         :path "~/.emacs.d/el-get/pos-tip/pos-tip.elc"
         :featurep t
         :version-var pos-tip-version
         :version "0.4.5")
  (:name "python"
         :path "/Applications/Emacs.app/Contents/Resources/lisp/progmodes/python.elc"
         :featurep nil
         :version-var nil
         :version nil)
  (:name "python-mode"
         :path
         "/Applications/Emacs.app/Contents/Resources/site-lisp/python-mode/python-mode.el"
         :featurep t
         :version-var nil
         :version nil)
  (:name "markdown-mode"
         :path "~/.emacs.d/el-get/markdown-mode/markdown-mode.elc"
         :featurep nil
         :version-var nil
         :version nil)))
millejoh commented 10 years ago

Pretty sure this is happening because requests to http://127.0.0.1:8888/notebooks now return an HTML page instead of JSON data.

The RESTful interface to ipython notebook seems to have changed and all commands need to be prefixed with "api" now (I think). E.g. to get list of notebooks call http://127.0.0.1:8888/api/notebooks.

So far I can get ein:notebooklist-open to work, but not an individual notebook (I need to track down where/how ein makes that call).

I don't use git much, but if I can figure out how to get ein working again with ipython 2.0 there might be hope for me figuring out how to do a pull request.

thoo commented 10 years ago

@millejoh That would be great if emacs could work with ipython 2. Right now, I have a hard time typing in ipython notebook.Thanks,

millejoh commented 10 years ago

Finally found some documentation on the RESTful API. Looks like they no longer use notebook ID's and decouple notebooks from the kernel, instead using a session to manage communication. Or some such. It'll take some time for me to read and understand this, and probably even more to update the code. Maybe tkf will beat me to the punch and release a new version of ein. Otherwise I'll try to get in a pull request with the changes ASAP. Unfortunately the changes will probably break ein compatibility with versions of IPython previous to 2.0.0.

rybesh commented 10 years ago

2.0 is now the stable version of IPython. Until EIN can be made compatible with the latest stable version of IPython, the installation instructions ought to make it very clear that a legacy version of IPython is required.

So, http://tkf.github.io/emacs-ipython-notebook/#requirements needs to be changed from "IPython 0.12 or higher" to "IPython 0.12 to 1.2.1".

millejoh commented 10 years ago

On 4/29/2014 5:04 PM, lambda-seven wrote:

I ran into this version compatibility problem today. No comments since 19 days. Did anyone make any progress since that time or are you sticking with ipython <= 1.2? tkf can you confirm the source of the problem due to API change and are you planning adjustment changes to make ein work with new versions of notebook?

— Reply to this email directly or view it on GitHub https://github.com/tkf/emacs-ipython-notebook/issues/137#issuecomment-41738151.

The problem is indeed due to a change in the API, thanks to IPython now supporting notebook hierarchies.

The fork I made over at github https://github.com/millejoh/emacs-ipython-notebook is working for me using ipython 2.0.0, but I have heard from one other person that couldn't get it to work. Note that I don't have 100% functionality, but I do have enough working to open and edit workbooks. It has been a busy month at work, but I try to work on it as I can.

All I can say is, if you are feeling adventurous checkout a copy and when something breaks create an issue using information from ein:dev-bug-report-template.

John

unhandyandy commented 10 years ago

What's the status of this problem? I'm still seeing it with ipython 2.1.

joechm commented 10 years ago

Same problems here. millejoh's fork seems to fix most problems (thanks!), but ein could use some love...

BTW millejoh's fork is at: https://github.com/millejoh/emacs-ipython-notebook (the link above drags ">is" into the URL)

Let us know if there is something we can help with, tk. This is an awesome tool...

erxnmedia commented 10 years ago

Millejoh's fork works for me, I have new install of GNU Emacs 24.3.1 and Anaconda Python 64-bit release 2.0.1. With this combination, the IPython client at http://tkf.github.io/emacs-ipython-notebook/ doesn't work..

gcr commented 10 years ago

Ibid -- Millejoh's fork works for me.

arvids commented 10 years ago

Are there any known issues with Millejoh's fork?

gcr commented 10 years ago

A few minor annoyances with millejoh's fork:

But other than these small issues, after installing Millehjoh's fork of EIN, IPython 2.2, and Tornado ≥4.x (having a recent version of Tornado is important to fixing the websocket issue), and after ensuring that websocket.el doesn't send the Origin header (see this patch: https://github.com/ahyatt/emacs-websocket/commit/8c366e8f3d5662dba6e9a4c1369e096b7ad917b1 ), things are back to working quite smoothly.

I don't need to patch any Python packages and the only tweak is the websocket fix, which is in new versinos of websocket.el (I'm not sure if that fix is on ELPA/marmalade/... yet).

The hardest part is just making sure you have the correct dependencies. My worknig setup is:

nithyanandan commented 10 years ago

I have the same problems except I am using IPython 2.2.0. I installed ein from MELPA and I have the following versions: ein-20140317.1114 websocket-20140823.1756 Running M-x ein:notebooklist-open and entering port 8888 gives the error: REQUEST [error] Error from parser ein:json-read: (json-readtable-error) ein: [error] Error (parse-error) while opening notebook list at the server 8888.

IPython notebook runs without problems from the terminal:

nithyanndansmbp:~ XXX$ ipython notebook
2014-09-23 17:06:57.957 [NotebookApp] Using existing profile dir: u'/Users/XXX/.ipython/profile_default'
2014-09-23 17:06:57.962 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js
2014-09-23 17:06:58.184 [NotebookApp] Serving notebooks from local directory: /Users/XXX
2014-09-23 17:06:58.184 [NotebookApp] 0 active kernels 
2014-09-23 17:06:58.184 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/
2014-09-23 17:06:58.184 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
WARNING:tornado.access:404 GET /new (127.0.0.1) 0.39ms referer=None

Based on the discussion above a forked version seems to fix this but is not available yet on MELPA? Thanks!

millejoh commented 10 years ago

You are correct - the version of ein in MELPA is based off tkf's main branch, which only supports IPython versions earlier than 2.0. If you want support for 2.0 or later you have to download my fork from github and add the lisp subdirectory to your load-path.

I am slowly working towards adding my fork to MELPA, but with a different name so people are clear that the different packages support different versions of the IPython notebook.

I don't have much free time, and am honestly quite lazy, but I will try to do this soon.

Give my github fork a try, it works well enough in my day to day use. If you find anything send me a note or create an issue.

Regards,

John Miller

On Sep 23, 2014, at 8:07 PM, nithyanandan notifications@github.com wrote:

I have the same problems except I am using IPython 2.2.0. I installed ein from MELPA and I have the following versions: ein-20140317.1114 websocket-20140823.1756 Running M-x ein:notebooklist-open and entering port 8888 gives the error: REQUEST [error] Error from parser ein:json-read: (json-readtable-error) ein: [error] Error (parse-error) while opening notebook list at the server 8888.

IPython notebook runs without problems from the terminal:

nithyanndansmbp:~ XXX$ ipython notebook 2014-09-23 17:06:57.957 [NotebookApp] Using existing profile dir: u'/Users/XXX/.ipython/profile_default' 2014-09-23 17:06:57.962 [NotebookApp] Using MathJax from CDN: https://cdn.mathjax.org/mathjax/latest/MathJax.js 2014-09-23 17:06:58.184 [NotebookApp] Serving notebooks from local directory: /Users/XXX 2014-09-23 17:06:58.184 [NotebookApp] 0 active kernels 2014-09-23 17:06:58.184 [NotebookApp] The IPython Notebook is running at: http://localhost:8888/ 2014-09-23 17:06:58.184 [NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). WARNING:tornado.access:404 GET /new (127.0.0.1) 0.39ms referer=None Based on the discussion above a forked version seems fix this but is not available yet on MELPA? Thanks!

— Reply to this email directly or view it on GitHub.