13

Once I opened a notebook file with Jupyter (it asks me to convert the file) I never can open it in the standard IPython notebook anymore. I get the following error:

Error loading notebook
Bad Request

2014-12-21 04:13:03.203 [NotebookApp] WARNING | Unreadable Notebook: /FunIT experiment.ipynb global name  'NBFormatError' is not defined
WARNING:tornado.access:400 GET /api/notebooks/FunIT%20experiment.ipynb?_=1419153182928 (::1) 3.11ms referer=http://localhost:8888/notebooks/FunIT%20experiment.ipynb

An example of such corrupted files is this one: https://www.dropbox.com/s/7io99wpoivxmc8f/FunIT%20experiment.ipynb?dl=0

How can I revert this process? I need to open these files with the standard IPython notebook (v2.2.0).

amaatouq
  • 2,297
  • 5
  • 29
  • 50

3 Answers3

12

This problem has to do with incompatibility of the notebook and your IPython version. In my current version of IPython:

ipython --version 
2.3.1

When I try to open the file (FunIT\ experiment.ipynb):

ipython notebook FunIT\ experiment.ipynb 

I get the following error message

Error loading notebook

Unreadable Notebook: FunIT experiment.ipynb Unsupported nbformat version 4

The error message indicates that the notebook format is not supported. Let's install the development version, https://github.com/ipython/ipython. I used virtual Environment, http://docs.python-guide.org/en/latest/dev/virtualenvs/, but it's not necessary.

Install virtual environment

pip install virtualenv
mkdir test
cd test
virtualenv venv
source venv/bin/activate

Ipython Notebook development installation

git clone --recursive https://github.com/ipython/ipython.git
cd ipython
pip install -e ".[notebook]" --user

Now I have the current development version.

ipython --version
3.0.0-dev

And I can open the file with ipython notebook

ipython notebook FunIT\ experiment.ipynb

Here is a snippet of the code:

import pandas as pd
import numpy as np
from pandas.tools.pivot import pivot_table
#from sklearn.metrics import roc_auc_score
import matplotlib.pyplot as plt
%pylab inline
#from sklearn.neighbors.kde import KernelDensity
import seaborn as sns
import scipy.stats as st
sns.set()
maiaini
  • 692
  • 1
  • 9
  • 13
11

Upgrading IPython fixed it for me:

pip install ipython --upgrade

leekaiinthesky
  • 5,413
  • 4
  • 28
  • 39
9

This works for me perfectly:

pip install jupyter
Sean
  • 374
  • 3
  • 10