简体   繁体   English

加载IPython notebook时出错

[英]Error loading IPython notebook

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. 一旦我用Jupyter打开一个笔记本文件(它要求我转换文件),我再也不能在标准的IPython笔记本中打开它了。 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 此类损坏文件的示例如下: 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). 我需要使用标准的IPython笔记本(v2.2.0)打开这些文件。

This problem has to do with incompatibility of the notebook and your IPython version. 此问题与笔记本电脑和IPython版本的不兼容性有关。 In my current version of IPython: 在我当前版本的IPython中:

ipython --version 
2.3.1

When I try to open the file (FunIT\\ experiment.ipynb): 当我尝试打开文件(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 难以理解的笔记本:FunIT experiment.ipynb不支持的nbformat版本4

The error message indicates that the notebook format is not supported. 错误消息表明不支持笔记本格式。 Let's install the development version, https://github.com/ipython/ipython . 让我们安装开发版本, https://github.com/ipython/ipython I used virtual Environment, http://docs.python-guide.org/en/latest/dev/virtualenvs/ , but it's not necessary. 我使用了虚拟环境, http://docs.python-guide.org/en/latest/dev/virtualenvs/ ,但没有必要。

Install virtual environment 安装虚拟环境

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

Ipython Notebook development installation Ipython Notebook开发安装

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笔记本打开文件

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()

升级IPython为我修复了它:

pip install ipython --upgrade

这完全适合我:

pip install jupyter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM