Senior R&D Manager (Data Science) at Synopsys Software Integrity Group and Treasurer at Farset Labs
However, a while ago something strange happened to my set up and I’m not entirely sure when or how but either way, here’s how I ‘fixed’ it.
TL;DR Can’t execute anything at all using Chrome, works fine in other browsers.
WebSocket connection failed
A WebSocket connection could not be established. You will NOT be able to run code. Check your network connection or notebook server configuration
This was accompanied by a JS console error (rightclick anywhere in Chrome and ‘Inspect Element’ will open up the dev tools)
WebSocket connection to ‘wss://localhost:8888/api/kernels/a893ce6e-3a3d-4a99-afc0-b02368245d32/stdin’ failed: WebSocket is closed before the connection is established.
No unexpected error messages show up in the
ipython notebook --debug log.
- Latest Chrome (36.0)
- Fully updated Linux Mint 17 Qiana
- Password protected notebooks configured. No change to configuration files since before ‘issue’
This is a surprisingly difficult thing to Google and I got many ‘that kinda looks like my problem but not quite’, so here’s a quick off the top of my head list of the things I tried.
Chromes proxy is screwed, use ip address instead of ‘localhost’ (also tried FQDN and a few other things), as well as clearing cache, etc Interestingly, Chromes Proxy configuration defaults to the system setting which was all disabled anyway so this was a long shot.
Maybe Chromes Websocket implementation is stuffed, or I’d played with a ‘flag’, so reset all to defaults. Nope.
IPython install broken somehow? As per the instructions I’d launched a
iptestand all came back within bounds (however, the
js/notebooktests were disabled and I can’t find any instruction anywhere as to enabling them, lemme know in the comments.
Tornado conflict? Every so often Tornado does a ‘breaking update’ so maybe there’s some update-race-condition. Also the Quickstart implies that Tornado 2.1 is the required version, so I tried it out, no joy.
Another process occupying the same port? This was reported as a potential problem on some Mac machines but at this point I was getting desparate. Quick
lsofstuffed that idea.
I’ll be the first to admit, this ‘fix’ doesn’t actually fix is so much as side-steps the breaking condition by wrapping the whole conversation into an SSL tunnel.
Long story short, enable HTTPS and generate a self-signed cert
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
And in either your customised profile or in the
ipython_notebook_config.py file in