Notebook: AttributeError: 'MappingKernelManager' object has no attribute 'notify_disconnect'

Created on 10 Apr 2017  路  10Comments  路  Source: jupyter/notebook

I'm using Amazon EMR, have been using Jupyter for a while, and this bug only occurs in notebook version 5.0.0 (when downgrading doesn't happen)
System Info:

Python 2.7.12 (default, Sep 1 2016, 22:14:00)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]

Package was installed through

sudo pip install jupyter

The error happens upon startup (and happens every second):

[E 08:38:26.922 NotebookApp] Uncaught exception GET /api/kernels/178bc25f-a0df-45b8-8f2b-fc20981b5442/channels?session_id=BBA1AF96CF8E409F9D7B9B719FF8BC4C (PC_IP)
HTTPServerRequest(protocol='http', host='SERVER_ADDRESS:8192', method='GET', uri='/api/kernels/178bc25f-a0df-45b8-8f2b-fc20981b5442/channels?session_id=BBA1AF96CF8E409F9D7B9B719FF8BC4C', version='HTTP/1.1', remote_ip='PC_IP', headers={'Origin': 'SERVER_ADDRESS:8192', 'Upgrade': 'websocket', 'Accept-Language': 'en-US,en;q=0.8,he;q=0.6', 'Accept-Encoding': 'gzip, deflate, sdch', 'Sec-Websocket-Version': '13', 'Host': 'SERVER_ADDRESS:8192', 'Sec-Websocket-Key': '60sPxVJH55FRmcfiWa4rLg==', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.110 Safari/537.36', 'Connection': 'Upgrade', 'Cookie': '_xsrf=2|0ce7cbe4|39bf26da05bb4ba993796fae6865dcd2|1491812725; username-SERVER_ADDRESS-8192="2|1:0|10:1491812736|56:username-SERVER_ADDRESS-8192|44:MTg4YzU2MWY2ZjgwNGM2MDhhZTM4OTQzZjBmZWFiZDE=|4b874c578a0b1f0ad6022446077262ea093c4c19e9fc6c69e332a0488cc55797"', 'Pragma': 'no-cache', 'Cache-Control': 'no-cache', 'Sec-Websocket-Extensions': 'permessage-deflate; client_max_window_bits'})

Traceback (most recent call last):

  File "/usr/local/lib64/python2.7/site-packages/tornado/web.py", line 1425, in _stack_context_handle_exception
    raise_exc_info((type, value, traceback))

  File "/usr/local/lib64/python2.7/site-packages/tornado/stack_context.py", line 314, in wrapped
    ret = fn(*args, **kwargs)

  File "/usr/local/lib64/python2.7/site-packages/tornado/websocket.py", line 364, in on_connection_close
    self.on_close()

  File "/usr/local/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 405, in on_close
    km.notify_disconnect(self.kernel_id)

AttributeError: 'MappingKernelManager' object has no attribute 'notify_disconnect'

(Replaced my PC's IP with PC_IP, and server address with SERVER_ADDRESS)

Any idea what might cause it?

Needs Info Environment

Most helpful comment

So as it seems, it might have something to do with the pip install.
The exact steps I took to make it work:

sudo pip install jupyter
sudo pip uninstall notebook
sudo pip install notebook

Really weird, but it does work. I also tried installing the notebook before jupyter, still shows the same error. Maybe there's something wrong with the dependencies?

All 10 comments

Are you using the --NotebookApp.base_url flag when starting the notebook server? If so, there is a known bug and outstanding PR: https://github.com/jupyter/notebook/pull/2385

No, not using that flag.
Only flags are

NotebookApp.ip
NotebookApp.open_browser
NotebookApp.port
NotebookApp.extra_template_paths
NotebookApp.password
Exporter.template_path

Provided on startup through the config argument

Hmmm 馃

@minrk Any thoughts?

So as it seems, it might have something to do with the pip install.
The exact steps I took to make it work:

sudo pip install jupyter
sudo pip uninstall notebook
sudo pip install notebook

Really weird, but it does work. I also tried installing the notebook before jupyter, still shows the same error. Maybe there's something wrong with the dependencies?

That's really weird because notify_disconnect is defined. It is a new method in 5.0. Since uninstalling and reinstalling did work, my only thought is that the notebook package got partially upgraded somehow, such that some files were from pre-5.0 (kernelmanager.py) and some were from 5.0 (handlers.py). This has been known to happen in rare cases of mixing conda and pip and/or upgrading with the notebook running on Windows, but I've never been able to put together a reproducible test case.

My case is 100% reproducible, the machine itself runs on an EMR 5.3.1 image, and there was no previous version of the notebook installed, so I'm not sure it's an upgrade.
Seeing as my case is reproducible would you like me to test out things extract more information? I would be glad to help in any way.

this will work!
pip3 install --ignore-installed tornado==4.4.3

Thanks @amirsch . The steps you mentioned worked for me !
https://github.com/jupyter/notebook/issues/2391#issuecomment-294732258

You saved my day!!! @amirsch

My jupyter notebooks did not display any output (and no error) when I executed them, and https://github.com/jupyter/notebook/issues/2391#issuecomment-294732258 did solve the issue 馃憤

Was this page helpful?
0 / 5 - 0 ratings