question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bokeh not rendering, stuck on Loading BokehJS [BUG]

See original GitHub issue

Hi,

Yesterday I had Bokeh version 0.12 or something like that running on windows 10 (so within Anaconda). I decided to upgrade to version 2.0.2 within the notebook using !pip install bokeh --upgrade and it seems to have been a terrible mistake. Now I cannot even plot the simplest things. I do the imports as follows and try to plot just a simple line

from bokeh.models import Slider, ColumnDataSource, Button, Panel, Tabs, CategoricalColorMapper, HoverTool, Select
from bokeh.io import push_notebook,  output_notebook, reset_output
from bokeh.plotting import figure, show #, output_file
from bokeh.layouts import gridplot, row, column
from bokeh.palettes import Category10
# from bokeh.resources import INLINE
# import bokeh.io

# bokeh.io.output_notebook(INLINE)

from numpy.random import random
import sys


# output_notebook()
output_notebook()#hide_banner=True)  #Este comando se necesita para hacer el embedding the los plots!!!!!

This just gives Loading BokehJS ... and the jupyter cell moves on to the next one but it doesn’t successfully loads Bokeh. Then, trying to run

p = figure()
p.line(x=[2,4,5,6,7], y=[3,4,5,7,9])
show(p) 

does nothing…

As you can tell I have already tried the solution bokeh.io.output_notebook(INLINE) but it just doesn’t do the trick.

When running !bokeh info in the jupyter notebook I get:

Python version      :  3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
IPython version     :  7.6.1
Tornado version     :  6.0.3
Bokeh version       :  2.0.2
BokehJS static path :  c:\users\cuspi\anaconda3\lib\site-packages\bokeh\server\static
node.js version     :  (not installed)
npm version         :  (not installed)```

I have tried this on Chrome, Firefox and Explorer. I do get a couple of errors in the JS console:
```VM40:258 Uncaught TypeError: Bokeh.set_log_level is not a function
    at inline_js (eval at append_javascript (outputarea.js:763), <anonymous>:258:13)
    at run_inline_js (eval at append_javascript (outputarea.js:763), <anonymous>:271:20)
    at eval (eval at append_javascript (outputarea.js:763), <anonymous>:293:7)
    at eval (eval at append_javascript (outputarea.js:763), <anonymous>:179:11)
    at Array.forEach (<anonymous>)
    at run_callbacks (eval at append_javascript (outputarea.js:763), <anonymous>:177:36)
    at HTMLScriptElement.on_load (eval at append_javascript (outputarea.js:763), <anonymous>:207:9)
    at window._Events.handleClearOutput (eval at append_javascript (outputarea.js:763), <anonymous>:36:26)
    at window._Events.dispatch (jquery.min.js:2)
    at window._Events.y.handle (jquery.min.js:2)
    at Object.trigger (jquery.min.js:2)
    at window._Events.<anonymous> (jquery.min.js:2)
    at Function.each (jquery.min.js:2)
    at w.fn.init.each (jquery.min.js:2)
    at w.fn.init.trigger (jquery.min.js:2)
    at w.fn.init.events.trigger (events.js:31)
    at CodeCell.clear_output (codecell.js:544) Arguments(2) ["clear_output.CodeCell", {…}, callee: (...), Symbol(Symbol.iterator): ƒ]

And finally:

    at embed_document (<anonymous>:6:20)
    at <anonymous>:10:5
    at <anonymous>:26:3
    at window._Events.handleAddOutput (eval at append_javascript (outputarea.js:763), <anonymous>:76:60)
    at window._Events.dispatch (jquery.min.js:2)
    at window._Events.y.handle (jquery.min.js:2)
    at Object.trigger (jquery.min.js:2)
    at window._Events.<anonymous> (jquery.min.js:2)
    at Function.each (jquery.min.js:2)
    at w.fn.init.each (jquery.min.js:2)

To be honest, I don’t know what they mean, if there is some problem with my installation, or with bokeh or what is going on.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
mattpapcommented, Jul 7, 2020

The problem boils down to this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <div id="FooBarBaz">Foo Bar Baz</div>
    <script type="text/javascript">
      if (typeof window.FooBarBaz !== "undefined") {
        const text = document.createTextNode(`window.FooBarBaz == ${window.FooBarBaz} with "${window.FooBarBaz.textContent}"`)
        document.body.appendChild(text)
      }
    </script>
  </body>
</html>

i.e. setting id on an element, creates a global variable with the same name as the ID. Whenever I think that web browsers can’t sink any lower, then there’s another day to prove me wrong.

Jupyter exposes this behavior, as it converts e.g. # Bokeh Markdown markup into <h1 id=Bokeh>Bokeh</h1>, which in turn defines window.Bokeh = (... ref to h1 node ...), which conflicts later with initialization of bokehjs.

error doesn’t happen with Bokeh 1.4.1, but with 2.0 and 2.1 (I didn’t test with other versions in between)

This is because starting with bokeh 2.x, it’s now possible to load multiple versions of bokehjs into a page without any additional setup, but this seems not to work well, when window.Bokeh is clobbered with an unrelated object. Previously window.Bokeh was just overwritten, so the issue wasn’t visible. This is something that we can improve.

I also think that Jupyter’s behavior could be improved, by not generating simple IDs from content (at least use jp- prefix).

2reactions
bryevdvcommented, May 9, 2020

Hi @cuspime Have you tried this with other browsers/OS yet, as suggested in the SO comments? Have you force-reloading the page, clearing cache, or loading in a private browser? The only way to make any progress on this problem that is specific to your situation is to narrow down what about your specific situation is causing the issue. What version of notebook do you have installed? Can you also try with Jupyterlab instead of classic notebook?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bokeh not rendering, stuck on Loading BokehJS
As you can tell I have already tried the solution bokeh.io.output_notebook(INLINE) but it just doesn't do the trick. When running !bokeh info in ......
Read more >
The bokeh graph is not displaying in Jupyter. It just says ...
The bokeh graph is not displaying in Jupyter. It just says "Loading BokehJS ..." ... I log in with the jupyter notebook, and...
Read more >
Javascript Bokeh Plot Not Rendering In Browser - ADocLib
Bokeh not rendering, stuck on Loading BokehJS [BUG] #10002 I do get a couple of errors in the JS console: VM40:258 Uncaught TypeError:...
Read more >
python-bokeh-0.12.15-bp151.3.2 - SUSE Package Hub -
'py' first + #7602 Bokeh should not instance its loggers using: ... renderer causes error + #7370 [component: bokehjs] Regression in graph rendering...
Read more >
bokeh Changelog - pyup.io
9927 [component: bokehjs] [BUG] MultiChoice displayed value is not updating - 10002 [component: bokehjs] Bokeh not rendering, stuck on Loading BokehJS [BUG]
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found