New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output_notebook() fails with TypeError: OutputArea.prototype.mime_types is not a function #7005

Closed
David-Herman opened this Issue Oct 3, 2017 · 10 comments

Comments

Projects
None yet
6 participants
@David-Herman
Contributor

David-Herman commented Oct 3, 2017

Hello,

I am running Chrome Version 61.0.3163.100 (Official Build) (64-bit) on Win-7 64-Bit

with Bokeh 0.12.7 Juptyer Notebook 5.0.0 ,and Py 3.6.2, output_notebook() works, while

with Bokeh 0.12.9, Juptyer Notebook 4.0.6, and Py 2.7.10, output_notebook() fails with the follow result

Loading BokehJS ...
Javascript error adding output!
TypeError: OutputArea.prototype.mime_types is not a function
See your browser Javascript console for more details.
TypeError: OutputArea.prototype.mime_types is not a function
    at eval (eval at append_javascript (outputarea.js:625), <anonymous>:130:30)
    at eval (eval at append_javascript (outputarea.js:625), <anonymous>:266:2)
    at OutputArea.append_javascript (outputarea.js:625)
    at OutputArea.append_mime_type (outputarea.js:569)
    at OutputArea.append_display_data (outputarea.js:533)
    at OutputArea.append_output (outputarea.js:319)
    at OutputArea.handle_output (outputarea.js:233)
    at output (codecell.js:351)
    at Kernel._handle_output_message (kernel.js:1012)
    at i (jquery.min.js:4)

I did get a CORs policy notice on the console initially about the font in the developer tools but upon restart that error disappeared.

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Oct 3, 2017

Member

As of 0.12.9 the minimum supportable notebook version is 5.0. There is no technical path that will allow Bokeh to support JupyterLab, classic Notebook 5+ and Classic Notebook 4.x and earlier at the same time, with identical code in each. Supporting JupyterLab is imperative for the project, so earlier classic notebook versions below 5.0 cannot be supported. You can downgrade Bokeh, or upgrade your notebook (or use JupyterLab).

Member

bryevdv commented Oct 3, 2017

As of 0.12.9 the minimum supportable notebook version is 5.0. There is no technical path that will allow Bokeh to support JupyterLab, classic Notebook 5+ and Classic Notebook 4.x and earlier at the same time, with identical code in each. Supporting JupyterLab is imperative for the project, so earlier classic notebook versions below 5.0 cannot be supported. You can downgrade Bokeh, or upgrade your notebook (or use JupyterLab).

@mattpap

This comment has been minimized.

Show comment
Hide comment
@mattpap

mattpap Oct 3, 2017

Contributor

@bryevdv, shouldn't there be an informative error message regarding this (e.g. from output_notebook()), similarly to what we do for node.js?

Contributor

mattpap commented Oct 3, 2017

@bryevdv, shouldn't there be an informative error message regarding this (e.g. from output_notebook()), similarly to what we do for node.js?

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Oct 3, 2017

Member

If someone wants to make and test a PR to print some error message if OutputArea.prototype.mime_types does not exist I will happily accept it.

Member

bryevdv commented Oct 3, 2017

If someone wants to make and test a PR to print some error message if OutputArea.prototype.mime_types does not exist I will happily accept it.

@David-Herman

This comment has been minimized.

Show comment
Hide comment
@David-Herman

David-Herman Oct 3, 2017

Contributor

Thank you

Contributor

David-Herman commented Oct 3, 2017

Thank you

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Oct 3, 2017

Member

@David-Herman FYI I am not trying to be gruff about this, but I am severely overextended at the moment. For anyone with a little JS exp who would like to add a warning of some sort, this is the place:

https://github.com/bokeh/bokeh/blob/master/bokeh/core/_templates/autoload_nb_js.js#L122

Member

bryevdv commented Oct 3, 2017

@David-Herman FYI I am not trying to be gruff about this, but I am severely overextended at the moment. For anyone with a little JS exp who would like to add a warning of some sort, this is the place:

https://github.com/bokeh/bokeh/blob/master/bokeh/core/_templates/autoload_nb_js.js#L122

@dorvak

This comment has been minimized.

Show comment
Hide comment
@dorvak

dorvak Oct 9, 2017

I get the identical error using python 3.6.3, bokeh 0.12.9 and jupyter 1.0.0 + notebook 5.1.0 and the following notification inside the notebook:

"application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"<div style='background-color: #fdd'>\\n\"+\n \"<p>\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"</p>\\n\"+\n \"<ul>\\n\"+\n \"<li>re-rerunoutput_notebook()to attempt to load from CDN again, or</li>\\n\"+\n \"<li>use INLINE resources instead, as so:</li>\\n\"+\n \"</ul>\\n\"+\n \"<code>\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"</code>\\n\"+\n \"</div>\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"0929386d-9ee2-41bb-b975-b01fcbcc239b\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"0929386d-9ee2-41bb-b975-b01fcbcc239b\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '0929386d-9ee2-41bb-b975-b01fcbcc239b' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.9.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"0929386d-9ee2-41bb-b975-b01fcbcc239b\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"

dorvak commented Oct 9, 2017

I get the identical error using python 3.6.3, bokeh 0.12.9 and jupyter 1.0.0 + notebook 5.1.0 and the following notification inside the notebook:

"application/vnd.bokehjs_load.v0+json": "\n(function(root) {\n function now() {\n return new Date();\n }\n\n var force = true;\n\n if (typeof (root._bokeh_onload_callbacks) === \"undefined\" || force === true) {\n root._bokeh_onload_callbacks = [];\n root._bokeh_is_loading = undefined;\n }\n\n \n\n \n if (typeof (root._bokeh_timeout) === \"undefined\" || force === true) {\n root._bokeh_timeout = Date.now() + 5000;\n root._bokeh_failed_load = false;\n }\n\n var NB_LOAD_WARNING = {'data': {'text/html':\n \"<div style='background-color: #fdd'>\\n\"+\n \"<p>\\n\"+\n \"BokehJS does not appear to have successfully loaded. If loading BokehJS from CDN, this \\n\"+\n \"may be due to a slow or bad network connection. Possible fixes:\\n\"+\n \"</p>\\n\"+\n \"<ul>\\n\"+\n \"<li>re-rerunoutput_notebook()to attempt to load from CDN again, or</li>\\n\"+\n \"<li>use INLINE resources instead, as so:</li>\\n\"+\n \"</ul>\\n\"+\n \"<code>\\n\"+\n \"from bokeh.resources import INLINE\\n\"+\n \"output_notebook(resources=INLINE)\\n\"+\n \"</code>\\n\"+\n \"</div>\"}};\n\n function display_loaded() {\n var el = document.getElementById(\"0929386d-9ee2-41bb-b975-b01fcbcc239b\");\n if (el != null) {\n el.textContent = \"BokehJS is loading...\";\n }\n if (root.Bokeh !== undefined) {\n if (el != null) {\n el.textContent = \"BokehJS \" + root.Bokeh.version + \" successfully loaded.\";\n }\n } else if (Date.now() < root._bokeh_timeout) {\n setTimeout(display_loaded, 100)\n }\n }\n\n\n function run_callbacks() {\n try {\n root._bokeh_onload_callbacks.forEach(function(callback) { callback() });\n }\n finally {\n delete root._bokeh_onload_callbacks\n }\n console.info(\"Bokeh: all callbacks have finished\");\n }\n\n function load_libs(js_urls, callback) {\n root._bokeh_onload_callbacks.push(callback);\n if (root._bokeh_is_loading > 0) {\n console.log(\"Bokeh: BokehJS is being loaded, scheduling callback at\", now());\n return null;\n }\n if (js_urls == null || js_urls.length === 0) {\n run_callbacks();\n return null;\n }\n console.log(\"Bokeh: BokehJS not loaded, scheduling load and callback at\", now());\n root._bokeh_is_loading = js_urls.length;\n for (var i = 0; i < js_urls.length; i++) {\n var url = js_urls[i];\n var s = document.createElement('script');\n s.src = url;\n s.async = false;\n s.onreadystatechange = s.onload = function() {\n root._bokeh_is_loading--;\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: all BokehJS libraries loaded\");\n run_callbacks()\n }\n };\n s.onerror = function() {\n console.warn(\"failed to load library \" + url);\n };\n console.log(\"Bokeh: injecting script tag for BokehJS library: \", url);\n document.getElementsByTagName(\"head\")[0].appendChild(s);\n }\n };var element = document.getElementById(\"0929386d-9ee2-41bb-b975-b01fcbcc239b\");\n if (element == null) {\n console.log(\"Bokeh: ERROR: autoload.js configured with elementid '0929386d-9ee2-41bb-b975-b01fcbcc239b' but no matching script tag was found. \")\n return false;\n }\n\n var js_urls = [\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.js\", \"https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.9.min.js\"];\n\n var inline_js = [\n function(Bokeh) {\n Bokeh.set_log_level(\"info\");\n },\n \n function(Bokeh) {\n \n },\n function(Bokeh) {\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.css\");\n console.log(\"Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.css\");\n Bokeh.embed.inject_css(\"https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.css\");\n }\n ];\n\n function run_inline_js() {\n \n if ((root.Bokeh !== undefined) || (force === true)) {\n for (var i = 0; i < inline_js.length; i++) {\n inline_js[i].call(root, root.Bokeh);\n }if (force === true) {\n display_loaded();\n }} else if (Date.now() < root._bokeh_timeout) {\n setTimeout(run_inline_js, 100);\n } else if (!root._bokeh_failed_load) {\n console.log(\"Bokeh: BokehJS failed to load within specified timeout.\");\n root._bokeh_failed_load = true;\n } else if (force !== true) {\n var cell = $(document.getElementById(\"0929386d-9ee2-41bb-b975-b01fcbcc239b\")).parents('.cell').data().cell;\n cell.output_area.append_execute_result(NB_LOAD_WARNING)\n }\n\n }\n\n if (root._bokeh_is_loading === 0) {\n console.log(\"Bokeh: BokehJS loaded, going straight to plotting\");\n run_inline_js();\n } else {\n load_libs(js_urls, function() {\n console.log(\"Bokeh: BokehJS plotting callback run at\", now());\n run_inline_js();\n });\n }\n}(window));"

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Oct 9, 2017

Member

@dorvak Respectully, I believe you have some kind of install or system config mixup:

screen shot 2017-10-09 at 07 41 42

Member

bryevdv commented Oct 9, 2017

@dorvak Respectully, I believe you have some kind of install or system config mixup:

screen shot 2017-10-09 at 07 41 42

@bryevdv

This comment has been minimized.

Show comment
Hide comment
@bryevdv

bryevdv Dec 1, 2017

Member

@wtaylor2 you need to upgrade your notebook to version 5.0 or later.

Member

bryevdv commented Dec 1, 2017

@wtaylor2 you need to upgrade your notebook to version 5.0 or later.

@wtaylor2

This comment has been minimized.

Show comment
Hide comment
@wtaylor2

wtaylor2 Dec 1, 2017

wtaylor2 commented Dec 1, 2017

@linwoodc3

This comment has been minimized.

Show comment
Hide comment
@linwoodc3

linwoodc3 Mar 19, 2018

This fix worked for me too.

pip install notebook -U

OR

condo update notebook -y -q

@bryevdv, did #7005 get an alternative to raise an error of some sort? I see that issue was closed/declined because of JupyterLab.

I ran into the error referenced by the OP while doing the holoviews spicy 2017 tutorial; bokeh was already installed so I was a little confused from the error (non Javascript people will get stumped..like me...google the error message, and end up here). Would adding a notebook>=5.0 to setup.py here work?

linwoodc3 commented Mar 19, 2018

This fix worked for me too.

pip install notebook -U

OR

condo update notebook -y -q

@bryevdv, did #7005 get an alternative to raise an error of some sort? I see that issue was closed/declined because of JupyterLab.

I ran into the error referenced by the OP while doing the holoviews spicy 2017 tutorial; bokeh was already installed so I was a little confused from the error (non Javascript people will get stumped..like me...google the error message, and end up here). Would adding a notebook>=5.0 to setup.py here work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment