Is it possible to run bokeh app in notebook enviroment ?

Currently, it seems I have to use bokeh command to run bokeh app and underneath it would start bokeh server. This means once I run the bokeh app, I have no way to change it.

I am wondering is it possible to run in notebook enviroment. So that I can develop bokeh app in an interactive enviroment. Maybe I can start bokeh server separately, and submit python code to it, something like that. Is it possible ? Thanks

The following example might help:

N.

Thanks nicolas, I try this example in the bokeh master, but nothing displayed in my jupyter. And no errors output either. What do I miss ?

在 2017年3月23日星期四 UTC+8下午10:28:27,nicolas.fr写道:

···

The following example might help:

https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb
N.

You can start the bokeh server with

bokeh serve

``

And then develop your app in a notebook.

from bokeh.plotting import figure
from bokeh.layouts import layout
from bokeh.client import push_session
from bokeh.document import Document

create bokeh document

doc = Document()
session = push_session(doc)

prepare some data

x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

create a new plot with a title and axis labels

p = figure(title=“simple line example”, x_axis_label=‘x’, y_axis_label=‘y’)

add a line renderer with legend and line thickness

p.line(x, y, legend=“Temp.”, line_width=2)

prepare the layout

sizing_mode = ‘fixed’
l = layout([
[p],
], sizing_mode=sizing_mode)

put the layout in the session

print 'http://localhost:5006/?bokeh-session-id='+session.id
session.show(l) # open the document in a browser
session.loop_until_closed() # run forever

``

···

Le jeudi 23 mars 2017 14:35:58 UTC+1, Jeff Zhang a écrit :

Currently, it seems I have to use bokeh command to run bokeh app and underneath it would start bokeh server. This means once I run the bokeh app, I have no way to change it.

I am wondering is it possible to run in notebook enviroment. So that I can develop bokeh app in an interactive enviroment. Maybe I can start bokeh server separately, and submit python code to it, something like that. Is it possible ? Thanks

Please also note this will be possible with the upcoming 0.12.5 release:

  https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb

I would say that will be the simplest and also recommended way to accomplish this after 0.12.5 is released.

Bryan

···

On Apr 2, 2017, at 07:01, [email protected] wrote:

You can start the bokeh server with

bokeh serve

And then develop your app in a notebook.

from bokeh.plotting import figure
from bokeh.layouts import layout
from bokeh.client import push_session
from bokeh.document import Document

# create bokeh document
doc = Document()
session = push_session(doc)

# prepare some data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

# create a new plot with a title and axis labels
p = figure(title="simple line example", x_axis_label='x', y_axis_label='y')

# add a line renderer with legend and line thickness
p.line(x, y, legend="Temp.", line_width=2)

# prepare the layout
sizing_mode = 'fixed'
l = layout([
    [p],
    ], sizing_mode=sizing_mode)

# put the layout in the session
print 'http://localhost:5006/?bokeh-session-id='+session.id
session.show(l) # open the document in a browser
session.loop_until_closed() # run forever

Le jeudi 23 mars 2017 14:35:58 UTC+1, Jeff Zhang a écrit :

Currently, it seems I have to use bokeh command to run bokeh app and underneath it would start bokeh server. This means once I run the bokeh app, I have no way to change it.
I am wondering is it possible to run in notebook enviroment. So that I can develop bokeh app in an interactive enviroment. Maybe I can start bokeh server separately, and submit python code to it, something like that. Is it possible ? Thanks

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d452608b-b664-4744-a114-9db43498be9c%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Thanks Bryan, I tried 0.12.5, but see the following errors in jupyter server log

[I 15:58:00.809 NotebookApp] Kernel started: 17ec8d0e-fb8a-4073-bf4d-e6ad15f325c8

[W 15:58:00.966 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20170406155739 (127.0.0.1) 1.98ms referer=http://localhost:8889/notebooks/Bokeh_Tutorial.ipynb

WARNING:tornado.access:403 GET /ws?bokeh-protocol-version=1.0&bokeh-session-id=INapVvOsP94O8HUxRzvVcH926Cq0pYL7mLbGKH2tFTJv (127.0.0.1) 1.78ms

WARNING:tornado.access:403 GET /ws?bokeh-protocol-version=1.0&bokeh-session-id=kZNtnuwCBZ43YHmw23B1JuA4ELpOOsMKaWYlPyMWmyCs (127.0.0.1) 1.63ms

ERROR:tornado.application:Exception in callback functools.partial(<function wrap..null_wrapper at 0x10ef32488>, <tornado.concurrent.Future object at 0x10ef0d780>)

Traceback (most recent call last):

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/ioloop.py”, line 604, in _run_callback

ret = callback()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/stack_context.py”, line 275, in null_wrapper

return fn(*args, **kwargs)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/ioloop.py”, line 619, in

self.add_future(ret, lambda f: f.result())

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/tornado.py”, line 343, in cleanup_sessions

yield app.cleanup_sessions(self._unused_session_linger_milliseconds)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 253, in cleanup_sessions

yield self._discard_session(session, should_discard_ignoring_block)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 226, in _discard_session

yield session.with_document_locked(do_discard)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1024, in run

yielded = self.gen.send(value)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 48, in _needs_document_lock_wrapper

result = yield yield_for_all_futures(func(self, *args, **kwargs))

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 151, in with_document_locked

return func(*args, **kwargs)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 221, in do_discard

session.destroy()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 116, in destroy

self._document.remove_on_change(self)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/document.py”, line 596, in remove_on_change

del self._callbacks[callback]

KeyError: <bokeh.server.session.ServerSession object at 0x10f2b4518>

ERROR:tornado.application:Exception in callback functools.partial(<function wrap..null_wrapper at 0x10f80b730>, <tornado.concurrent.Future object at 0x10f2b4208>)

Traceback (most recent call last):

Bryan Van de ven [email protected]于2017年4月5日周三 下午12:31写道:

···

Please also note this will be possible with the upcoming 0.12.5 release:

    [https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb](https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb)

I would say that will be the simplest and also recommended way to accomplish this after 0.12.5 is released.

Bryan

On Apr 2, 2017, at 07:01, [email protected] wrote:

You can start the bokeh server with

bokeh serve

And then develop your app in a notebook.

from bokeh.plotting import figure

from bokeh.layouts import layout

from bokeh.client import push_session

from bokeh.document import Document

create bokeh document

doc = Document()

session = push_session(doc)

prepare some data

x = [1, 2, 3, 4, 5]

y = [6, 7, 2, 4, 5]

create a new plot with a title and axis labels

p = figure(title=“simple line example”, x_axis_label=‘x’, y_axis_label=‘y’)

add a line renderer with legend and line thickness

p.line(x, y, legend=“Temp.”, line_width=2)

prepare the layout

sizing_mode = ‘fixed’

l = layout([

[p],
], sizing_mode=sizing_mode)

put the layout in the session

print 'http://localhost:5006/?bokeh-session-id='+session.id

session.show(l) # open the document in a browser

session.loop_until_closed() # run forever

Le jeudi 23 mars 2017 14:35:58 UTC+1, Jeff Zhang a écrit :

Currently, it seems I have to use bokeh command to run bokeh app and underneath it would start bokeh server. This means once I run the bokeh app, I have no way to change it.

I am wondering is it possible to run in notebook enviroment. So that I can develop bokeh app in an interactive enviroment. Maybe I can start bokeh server separately, and submit python code to it, something like that. Is it possible ? Thanks

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d452608b-b664-4744-a114-9db43498be9c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/85EB4236-B616-41FE-B7CB-3DC83ACCEE0A%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

What version of tornado and the notebook do you have installed?

···

On Apr 6, 2017, at 03:02, Jeff Zhang [email protected] wrote:

Thanks Bryan, I tried 0.12.5, but see the following errors in jupyter server log

[I 15:58:00.809 NotebookApp] Kernel started: 17ec8d0e-fb8a-4073-bf4d-e6ad15f325c8

[W 15:58:00.966 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20170406155739 (127.0.0.1) 1.98ms referer=http://localhost:8889/notebooks/Bokeh_Tutorial.ipynb

WARNING:tornado.access:403 GET /ws?bokeh-protocol-version=1.0&bokeh-session-id=INapVvOsP94O8HUxRzvVcH926Cq0pYL7mLbGKH2tFTJv (127.0.0.1) 1.78ms

WARNING:tornado.access:403 GET /ws?bokeh-protocol-version=1.0&bokeh-session-id=kZNtnuwCBZ43YHmw23B1JuA4ELpOOsMKaWYlPyMWmyCs (127.0.0.1) 1.63ms

ERROR:tornado.application:Exception in callback functools.partial(<function wrap..null_wrapper at 0x10ef32488>, <tornado.concurrent.Future object at 0x10ef0d780>)

Traceback (most recent call last):

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/ioloop.py”, line 604, in _run_callback

ret = callback()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/stack_context.py”, line 275, in null_wrapper

return fn(*args, **kwargs)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/ioloop.py”, line 619, in

self.add_future(ret, lambda f: f.result())

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/tornado.py”, line 343, in cleanup_sessions

yield app.cleanup_sessions(self._unused_session_linger_milliseconds)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 253, in cleanup_sessions

yield self._discard_session(session, should_discard_ignoring_block)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 226, in _discard_session

yield session.with_document_locked(do_discard)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1024, in run

yielded = self.gen.send(value)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 48, in _needs_document_lock_wrapper

result = yield yield_for_all_futures(func(self, *args, **kwargs))

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 151, in with_document_locked

return func(*args, **kwargs)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 221, in do_discard

session.destroy()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 116, in destroy

self._document.remove_on_change(self)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/document.py”, line 596, in remove_on_change

del self._callbacks[callback]

KeyError: <bokeh.server.session.ServerSession object at 0x10f2b4518>

ERROR:tornado.application:Exception in callback functools.partial(<function wrap..null_wrapper at 0x10f80b730>, <tornado.concurrent.Future object at 0x10f2b4208>)

Traceback (most recent call last):

Bryan Van de ven [email protected]于2017年4月5日周三 下午12:31写道:

Please also note this will be possible with the upcoming 0.12.5 release:

    [https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb](https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb)

I would say that will be the simplest and also recommended way to accomplish this after 0.12.5 is released.

Bryan

On Apr 2, 2017, at 07:01, [email protected] wrote:

You can start the bokeh server with

bokeh serve

And then develop your app in a notebook.

from bokeh.plotting import figure

from bokeh.layouts import layout

from bokeh.client import push_session

from bokeh.document import Document

create bokeh document

doc = Document()

session = push_session(doc)

prepare some data

x = [1, 2, 3, 4, 5]

y = [6, 7, 2, 4, 5]

create a new plot with a title and axis labels

p = figure(title=“simple line example”, x_axis_label=‘x’, y_axis_label=‘y’)

add a line renderer with legend and line thickness

p.line(x, y, legend=“Temp.”, line_width=2)

prepare the layout

sizing_mode = ‘fixed’

l = layout([

[p],
], sizing_mode=sizing_mode)

put the layout in the session

print 'http://localhost:5006/?bokeh-session-id='+session.id

session.show(l) # open the document in a browser

session.loop_until_closed() # run forever

Le jeudi 23 mars 2017 14:35:58 UTC+1, Jeff Zhang a écrit :

Currently, it seems I have to use bokeh command to run bokeh app and underneath it would start bokeh server. This means once I run the bokeh app, I have no way to change it.

I am wondering is it possible to run in notebook enviroment. So that I can develop bokeh app in an interactive enviroment. Maybe I can start bokeh server separately, and submit python code to it, something like that. Is it possible ? Thanks

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d452608b-b664-4744-a114-9db43498be9c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/85EB4236-B616-41FE-B7CB-3DC83ACCEE0A%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAADy7x6k4Fw7R2V9syGWwRYeLJnF4Fp7qa9uJZ9DVFs2rRoyzA%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

It’s weird, it is working now.

Bryan Van de Ven [email protected]于2017年4月6日周四 下午8:37写道:

···

What version of tornado and the notebook do you have installed?

On Apr 6, 2017, at 03:02, Jeff Zhang [email protected] wrote:

Thanks Bryan, I tried 0.12.5, but see the following errors in jupyter server log

[I 15:58:00.809 NotebookApp] Kernel started: 17ec8d0e-fb8a-4073-bf4d-e6ad15f325c8

[W 15:58:00.966 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20170406155739 (127.0.0.1) 1.98ms referer=http://localhost:8889/notebooks/Bokeh_Tutorial.ipynb

WARNING:tornado.access:403 GET /ws?bokeh-protocol-version=1.0&bokeh-session-id=INapVvOsP94O8HUxRzvVcH926Cq0pYL7mLbGKH2tFTJv (127.0.0.1) 1.78ms

WARNING:tornado.access:403 GET /ws?bokeh-protocol-version=1.0&bokeh-session-id=kZNtnuwCBZ43YHmw23B1JuA4ELpOOsMKaWYlPyMWmyCs (127.0.0.1) 1.63ms

ERROR:tornado.application:Exception in callback functools.partial(<function wrap..null_wrapper at 0x10ef32488>, <tornado.concurrent.Future object at 0x10ef0d780>)

Traceback (most recent call last):

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/ioloop.py”, line 604, in _run_callback

ret = callback()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/stack_context.py”, line 275, in null_wrapper

return fn(*args, **kwargs)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/ioloop.py”, line 619, in

self.add_future(ret, lambda f: f.result())

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/tornado.py”, line 343, in cleanup_sessions

yield app.cleanup_sessions(self._unused_session_linger_milliseconds)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 253, in cleanup_sessions

yield self._discard_session(session, should_discard_ignoring_block)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1021, in run

yielded = self.gen.throw(*exc_info)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 226, in _discard_session

yield session.with_document_locked(do_discard)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1015, in run

value = future.result()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/concurrent.py”, line 237, in result

raise_exc_info(self._exc_info)

File “”, line 3, in raise_exc_info

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/tornado/gen.py”, line 1024, in run

yielded = self.gen.send(value)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 48, in _needs_document_lock_wrapper

result = yield yield_for_all_futures(func(self, *args, **kwargs))

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 151, in with_document_locked

return func(*args, **kwargs)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/application_context.py”, line 221, in do_discard

session.destroy()

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/server/session.py”, line 116, in destroy

self._document.remove_on_change(self)

File “/Users/jzhang/anaconda/lib/python3.5/site-packages/bokeh/document.py”, line 596, in remove_on_change

del self._callbacks[callback]

KeyError: <bokeh.server.session.ServerSession object at 0x10f2b4518>

ERROR:tornado.application:Exception in callback functools.partial(<function wrap..null_wrapper at 0x10f80b730>, <tornado.concurrent.Future object at 0x10f2b4208>)

Traceback (most recent call last):

Bryan Van de ven [email protected]于2017年4月5日周三 下午12:31写道:

Please also note this will be possible with the upcoming 0.12.5 release:

    [https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb](https://github.com/bokeh/bokeh/blob/master/examples/howto/server_embed/notebook_embed.ipynb)

I would say that will be the simplest and also recommended way to accomplish this after 0.12.5 is released.

Bryan

On Apr 2, 2017, at 07:01, [email protected] wrote:

You can start the bokeh server with

bokeh serve

And then develop your app in a notebook.

from bokeh.plotting import figure

from bokeh.layouts import layout

from bokeh.client import push_session

from bokeh.document import Document

create bokeh document

doc = Document()

session = push_session(doc)

prepare some data

x = [1, 2, 3, 4, 5]

y = [6, 7, 2, 4, 5]

create a new plot with a title and axis labels

p = figure(title=“simple line example”, x_axis_label=‘x’, y_axis_label=‘y’)

add a line renderer with legend and line thickness

p.line(x, y, legend=“Temp.”, line_width=2)

prepare the layout

sizing_mode = ‘fixed’

l = layout([

[p],
], sizing_mode=sizing_mode)

put the layout in the session

print 'http://localhost:5006/?bokeh-session-id='+session.id

session.show(l) # open the document in a browser

session.loop_until_closed() # run forever

Le jeudi 23 mars 2017 14:35:58 UTC+1, Jeff Zhang a écrit :

Currently, it seems I have to use bokeh command to run bokeh app and underneath it would start bokeh server. This means once I run the bokeh app, I have no way to change it.

I am wondering is it possible to run in notebook enviroment. So that I can develop bokeh app in an interactive enviroment. Maybe I can start bokeh server separately, and submit python code to it, something like that. Is it possible ? Thanks

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/d452608b-b664-4744-a114-9db43498be9c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/85EB4236-B616-41FE-B7CB-3DC83ACCEE0A%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/CAADy7x6k4Fw7R2V9syGWwRYeLJnF4Fp7qa9uJZ9DVFs2rRoyzA%40mail.gmail.com.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/108CD9C0-61C1-42E9-982C-F356D7294226%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.