zjffdu/bkzep

Conflict with bokehjs v2.0.1

Opened this issue · 6 comments

Versions

  • bokeh v2.0.1
  • python v3.6.8
  • zeppelin v 0.8.2
  • amazon-linux-ami 2018.03-release
  • emr v5.28.0
  • Spark v2.4.4
  • Hail v0.2.32
  • Chrome v80.0.3987.149

Observed behavior

In zeppelin, when import bokeh and bkzep an error is fired.
it was working fine with bokeh v2.0.0

Example code that reproduces the issue

%pyspark
from bokeh.io import show, output_notebook
import bkzep
output_notebook(notebook_type='zeppelin')

Stack traceback and/or browser JavaScript console output

Fail to execute line 10: output_notebook(notebook_type='zeppelin')
Traceback (most recent call last):
  File "/tmp/zeppelin_pyspark-5737857176342887979.py", line 380, in <module>
    exec(code, _zcUserQueryNameSpace)
  File "<stdin>", line 10, in <module>
  File "/usr/local/lib/python3.6/site-packages/bokeh/io/output.py", line 111, in output_notebook
    run_notebook_hook(notebook_type, 'load', resources, verbose, hide_banner, load_timeout)
  File "/usr/local/lib/python3.6/site-packages/bokeh/io/notebook.py", line 298, in run_notebook_hook
    return _HOOKS[notebook_type][action](*args, **kw)
  File "/usr/local/lib/python3.6/site-packages/bkzep/io.py", line 161, in load_notebook
    lab_html, lab_js = _load_notebook_html(resources, verbose, hide_banner, load_timeout)
  File "/usr/local/lib/python3.6/site-packages/bkzep/io.py", line 132, in _load_notebook_html
    timeout  = load_timeout
  File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.6/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/bokeh/core/_templates/autoload_nb_js.js", line 1, in top-level template code
    {% extends "autoload_js.js" %}
  File "/usr/local/lib/python3.6/site-packages/bokeh/core/_templates/autoload_js.js", line 88, in top-level template code
    const hashes = {{ bundle.hashes|json }};
  File "/usr/local/lib/python3.6/site-packages/jinja2/environment.py", line 471, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'bundle' is undefined
epugh commented

I am seeing the same issue with Zeppelin 0.90-preview1.

Thanks @mhebrard for reporting this issue, let me take a look at it .

One workaround is not using bkzep (At least bokeh 2.x doesn't need bkzep.

image

epugh commented

@zjffdu thanks for the workaround, I just tested it on the 0.9.0 preview1 release, and your workaround worked! Now I need to learn about BokehJS!

I am also facing this issue, and the work around looks like it relies on an ipython interpreter, but I'm using a pyspark interpreter? I've also tried implementing this fix locally: bokeh/bokeh#9854 (comment) but just get error name 'bundle_for_objs_and_resources' is not defined.

@PeterKnightGE Is it possible for you to use ipyspark which underneath use ipython interpreter. Look at the document here http://zeppelin.apache.org/docs/0.9.0-preview1/interpreter/spark.html#ipyspark-recommended