nbdiff icon indicating copy to clipboard operation
nbdiff copied to clipboard

nbdiff not displaying anything in browser

Open jonathan-svds opened this issue 9 years ago • 6 comments

I installed nbdiff via pip and everything looks like it should be working. When I run nbdiff a new tab opens on Chrome at http://127.0.0.1:5000/0 but the page remains completely blank (although the favicon turns to the Jupyter logo).

Here are two notebooks whose truncated diff is:

$ diff temp.ipynb 07-github-integration.ipynb
5c5
<    "execution_count": 2,

---
>    "execution_count": 1,
30c30
<       "Git hash   : 6573faf59947820dd010f59c147edf0cae218f65\n"

---
>       "Git hash   : 64eb7da402e5afbdbaf4461933111e5a8123aa98\n"
42c42
<    "execution_count": 3,

---
>    "execution_count": 2,
58c58
<    "execution_count": 11,

---
>    "execution_count": 3,
69c69
<    "execution_count": 12,

---
>    "execution_count": 4,
80c80
<    "execution_count": 13,

---
>    "execution_count": 5,
88c88
<        "<matplotlib.collections.PathCollection at 0x10d050350>"

---
>        "<matplotlib.collections.PathCollection at 0x10c25d7d0>"
91c91
<      "execution_count": 13,

---
>      "execution_count": 5,
97c97
<       "image/png": "iVBORw0KGgoAAAANSUhEUgAAAesAAAFVCAYAAADPM8ekAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t...

So I try to use nbdiff and I get:

$ nbdiff temp.ipynb 07-github-integration.ipynb
/Users/jonathan/anaconda/lib/python2.7/site-packages/IPython/nbformat/current.py:19: UserWarning: IPython.nbformat.current is deprecated.

- use IPython.nbformat for read/write/validate public API
- use IPython.nbformat.vX directly to composing notebooks of a particular version

  """)
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [10/Jun/2015 17:15:10] "GET /0 HTTP/1.1" 200 -
127.0.0.1 - - [10/Jun/2015 17:15:10] "GET /static/contents.js HTTP/1.1" 404 -

The source of the page doesn't look crazy:

<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">

    <title>IPython Notebook</title>
    <link rel="shortcut icon" type="image/x-icon" href="static/base/images/favicon.ico">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link rel="stylesheet" href="static/components/jquery-ui/themes/smoothness/jquery-ui.min.css" type="text/css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


<link rel="stylesheet" href="/nbdiff/css/nbdiff.css">
<link rel="stylesheet" href="/nbdiff/css/local.css">




<script type="text/javascript">
// MathJax disabled, set as null to distingish from *missing* MathJax,
// where it will be undefined, and should prompt a dialog later.
window.mathjax_url = "";
</script>

<link rel="stylesheet" href="static/components/bootstrap-tour/build/css/bootstrap-tour.min.css" type="text/css" />
<link rel="stylesheet" href="static/components/codemirror/lib/codemirror.css">


    <link rel="stylesheet" href="static/style/style.min.css" type="text/css"/>


<link rel="stylesheet" href="static/notebook/css/override.css" type="text/css" />
<link rel="stylesheet" href=""  id='kernel-css'                             type="text/css" />



    <link rel="stylesheet" href="static/custom/custom.css" type="text/css" />
    <script src="static/components/es6-promise/promise.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="static/components/requirejs/require.js" type="text/javascript" charset="utf-8"></script>
    <script>
      require.config({

          baseUrl: 'static/',
          paths: {
            nbextensions : 'nbextensions',
            kernelspecs : 'kernelspecs',
            underscore : 'components/underscore/underscore-min',
            backbone : 'components/backbone/backbone-min',
            jquery: 'components/jquery/jquery.min',
            bootstrap: 'components/bootstrap/js/bootstrap.min',
            bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
            jqueryui: 'components/jquery-ui/ui/minified/jquery-ui.min',
            moment: 'components/moment/moment',
            codemirror: 'components/codemirror',
            termjs: 'components/term.js/src/term',
          },
          shim: {
            underscore: {
              exports: '_'
            },
            backbone: {
              deps: ["underscore", "jquery"],
              exports: "Backbone"
            },
            bootstrap: {
              deps: ["jquery"],
              exports: "bootstrap"
            },
            bootstraptour: {
              deps: ["bootstrap"],
              exports: "Tour"
            },
            jqueryui: {
              deps: ["jquery"],
              exports: "$"
            }
          }
      });

      require.config({
          map: {
              '*':{
                'contents': '',
              }
          }
      });
    </script>




</head>

<body class="notebook_app " 

data-project="/"
data-base-url=""
data-ws-url=""
data-notebook-name="test_notebook0"
data-notebook-path="./"

>

<noscript>
    <div id='noscript'>
      IPython Notebook requires JavaScript.<br>
      Please enable it to proceed.
  </div>
</noscript>

<div id="header">
  <div id="header-container" class="container">
  <div id="ipython_notebook" class="nav navbar-brand pull-left"><a href="" title='dashboard'><img src='static/base/images/logo.png' alt='Jupyter Notebook'/></a></div>





    <span id="login_widget">

    </span>








<span id="save_widget" class="pull-left save_widget">
    <span id="notebook_name" class="filename"></span>
    <span class="checkpoint_status"></span>
    <span class="autosave_status"></span>
</span>

<span id="kernel_logo_widget">
  <img class="current_kernel_logo" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"/>
</span>


  </div>
  <div class="header-bar"></div>



<img src="/nbdiff/image/logo.png" id="nbdiff-logo" alt="NBDiff" />

<div id="nbdiff-controls">
    <button id='nbdiff-undo'>Undo</button>
    <button id='nbdiff-save'>Save</button>
    <button id='nbdiff-previous'>Previous Notebook</button>
    <button id='nbdiff-next'>Next Notebook</button>
    <button id='nbdiff-shutdown'>Shut Down</button>
    <span id='nbdiff-filename'></span>
</div>
<div id='current-notebook' style='display: hidden' data-current-notebook=0></div>
<div id='num-notebooks' style='display: hidden' data-num-notebooks=1></div>

</div>

<div id="site">


<div id="ipython-main-app">
    <div id="notebook_panel">
        <div id="notebook"></div>
        <div id='tooltip' class='ipython_tooltip' style='display:none'></div>
    </div>
</div>



</div>



<div id="pager">
    <div id="pager-contents">
        <div id="pager-container" class="container"></div>
    </div>
    <div id='pager-button-area'></div>
</div>







<script type="text/javascript">
    sys_info = ;
</script>

<script src="static/components/text-encoding/lib/encoding.js" charset="utf-8"></script>

<script src="static/notebook/js/main.js" charset="utf-8"></script>


<script type="text/javascript" src="/nbdiff/js/drag_drop.js"></script>
<script type="text/javascript" src="/nbdiff/js/command.js"></script>

<script type="text/javascript" src="/nbdiff/js/local.js"></script>

<script type="text/javascript" src="/nbdiff/js/nbdiff.js"></script>
<script type="text/javascript" src="/nbdiff/js/main.js"></script>


</body>

</html> 

I think that maybe running with --debug would help:

$ nbdiff temp.ipynb 07-github-integration.ipynb --debug
/Users/jonathan/anaconda/lib/python2.7/site-packages/IPython/nbformat/current.py:19: UserWarning: IPython.nbformat.current is deprecated.

- use IPython.nbformat for read/write/validate public API
- use IPython.nbformat.vX directly to composing notebooks of a particular version

  """)
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
/Users/jonathan/anaconda/lib/python2.7/site-packages/IPython/nbformat/current.py:19: UserWarning: IPython.nbformat.current is deprecated.

- use IPython.nbformat for read/write/validate public API
- use IPython.nbformat.vX directly to composing notebooks of a particular version

  """)
127.0.0.1 - - [10/Jun/2015 17:12:56] "GET /0 HTTP/1.1" 200 -
127.0.0.1 - - [10/Jun/2015 17:12:56] "GET /static/contents.js HTTP/1.1" 404 -
127.0.0.1 - - [10/Jun/2015 17:13:14] code 400, message Bad request version ('RTSP/1.0')
127.0.0.1 - - [10/Jun/2015 17:13:14] "GET /info?txtAirPlay&txtRAOP RTSP/1.0" 400 -
127.0.0.1 - - [10/Jun/2015 17:13:18] code 400, message Bad request version ('RTSP/1.0')
127.0.0.1 - - [10/Jun/2015 17:13:18] "GET /info?txtAirPlay&txtRAOP RTSP/1.0" 400 -

Opens 2 tabs in my Chrome browser (still doesn't work).

Also tried in Firefox, but nothing. Am I doing something wrong? My setup is a Macbook Pro,

Python 2.7.10 |Anaconda 2.1.0 (x86_64)| (default, May 28 2015, 17:04:42)
IPython 3.1.0 -- An enhanced Interactive Python.

jonathan-svds avatar Jun 11 '15 00:06 jonathan-svds

IPython 3.1.0 -- An enhanced Interactive Python.

Unfortunately, nbdiff only supports IPython versions before 3.0 at the moment. I'd really like to add support for newer IPythons, but I haven't had the time. I'd happily help anyone who was interested in upgrading nbdiff to support IPython 3.0, but for the near future I won't be able to personally make the upgrade. Sorry about the confusion and the bad experience :(

tarmstrong avatar Jun 11 '15 18:06 tarmstrong

Ok, not a problem. It looks like a really neat tool. If I may make one suggestion in lieu of supporting IPython >= 3.0 -- add some words to that effect to the Readme.

jonathan-svds avatar Jun 11 '15 18:06 jonathan-svds

@jonathan-svds done! Thanks for the suggestion; much appreciated.

tarmstrong avatar Jun 11 '15 19:06 tarmstrong

@tarmstrong, I am not understanding which versions of iPython are supported by nbdiff currently. I tried the latest of 2.x and was unable to get it to work. What version of 2.x are you using?

jakirkham avatar Jun 12 '15 16:06 jakirkham

Hi tarmstrong@, how difficult do you think would it be to add support to IPython 3.x?

anaderi avatar Jul 11 '15 15:07 anaderi

FWIW -- I have ipython 2.3.0 (from debian), installed nbdiff (1.0.3) from pypi using pip into a virtualenv (with --system-site-packages). Running nbdiff on two notebooks brings up the browser which displays nothing. In console

$> nbdiff raiders-attempt1.ipynb raiders-attempt1__.ipynb  
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
Created new window in existing browser session.
[32526:32550:0129/221130:ERROR:nss_util.cc(853)] After loading Root Certs, loaded==false: NSS error code: -8018
127.0.0.1 - - [29/Jan/2016 22:11:30] "GET /0 HTTP/1.1" 200 -
127.0.0.1 - - [29/Jan/2016 22:11:31] "GET /static/base/js/namespace.js HTTP/1.1" 404 -
127.0.0.1 - - [29/Jan/2016 22:11:31] "GET /static/components/codemirror/mode/xml/xml.js HTTP/1.1" 404 -
127.0.0.1 - - [29/Jan/2016 22:11:31] "GET /static/base/js/security.js HTTP/1.1" 404 -
...

and no forth so majority is 404.

installing in a clean venv pukes on pexpect:

  Running setup.py install for pexpect
      File "/home/yoh/proj/experiments/movie-localizers/venv-clean/lib/python2.7/site-packages/pexpect/async.py", line 16
        transport, pw = yield from asyncio.get_event_loop()\
                                 ^
    SyntaxError: invalid syntax


  Running setup.py install for ptyprocess

yarikoptic avatar Jan 30 '16 03:01 yarikoptic