Damien Avila's Github embed example no longer works with Bokeh 0.5.0 upgrade

Hi All,

I have been using Damian Avila’s May 23rd example embed script as a way of getting Bokeh to work with Flask and display data direct from Postgres:

https://github.com/damianavila/bokeh/commit/d1fdb5169e46088d529025497ae3a8a134f7cf69

Since the release of Bokeh 0.5.0 this example no longer works for me. I am not entirely sure what changed, as all the changelog lists (http://bokeh.pydata.org/docs/release_notes.html#v0-5-0-jul-2014):

v0.5.0 (Jul 2014)

  • Widgets
  • Initial AR integration
  • bokeh.charts (scatter, bar, histogram)
  • improved embedding API
  • minor ticks, plot frame, and log axes
    This doesn’t really give me a granular view of which methods in Bokeh have changed and leaves me with no option but to go through the Git commits to try and figure out what changed and when. I really don’t have the time for that because I am bootstrapping a UI for Postgres data. Right now I am tethered to the 0.4.4 release on my production box, and cannot upgrade.

All help appreciated.

Thanks in advance,

  • Rob N

Hi Rob,

The example was updated too… what is exactly failing for you?

Do you have a traceback available?

Cheers.

Damián.

···

On Tue, Jul 15, 2014 at 2:00 PM, robertlnewman [email protected] wrote:

Hi All,

I have been using Damian Avila’s May 23rd example embed script as a way of getting Bokeh to work with Flask and display data direct from Postgres:

https://github.com/damianavila/bokeh/commit/d1fdb5169e46088d529025497ae3a8a134f7cf69

Since the release of Bokeh 0.5.0 this example no longer works for me. I am not entirely sure what changed, as all the changelog lists (http://bokeh.pydata.org/docs/release_notes.html#v0-5-0-jul-2014):

v0.5.0 (Jul 2014)

  • Widgets
  • Initial AR integration
  • bokeh.charts (scatter, bar, histogram)
  • improved embedding API
  • minor ticks, plot frame, and log axes
    This doesn’t really give me a granular view of which methods in Bokeh have changed and leaves me with no option but to go through the Git commits to try and figure out what changed and when. I really don’t have the time for that because I am bootstrapping a UI for Postgres data. Right now I am tethered to the 0.4.4 release on my production box, and cannot upgrade.

All help appreciated.

Thanks in advance,

  • Rob N

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/F7768E58-031D-4D40-B265-C7F5600756E6%40gmail.com.

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

Hi Damián,

What is the URL for the updated example? I don’t see it anymore in either your fork, not the master Bokeh repo.

The error I am getting is that the plots are not generated. If I look at the URL’s for the dynamically generated JS (under /static/js), I get 404’s, even though they are present on my file system. I get the feeling that the Bokeh server is “looking” in the wrong location for statically generated files.

Thanks for the prompt reply,

  • Rob N
···

On Tue, Jul 15, 2014 at 2:00 PM, robertlnewman [email protected] wrote:

Hi All,

I have been using Damian Avila’s May 23rd example embed script as a way of getting Bokeh to work with Flask and display data direct from Postgres:

https://github.com/damianavila/bokeh/commit/d1fdb5169e46088d529025497ae3a8a134f7cf69

Since the release of Bokeh 0.5.0 this example no longer works for me. I am not entirely sure what changed, as all the changelog lists (http://bokeh.pydata.org/docs/release_notes.html#v0-5-0-jul-2014):

v0.5.0 (Jul 2014)

  • Widgets
  • Initial AR integration
  • bokeh.charts (scatter, bar, histogram)
  • improved embedding API
  • minor ticks, plot frame, and log axes
    This doesn’t really give me a granular view of which methods in Bokeh have changed and leaves me with no option but to go through the Git commits to try and figure out what changed and when. I really don’t have the time for that because I am bootstrapping a UI for Postgres data. Right now I am tethered to the 0.4.4 release on my production box, and cannot upgrade.

All help appreciated.

Thanks in advance,

  • Rob N

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/F7768E58-031D-4D40-B265-C7F5600756E6%40gmail.com.

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

The url for the embed example is https://github.com/ContinuumIO/bokeh/tree/master/examples/embed

You can see there the updated example… probably your feeling is correct. Try the new examples and let me know…

Cheers.

···

On Tue, Jul 15, 2014 at 2:13 PM, robertlnewman [email protected] wrote:

Hi Damián,

What is the URL for the updated example? I don’t see it anymore in either your fork, not the master Bokeh repo.

The error I am getting is that the plots are not generated. If I look at the URL’s for the dynamically generated JS (under /static/js), I get 404’s, even though they are present on my file system. I get the feeling that the Bokeh server is “looking” in the wrong location for statically generated files.

Thanks for the prompt reply,

  • Rob N

On Jul 15, 2014, at 10:07 AM, Damian Avila [email protected] wrote:

Hi Rob,

The example was updated too… what is exactly failing for you?

Do you have a traceback available?

Cheers.

Damián.

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/CAM9Ly3EGLSV-PvGJOmvDZEmRU2%3D0PEdjP09G7w%2B5pwjx1XtB3w%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/09C6AB65-F010-4C2D-B8EC-C224FC3CF70A%40gmail.com.

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

On Tue, Jul 15, 2014 at 2:00 PM, robertlnewman [email protected] wrote:

Hi All,

I have been using Damian Avila’s May 23rd example embed script as a way of getting Bokeh to work with Flask and display data direct from Postgres:

https://github.com/damianavila/bokeh/commit/d1fdb5169e46088d529025497ae3a8a134f7cf69

Since the release of Bokeh 0.5.0 this example no longer works for me. I am not entirely sure what changed, as all the changelog lists (http://bokeh.pydata.org/docs/release_notes.html#v0-5-0-jul-2014):

v0.5.0 (Jul 2014)

  • Widgets
  • Initial AR integration
  • bokeh.charts (scatter, bar, histogram)
  • improved embedding API
  • minor ticks, plot frame, and log axes
    This doesn’t really give me a granular view of which methods in Bokeh have changed and leaves me with no option but to go through the Git commits to try and figure out what changed and when. I really don’t have the time for that because I am bootstrapping a UI for Postgres data. Right now I am tethered to the 0.4.4 release on my production box, and cannot upgrade.

All help appreciated.

Thanks in advance,

  • Rob N

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/F7768E58-031D-4D40-B265-C7F5600756E6%40gmail.com.

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

Damián,

I tried the new examples, and I still get the 404 errors. In the new examples, I don’t see where you specify the path to the static directory?

Note that when running this in production using 0.4.4 I have a tmp directory that is a child of the explicitly defined static directory in order to clean up all the dynamically generated plot js files, otherwise all the requests that we have daily to our application would fill up our disk with the dynamically generated js files (or has that methodology been replaced with the latest version?). I have a cron job that cleans out the plot specific tmp directory hourly.

I don’t see where I can do that in the new examples - all that is there is now a method called autoload_server. The autoload_static method has been removed from the example script.

Finally, the README.md (https://github.com/ContinuumIO/bokeh/tree/master/examples/embed) says:

To see these example you first have to start the bokeh-server, ie.:

$./bokeh-server --backend=memory

in the top level bokeh directory. For widget.py and animated.py use the links provided when you run the script. For app_reveal.py, navigate to

http://127.0.0.1:5000/

With the old release (0.4.4) I would just run:

$ python app_reveal.py

And it would open up port 5000 just fine. Now I get:

$ python app_reveal.py
Using saved session configuration for http://localhost:5006/
To override, pass ‘load_from_config=False’ to Session
Traceback (most recent call last):
File “app_reveal.py”, line 213, in
pop = Population()
File “app_reveal.py”, line 116, in init
self.session.use_doc(‘population_reveal’)
File “/path/src/bokeh/bokeh/session.py”, line 314, in use_doc
self.docid = self.find_doc(name)
File “/path/src/bokeh/bokeh/session.py”, line 295, in find_doc
docs = self.userinfo.get(‘docs’)
File “/path/src/bokeh/bokeh/session.py”, line 258, in userinfo
self._userinfo = self.get_json(url)
File “/path/src/bokeh/bokeh/session.py”, line 249, in get_json
return self.execute_json(‘get’, url, headers=headers, **kwargs)
File “/path/src/bokeh/bokeh/session.py”, line 241, in execute_json
resp = func(url, headers=headers, **kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 468, in get
return self.request(‘GET’, url, **kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 456, in request
resp = self.send(prep, **send_kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 559, in send
r = adapter.send(request, **kwargs)
File “/path/lib/python2.7/site-packages/requests/adapters.py”, line 375, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘localhost’, port=5006): Max retries exceeded with url: /bokeh/userinfo/ (Caused by <class ‘socket.error’>: [Errno 61] Connection refused)

If I specify the arg:

load_from_config=False

in the call to Session as suggested in the STDOUT:

OLD (from Github):

self.session = Session()

NEW (my update based on STDOUT msg above):

self.session = Session(load_from_config=False)

I get the following:

$ python app_reveal.py
Traceback (most recent call last):
File “app_reveal.py”, line 213, in
pop = Population()
File “app_reveal.py”, line 116, in init
self.session.use_doc(‘population_reveal’)
File “/path/src/bokeh/bokeh/session.py”, line 314, in use_doc
self.docid = self.find_doc(name)
File “/path/src/bokeh/bokeh/session.py”, line 295, in find_doc
docs = self.userinfo.get(‘docs’)
File “/path/src/bokeh/bokeh/session.py”, line 258, in userinfo
self._userinfo = self.get_json(url)
File “/path/src/bokeh/bokeh/session.py”, line 249, in get_json
return self.execute_json(‘get’, url, headers=headers, **kwargs)
File “/path/src/bokeh/bokeh/session.py”, line 241, in execute_json
resp = func(url, headers=headers, **kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 468, in get
return self.request(‘GET’, url, **kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 456, in request
resp = self.send(prep, **send_kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 559, in send
r = adapter.send(request, **kwargs)
File “/path/lib/python2.7/site-packages/requests/adapters.py”, line 375, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘localhost’, port=5006): Max retries exceeded with url: /bokeh/userinfo/ (Caused by <class ‘socket.error’>: [Errno 61] Connection refused)

I don’t want to use the built in bokeh server, because this application gets deployed on a production host in a virtualenv using wsgi running under Apache.

Thanks for the help,

  • Rob N
···

On Jul 15, 2014, at 10:30 AM, Damian Avila [email protected] wrote:

The url for the embed example is https://github.com/ContinuumIO/bokeh/tree/master/examples/embed

You can see there the updated example… probably your feeling is correct. Try the new examples and let me know…

Cheers.

On Tue, Jul 15, 2014 at 2:13 PM, robertlnewman [email protected] wrote:
Hi Damián,

What is the URL for the updated example? I don’t see it anymore in either your fork, not the master Bokeh repo.

The error I am getting is that the plots are not generated. If I look at the URL’s for the dynamically generated JS (under /static/js), I get 404’s, even though they are present on my file system. I get the feeling that the Bokeh server is “looking” in the wrong location for statically generated files.

Thanks for the prompt reply,

  • Rob N

On Jul 15, 2014, at 10:07 AM, Damian Avila [email protected] wrote:

Hi Rob,

The example was updated too… what is exactly failing for you?
Do you have a traceback available?

Cheers.

Damián.

On Tue, Jul 15, 2014 at 2:00 PM, robertlnewman [email protected] wrote:
Hi All,

I have been using Damian Avila’s May 23rd example embed script as a way of getting Bokeh to work with Flask and display data direct from Postgres:

https://github.com/damianavila/bokeh/commit/d1fdb5169e46088d529025497ae3a8a134f7cf69

Since the release of Bokeh 0.5.0 this example no longer works for me. I am not entirely sure what changed, as all the changelog lists (http://bokeh.pydata.org/docs/release_notes.html#v0-5-0-jul-2014):
v0.5.0 (Jul 2014)

• Widgets
• Initial AR integration
• bokeh.charts (scatter, bar, histogram)
• improved embedding API
• minor ticks, plot frame, and log axes

This doesn’t really give me a granular view of which methods in Bokeh have changed and leaves me with no option but to go through the Git commits to try and figure out what changed and when. I really don’t have the time for that because I am bootstrapping a UI for Postgres data. Right now I am tethered to the 0.4.4 release on my production box, and cannot upgrade.

All help appreciated.

Thanks in advance,

  • Rob N


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/F7768E58-031D-4D40-B265-C7F5600756E6%40gmail.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/CAM9Ly3EGLSV-PvGJOmvDZEmRU2%3D0PEdjP09G7w%2B5pwjx1XtB3w%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/09C6AB65-F010-4C2D-B8EC-C224FC3CF70A%40gmail.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/CAM9Ly3G7_6d0mn5O3Q-qWOwJVu%3DaanqGDzCjm0tONgiEYyerpQ%40mail.gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi Robert,

I think I see the confusion now. There are a number of different ways to embed Bokeh plots: you might want want the data to reside on the Bokeh server (that is what autoload_server will do) or you might want the data to reside in a sidecar .js script (that is what autoload_static will do). It sounds like the example was updated to use data on the server, but we should probably have it demonstrate both cases. autoload_static has not gone away, and if you want to have the data in separate .js scripts that you clean up, that is what you will want to use (and there is no need to run the Bokeh server for that).

Consider the following code:

  from bokeh.plotting import *
  from bokeh.embed import autoload_static
  from bokeh.resources import CDN
  circle([1,2], [3, 4])
  autoload_static(curplot(), CDN, "foo/bar.js")

That will return two things: a javascript source, and a script tag. In this case the script tag is:

  <script src="foo/bar.js" id="####" async="true" data-bokeh-data="static" data-bokeh-modelid="####" data-bokeh-modeltype="Plot"></script>

Wherever you place the script tag in your document, that is where the plot will appear. The last important thing to note, the data script (the first element returned by autoload_static) needs to be saved by you, in a place where it can be reached. In this case, the script tag looks for "foo/bar.js" but you will want to set the path appropriately for your own setup.

Let me know if this makes sense, or if you need more information. We will add an autoload_static example back into the demo but it may not be until next week some time.

Thanks,

Bryan

···

On Jul 15, 2014, at 2:21 PM, robertlnewman <[email protected]> wrote:

Damián,

I tried the new examples, and I still get the 404 errors. In the new examples, I don't see where you specify the path to the static directory?

Note that when running this in production using 0.4.4 I have a tmp directory that is a child of the explicitly defined static directory in order to clean up all the dynamically generated plot js files, otherwise all the requests that we have daily to our application would fill up our disk with the dynamically generated js files (or has that methodology been replaced with the latest version?). I have a cron job that cleans out the plot specific tmp directory hourly.

I don't see where I can do that in the new examples - all that is there is now a method called autoload_server. The autoload_static method has been removed from the example script.

Finally, the README.md (https://github.com/ContinuumIO/bokeh/tree/master/examples/embed) says:

To see these example you first have to start the bokeh-server, ie.:

$./bokeh-server --backend=memory

in the top level bokeh directory. For widget.py and animated.py use the links provided when you run the script. For app_reveal.py, navigate to

http://127.0.0.1:5000/

With the old release (0.4.4) I would just run:

$ python app_reveal.py

And it would open up port 5000 just fine. Now I get:

$ python app_reveal.py
Using saved session configuration for http://localhost:5006/
To override, pass 'load_from_config=False' to Session
Traceback (most recent call last):
  File "app_reveal.py", line 213, in <module>
    pop = Population()
  File "app_reveal.py", line 116, in __init__
    self.session.use_doc('population_reveal')
  File "/path/src/bokeh/bokeh/session.py", line 314, in use_doc
    self.docid = self.find_doc(name)
  File "/path/src/bokeh/bokeh/session.py", line 295, in find_doc
    docs = self.userinfo.get('docs')
  File "/path/src/bokeh/bokeh/session.py", line 258, in userinfo
    self._userinfo = self.get_json(url)
  File "/path/src/bokeh/bokeh/session.py", line 249, in get_json
    return self.execute_json('get', url, headers=headers, **kwargs)
  File "/path/src/bokeh/bokeh/session.py", line 241, in execute_json
    resp = func(url, headers=headers, **kwargs)
  File "/path/lib/python2.7/site-packages/requests/sessions.py", line 468, in get
    return self.request('GET', url, **kwargs)
  File "/path/lib/python2.7/site-packages/requests/sessions.py", line 456, in request
    resp = self.send(prep, **send_kwargs)
  File "/path/lib/python2.7/site-packages/requests/sessions.py", line 559, in send
    r = adapter.send(request, **kwargs)
  File "/path/lib/python2.7/site-packages/requests/adapters.py", line 375, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5006): Max retries exceeded with url: /bokeh/userinfo/ (Caused by <class 'socket.error'>: [Errno 61] Connection refused)

If I specify the arg:

load_from_config=False

in the call to Session as suggested in the STDOUT:

OLD (from Github):

self.session = Session()

NEW (my update based on STDOUT msg above):

self.session = Session(load_from_config=False)

I get the following:

$ python app_reveal.py
Traceback (most recent call last):
  File "app_reveal.py", line 213, in <module>
    pop = Population()
  File "app_reveal.py", line 116, in __init__
    self.session.use_doc('population_reveal')
  File "/path/src/bokeh/bokeh/session.py", line 314, in use_doc
    self.docid = self.find_doc(name)
  File "/path/src/bokeh/bokeh/session.py", line 295, in find_doc
    docs = self.userinfo.get('docs')
  File "/path/src/bokeh/bokeh/session.py", line 258, in userinfo
    self._userinfo = self.get_json(url)
  File "/path/src/bokeh/bokeh/session.py", line 249, in get_json
    return self.execute_json('get', url, headers=headers, **kwargs)
  File "/path/src/bokeh/bokeh/session.py", line 241, in execute_json
    resp = func(url, headers=headers, **kwargs)
  File "/path/lib/python2.7/site-packages/requests/sessions.py", line 468, in get
    return self.request('GET', url, **kwargs)
  File "/path/lib/python2.7/site-packages/requests/sessions.py", line 456, in request
    resp = self.send(prep, **send_kwargs)
  File "/path/lib/python2.7/site-packages/requests/sessions.py", line 559, in send
    r = adapter.send(request, **kwargs)
  File "/path/lib/python2.7/site-packages/requests/adapters.py", line 375, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5006): Max retries exceeded with url: /bokeh/userinfo/ (Caused by <class 'socket.error'>: [Errno 61] Connection refused)

I don't want to use the built in bokeh server, because this application gets deployed on a production host in a virtualenv using wsgi running under Apache.

Thanks for the help,
- Rob N

On Jul 15, 2014, at 10:30 AM, Damian Avila <[email protected]> wrote:

The url for the embed example is https://github.com/ContinuumIO/bokeh/tree/master/examples/embed

You can see there the updated example... probably your feeling is correct. Try the new examples and let me know...

Cheers.

On Tue, Jul 15, 2014 at 2:13 PM, robertlnewman <[email protected]> wrote:
Hi Damián,

What is the URL for the updated example? I don't see it anymore in either your fork, not the master Bokeh repo.

The error I am getting is that the plots are not generated. If I look at the URL's for the dynamically generated JS (under /static/js), I get 404's, even though they are present on my file system. I get the feeling that the Bokeh server is "looking" in the wrong location for statically generated files.

Thanks for the prompt reply,
- Rob N

On Jul 15, 2014, at 10:07 AM, Damian Avila <[email protected]> wrote:

Hi Rob,

The example was updated too... what is exactly failing for you?
Do you have a traceback available?

Cheers.

Damián.

On Tue, Jul 15, 2014 at 2:00 PM, robertlnewman <[email protected]> wrote:
Hi All,

I have been using Damian Avila's May 23rd example embed script as a way of getting Bokeh to work with Flask and display data direct from Postgres:

https://github.com/damianavila/bokeh/commit/d1fdb5169e46088d529025497ae3a8a134f7cf69

Since the release of Bokeh 0.5.0 this example no longer works for me. I am not entirely sure what changed, as all the changelog lists (http://bokeh.pydata.org/docs/release_notes.html#v0-5-0-jul-2014):
v0.5.0 (Jul 2014)

  • Widgets
  • Initial AR integration
  • bokeh.charts (scatter, bar, histogram)
  • improved embedding API
  • minor ticks, plot frame, and log axes
This doesn't really give me a granular view of which methods in Bokeh have changed and leaves me with no option but to go through the Git commits to try and figure out what changed and when. I really don't have the time for that because I am bootstrapping a UI for Postgres data. Right now I am tethered to the 0.4.4 release on my production box, and cannot upgrade.

All help appreciated.

Thanks in advance,
- Rob N

--
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/F7768E58-031D-4D40-B265-C7F5600756E6%40gmail.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/CAM9Ly3EGLSV-PvGJOmvDZEmRU2%3D0PEdjP09G7w%2B5pwjx1XtB3w%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/09C6AB65-F010-4C2D-B8EC-C224FC3CF70A%40gmail.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/CAM9Ly3G7_6d0mn5O3Q-qWOwJVu%3DaanqGDzCjm0tONgiEYyerpQ%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/EAA774BF-6BEC-439E-ABD2-6ABFB0E187CF%40gmail.com.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Thanks Bryan & Damián,

I will look at that option. Re-adding the option of using the autoload_static method to the example script would help.

Much obliged, and keep up the awesome work: Bokeh has a bright future!

  • Rob N
···

On Jul 15, 2014, at 11:35 AM, Bryan Van de Ven [email protected] wrote:

Hi Robert,

I think I see the confusion now. There are a number of different ways to embed Bokeh plots: you might want want the data to reside on the Bokeh server (that is what autoload_server will do) or you might want the data to reside in a sidecar .js script (that is what autoload_static will do). It sounds like the example was updated to use data on the server, but we should probably have it demonstrate both cases. autoload_static has not gone away, and if you want to have the data in separate .js scripts that you clean up, that is what you will want to use (and there is no need to run the Bokeh server for that).

Consider the following code:

from bokeh.plotting import *
from bokeh.embed import autoload_static
from bokeh.resources import CDN
circle([1,2], [3, 4])
autoload_static(curplot(), CDN, “foo/bar.js”)

That will return two things: a javascript source, and a script tag. In this case the script tag is:

Wherever you place the script tag in your document, that is where the plot will appear. The last important thing to note, the data script (the first element returned by autoload_static) needs to be saved by you, in a place where it can be reached. In this case, the script tag looks for “foo/bar.js” but you will want to set the path appropriately for your own setup.

Let me know if this makes sense, or if you need more information. We will add an autoload_static example back into the demo but it may not be until next week some time.

Thanks,

Bryan

On Jul 15, 2014, at 2:21 PM, robertlnewman [email protected] wrote:

Damián,

I tried the new examples, and I still get the 404 errors. In the new examples, I don’t see where you specify the path to the static directory?

Note that when running this in production using 0.4.4 I have a tmp directory that is a child of the explicitly defined static directory in order to clean up all the dynamically generated plot js files, otherwise all the requests that we have daily to our application would fill up our disk with the dynamically generated js files (or has that methodology been replaced with the latest version?). I have a cron job that cleans out the plot specific tmp directory hourly.

I don’t see where I can do that in the new examples - all that is there is now a method called autoload_server. The autoload_static method has been removed from the example script.

Finally, the README.md (https://github.com/ContinuumIO/bokeh/tree/master/examples/embed) says:

To see these example you first have to start the bokeh-server, ie.:

$./bokeh-server --backend=memory

in the top level bokeh directory. For widget.py and animated.py use the links provided when you run the script. For app_reveal.py, navigate to

http://127.0.0.1:5000/

With the old release (0.4.4) I would just run:

$ python app_reveal.py

And it would open up port 5000 just fine. Now I get:

$ python app_reveal.py
Using saved session configuration for http://localhost:5006/
To override, pass ‘load_from_config=False’ to Session
Traceback (most recent call last):
File “app_reveal.py”, line 213, in
pop = Population()
File “app_reveal.py”, line 116, in init
self.session.use_doc(‘population_reveal’)
File “/path/src/bokeh/bokeh/session.py”, line 314, in use_doc
self.docid = self.find_doc(name)
File “/path/src/bokeh/bokeh/session.py”, line 295, in find_doc
docs = self.userinfo.get(‘docs’)
File “/path/src/bokeh/bokeh/session.py”, line 258, in userinfo
self._userinfo = self.get_json(url)
File “/path/src/bokeh/bokeh/session.py”, line 249, in get_json
return self.execute_json(‘get’, url, headers=headers, **kwargs)
File “/path/src/bokeh/bokeh/session.py”, line 241, in execute_json
resp = func(url, headers=headers, **kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 468, in get
return self.request(‘GET’, url, **kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 456, in request
resp = self.send(prep, **send_kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 559, in send
r = adapter.send(request, **kwargs)
File “/path/lib/python2.7/site-packages/requests/adapters.py”, line 375, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘localhost’, port=5006): Max retries exceeded with url: /bokeh/userinfo/ (Caused by <class ‘socket.error’>: [Errno 61] Connection refused)

If I specify the arg:

load_from_config=False

in the call to Session as suggested in the STDOUT:

OLD (from Github):

self.session = Session()

NEW (my update based on STDOUT msg above):

self.session = Session(load_from_config=False)

I get the following:

$ python app_reveal.py
Traceback (most recent call last):
File “app_reveal.py”, line 213, in
pop = Population()
File “app_reveal.py”, line 116, in init
self.session.use_doc(‘population_reveal’)
File “/path/src/bokeh/bokeh/session.py”, line 314, in use_doc
self.docid = self.find_doc(name)
File “/path/src/bokeh/bokeh/session.py”, line 295, in find_doc
docs = self.userinfo.get(‘docs’)
File “/path/src/bokeh/bokeh/session.py”, line 258, in userinfo
self._userinfo = self.get_json(url)
File “/path/src/bokeh/bokeh/session.py”, line 249, in get_json
return self.execute_json(‘get’, url, headers=headers, **kwargs)
File “/path/src/bokeh/bokeh/session.py”, line 241, in execute_json
resp = func(url, headers=headers, **kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 468, in get
return self.request(‘GET’, url, **kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 456, in request
resp = self.send(prep, **send_kwargs)
File “/path/lib/python2.7/site-packages/requests/sessions.py”, line 559, in send
r = adapter.send(request, **kwargs)
File “/path/lib/python2.7/site-packages/requests/adapters.py”, line 375, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘localhost’, port=5006): Max retries exceeded with url: /bokeh/userinfo/ (Caused by <class ‘socket.error’>: [Errno 61] Connection refused)

I don’t want to use the built in bokeh server, because this application gets deployed on a production host in a virtualenv using wsgi running under Apache.

Thanks for the help,

  • Rob N

On Jul 15, 2014, at 10:30 AM, Damian Avila [email protected] wrote:

The url for the embed example is https://github.com/ContinuumIO/bokeh/tree/master/examples/embed

You can see there the updated example… probably your feeling is correct. Try the new examples and let me know…

Cheers.

On Tue, Jul 15, 2014 at 2:13 PM, robertlnewman [email protected] wrote:
Hi Damián,

What is the URL for the updated example? I don’t see it anymore in either your fork, not the master Bokeh repo.

The error I am getting is that the plots are not generated. If I look at the URL’s for the dynamically generated JS (under /static/js), I get 404’s, even though they are present on my file system. I get the feeling that the Bokeh server is “looking” in the wrong location for statically generated files.

Thanks for the prompt reply,

  • Rob N

On Jul 15, 2014, at 10:07 AM, Damian Avila [email protected] wrote:

Hi Rob,

The example was updated too… what is exactly failing for you?
Do you have a traceback available?

Cheers.

Damián.

On Tue, Jul 15, 2014 at 2:00 PM, robertlnewman [email protected] wrote:
Hi All,

I have been using Damian Avila’s May 23rd example embed script as a way of getting Bokeh to work with Flask and display data direct from Postgres:

https://github.com/damianavila/bokeh/commit/d1fdb5169e46088d529025497ae3a8a134f7cf69

Since the release of Bokeh 0.5.0 this example no longer works for me. I am not entirely sure what changed, as all the changelog lists (http://bokeh.pydata.org/docs/release_notes.html#v0-5-0-jul-2014):
v0.5.0 (Jul 2014)

* Widgets
* Initial AR integration
* bokeh.charts (scatter, bar, histogram)
* improved embedding API
* minor ticks, plot frame, and log axes

This doesn’t really give me a granular view of which methods in Bokeh have changed and leaves me with no option but to go through the Git commits to try and figure out what changed and when. I really don’t have the time for that because I am bootstrapping a UI for Postgres data. Right now I am tethered to the 0.4.4 release on my production box, and cannot upgrade.

All help appreciated.

Thanks in advance,

  • Rob N