gregsexton / ob-ipython

org-babel integration with Jupyter for evaluation of (Python by default) code blocks
739 stars 109 forks source link

Sample code does not run #81

Closed hooger closed 7 years ago

hooger commented 8 years ago

Hello! I have a problem running a sample code in org-mode, using ob-ipython. When I run it, it gives fatal error. It runs perfectly from a browser. System is Debian 8, up-to-date, emacs version is 24.4.1 ob-ipython version is 20160703.639 jupyter is not installed, as it is not in the official repo, ipython is used instead. Version: 2.3.0-2 python-tornado version is: 3.2.2-1.1 Any idea?

Sample code is:

#+BEGIN_SRC ipython :session mysession
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 2.0, 0.01)
s = np.sin(2*np.pi*t)
plt.plot(t, s)
plt.show()
#+END_SRC

Message is the following:

Evaluate this ipython code block on your system? (y or n) y
executing Ipython code block...
Contacting host: localhost:8888
ob-ipython--dump-error: There was a fatal error trying to process the request. See "ob-ipython-debug" 

ob-ipython-debug says the following:

HTTP/1.1 404 Not Found
Date: Thu, 21 Jul 2016 12:48:36 GMT
X-Frame-Options: SAMEORIGIN
Content-Type: text/html
Content-Length: 3272
Server: TornadoServer/3.2.2
Set-Cookie: username-localhost-8888=; expires=Wed, 22 Jul 2015 12:48:36 GMT; Path=/

<!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?v=4e6c6be5716444f7ac7b902e7f388939">
    <meta http-equiv="X-UA-Compatible" content="chrome=1">
    <link rel="stylesheet" href="/static/components/jquery-ui/themes/smoothness/jquery-ui.min.css?v=d172b560b073f3bc42fea160bbff96a2" type="text/css" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

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

<style type="text/css">
/* disable initial hide */
div#header, div#site {
    display: block;
}
</style>

    <link rel="stylesheet" href="/static/custom/custom.css?v=900035aa0c126bb85df55c5b3e51b6f1" type="text/css" />
    <script src="/static/components/requirejs/require.js?v=07d7db4d3fd6519996822665e4239282" type="text/javascript" charset="utf-8"></script>
    <script>
      require.config({
          baseUrl: '/static/',
          paths: {
            nbextensions : '/nbextensions',
            underscore : '/static/components/underscore/underscore-min.js?v=93a0db5f171ba1d63593d350017fcbf6',
            backbone : '/static/components/backbone/backbone-min.js?v=b4b736cd23ea6769bf12092d5a40a825',
          },
          shim: {
            underscore: {
              exports: '_'
            },
            backbone: {
              deps: ["underscore", "jquery"],
              exports: "Backbone"
            }
          }
      });
    </script>

</head>

<body >

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

<div id="header" class="navbar navbar-static-top">
  <div class="navbar-inner navbar-nobg">
    <div class="container">
    <div id="ipython_notebook" class="nav brand pull-left"><a href="/tree/" alt='dashboard'><img src='/static/base/images/ipynblogo.png?v=5892b775169dd3ddb0c9ec906f4183de' alt='IPython Notebook'/></a></div>

    </div>
  </div>
</div>

<div id="site">

<div class="error">

    <h1>404 : Not Found</h1>

<p>You are requesting a page that does not exist!</p>

</header>

</div>

<script src="/static/components/jquery/jquery.min.js?v=b29c22eae459aa715cdd8fa340bb6e29" type="text/javascript" charset="utf-8"></script>
<script src="/static/components/jquery-ui/ui/minified/jquery-ui.min.js?v=ec9758d9508e2fd22ddbdc6d5a28f214" type="text/javascript" charset="utf-8"></script>
<script src="/static/components/bootstrap/bootstrap/js/bootstrap.min.js?v=e4dde0b2c0d413f5fe96995e9aec1f0b" type="text/javascript" charset="utf-8"></script>
<script src="/static/base/js/namespace.js?v=ac80ae57ae138eb48cc4fad6e507a461" type="text/javascript" charset="utf-8"></script>
<script src="/static/base/js/page.js?v=8cff843ac51ad2c78fefd590fdeffaf4" type="text/javascript" charset="utf-8"></script>
<script src="/static/auth/js/loginwidget.js?v=9704cc6d38aa3d5d0f9201416aec9086" type="text/javascript" charset="utf-8"></script>

<script src="/static/custom/custom.js?v=ac0e144e4e80bfc108e6bbc1dc325d09" type="text/javascript" charset="utf-8"></script>

</body>

</html>

Ipython says that:

WARNING:tornado.access:404 POST /execute/mysession (::1) 9.10ms referer=None

gregsexton commented 8 years ago

I think your dependencies are all dated. I'd suggest either upgrading to latest jupyter stuff (4.x anyway - 5 may not work yet) or you could try the branch of ob-ipython ipython3. I deliberately kept this around for older dependencies. You'll need to check this out and install manually though.

hooger commented 7 years ago

Thank you for the answer (and sorry for the slow reply :( ). I upgraded jupyter and the necessary libraries from pip and it worked. I haven't tested your branch.