Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ipython notebook - kernel dies if matplotlib is not installed #990

Closed
thisch opened this Issue · 3 comments

3 participants

@thisch

I got the following backtrace while loading an example notebook file in docs/examples/notebook:

# ipython notebook --pylab=inline
[NotebookApp] Using existing profile dir: u'/home/thomas/.config/ipython/profile_default'
[NotebookApp] The IPython Notebook is running at: http://127.0.0.1:8888
[1110/222429:ERROR:nss_util.cc(80)] Failed to create /home/thomas/.pki/nssdb directory.
WARNING:root:404 GET /static/mathjax/MathJax.js?config=TeX-AMS_HTML (127.0.0.1) 0.64ms
[NotebookApp] Kernel started: 6b8f132c-6e72-4441-8b87-e4bde375adcc
[IPKernelApp] To connect another client to this kernel, use:
[IPKernelApp] --existing kernel-6b8f132c-6e72-4441-8b87-e4bde375adcc.json
[NotebookApp] Connecting to: tcp://127.0.0.1:44514
[NotebookApp] Connecting to: tcp://127.0.0.1:59769
[NotebookApp] Connecting to: tcp://127.0.0.1:51183
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/thomas/gitrepos/ipython/docs/examples/notebooks/<string> in <module>()

/usr/lib/python2.7/site-packages/IPython/zmq/ipkernel.pyc in main()
    787     """Run an IPKernel as an application"""
    788     app = IPKernelApp.instance()
--> 789     app.initialize()
    790     app.start()
    791 

/usr/lib/python2.7/site-packages/IPython/zmq/ipkernel.pyc in initialize(self=<IPython.zmq.ipkernel.IPKernelApp object>, argv=None)

/usr/lib/python2.7/site-packages/IPython/config/application.pyc in catch_config_error(method=<function initialize>, app=<IPython.zmq.ipkernel.IPKernelApp object>, *args=(None,), **kwargs={})
     82     """
     83     try:
---> 84         return method(app, *args, **kwargs)
        global d = undefined
        global Sg = undefined
        global xq = undefined
        global j = undefined
        global D = undefined
        global t = undefined
        global k = undefined
        global rM = undefined
        global n = undefined
        global q = undefined
     85     except (TraitError, ArgumentError) as e:
     86         app.print_description()

/usr/lib/python2.7/site-packages/IPython/zmq/ipkernel.pyc in initialize(self=<IPython.zmq.ipkernel.IPKernelApp object>, argv=None)
    737     @catch_config_error
    738     def initialize(self, argv=None):
--> 739         super(IPKernelApp, self).initialize(argv)
    740         self.init_shell()
    741         self.init_extensions()

/usr/lib/python2.7/site-packages/IPython/zmq/kernelapp.pyc in initialize(self=<IPython.zmq.ipkernel.IPKernelApp object>, argv=None)

/usr/lib/python2.7/site-packages/IPython/config/application.pyc in catch_config_error(method=<function initialize>, app=<IPython.zmq.ipkernel.IPKernelApp object>, *args=(None,), **kwargs={})
     82     """
     83     try:
---> 84         return method(app, *args, **kwargs)
        global d = undefined
        global Sg = undefined
        global xq = undefined
        global j = undefined
        global D = undefined
        global t = undefined
        global k = undefined
        global rM = undefined
        global n = undefined
        global q = undefined
     85     except (TraitError, ArgumentError) as e:
     86         app.print_description()

/usr/lib/python2.7/site-packages/IPython/zmq/kernelapp.pyc in initialize(self=<IPython.zmq.ipkernel.IPKernelApp object>, argv=None)
    287         self.write_connection_file()
    288         self.init_io()
--> 289         self.init_kernel()
    290 
    291     def start(self):

/usr/lib/python2.7/site-packages/IPython/zmq/ipkernel.pyc in init_kernel(self=<IPython.zmq.ipkernel.IPKernelApp object>)
    745 
    746         if self.pylab:
--> 747             gui, backend = pylabtools.find_gui_and_backend(self.pylab)
    748 
    749         kernel = Kernel(config=self.config, session=self.session,

/usr/lib/python2.7/site-packages/IPython/lib/pylabtools.pyc in find_gui_and_backend(gui='inline')
    195     """
    196 
--> 197     import matplotlib
    198 
    199     if gui and gui != 'auto':

ImportError: No module named matplotlib

Somewhere in the core code there should be a check for dependencies which are required for a successful startup of the ipython notebook. Another solution could be to just output an error message inside the notebook browser tab (and deny further edits) instead of showing the ¨kernel has died¨ error message. What do you think?

@fperez
Owner

Agreed, we should provide a more informative error here; thanks for the report.

@minrk
Owner

See PR #991 for a fix, where not only is the message more informative, but the kernel actually continues to start, even without pylab.

@fperez
Owner

MMh, auto-close seems not to be working... Closed by ec0c00d

@fperez fperez closed this
@mdboom mdboom referenced this issue from a commit in mdboom/ipython
@minrk minrk Show traceback, continuing to start kernel if pylab init fails
Error message goes directly over stderr (and traceback over stdout),
rather than as a pyerr message, which is associated with a particular
frontend, and thus ignored because startup actions were not requested
by anyone.

This better matches the terminal behavior, where `ipython --pylab` without matplotlib
installed shows a traceback, but continues to start.

In the qtconsole the traceback will come in below the banner, but in the notebook
the message will not arrive until after the first execution.

closes gh-990, closes gh-991.
ec0c00d
@fperez fperez referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
@minrk minrk Show traceback, continuing to start kernel if pylab init fails
Error message goes directly over stderr (and traceback over stdout),
rather than as a pyerr message, which is associated with a particular
frontend, and thus ignored because startup actions were not requested
by anyone.

This better matches the terminal behavior, where `ipython --pylab` without matplotlib
installed shows a traceback, but continues to start.

In the qtconsole the traceback will come in below the banner, but in the notebook
the message will not arrive until after the first execution.

closes gh-990, closes gh-991.
8a84deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.