-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
push_notebook does not work in Google Colaboratory #9302
Comments
As far as I can tell, google colab doesn't support comms, nor in fact is a proper jupyter notebook environment. bokehjs warns in JS console about not being able to set up comms. It's unfortunate that colab crashes instead of giving a meaningful error message. I also notice that loading bokehjs' resources doesn't work very well (e.g. missing banner and gl bundle). Unless comms are properly implemented, I doubt that we will be able to do anything about this, besides making the warning more prominent. However, I see that there is some support available for jupyter widgets. We are currently implementing jupyter wigets support in bokeh, so maybe this would allow to workaround those issues, but that's just a very remote maybe. |
There is already an issue about Bokeh and comms on the colab issue tracker: I am going to close this as |
I'm looking into this for Colaboratory- Colab has the infrastructure for comms support but we have not exposed much of it. I'm curious how Bokeh would expect it to be exposed. Looking at
window.Jupyter then other code starts assuming it's in a complete Notebook environment and lots of things break. For example this line causes the Bokeh initialization to completely break: bokeh/bokeh/core/_templates/autoload_nb_js.js Line 120 in fbd8a63
@mattpap You mention that you are working on Jupyter Widgets support- unfortunately Colab currently only supports the core widgets. We would like a more extensible system and started a discussion a while back, but have not been able to make much progress. Some of the issues are covered in https://github.com/nteract/nes/tree/master/portable-widgets. For the crash- is Bokeh using binary comms by chance? That could be hitting googlecolab/colabtools#587. We have not prioritized that issue as not too many users have hit it and there's a workaround for the only case we were seeing. I am interested in improving Bokeh support in Colab- I addded some Bokeh initialization a while back (https://github.com/googlecolab/colabtools/blob/master/google/colab/_import_hooks/_bokeh.py). I see a few approaches, and would appreciate feedback on which is preferred:
|
@blois thanks for chiming in here. It would definitely be great the make something work, if possible. For this question I need a bit more context:
The Bokeh protocol sends binary mode websocket messages for array buffers. But I am not sure it you are referring to things like that, at the general websocket level, or if this is about some Jupyter-speciic facility for binary comms. If the latter, the answer is no. |
@bryevdv - yes that would be hitting googlecolab/colabtools#587. |
@blois Ok, thanks for the clarification, I did read the issue but it was not quite clear to me. But I also dug into things on our end and can confirm we are using the Lines 270 to 275 in f1bc5b0
I had forgotten about that. FWIW That is pretty much the entire extent of our comms usage on the Python side. |
@blois has here been any update in this area? Is there any mechanism to use binary comms? |
I am working on this on two fronts right now-
Once the binary comms plumbing is in Colab we should be able to either expose some globals in the environment or if the above jupyter-output-spec stabilizes and is acceptable then implement that. |
Awesome thanks for the update, look forward to trying things out! |
The API is in, initially only exposed for users in an allow-list to limit impact of breaking changes. If you'd like to have it enabled feel free to email me Colab still has some work to do to upgrade tornado, which is a pre-req for upgrading Bokeh, but we're working on it. Edit- example of the API is https://colab.research.google.com/gist/blois/e7abc90f2edcfab9a5c585cfda1c38ff/comms.ipynb |
I'm working up a PR to add support for those comms to bokeh (and the HoloViz stack). I'll reopen this issue since the ball is now in our court. |
@philippjfr any update on this? It would be nice to report this for 2.1 |
Please let me know if there's anything I can do to help out here. |
Been swamped with a few new client projects and AnacondaCON the last two weeks. Let's discuss in the meeting today but I should have time over the weekend. |
Hi - could you comment on which version this works for? I can't seem to get working on bokeh==2.1.1 Steps to recreate - https://gist.github.com/faizankshaikh/e23db80bdcdcb14176d492d505ee46b4 PS - I frankly think the issue I face is much simpler (and probably unrelated) to this issue. But still posting it here in the hope that resolving this issue solves the problem |
Hello!
I tried to create an interactive plot with bokeh in Google Colab. The following code renders a scatter plot as expected:
Changing the data and calling push_notebook should change the positions of the points in the scatter plot:
Instead, the notebook crashes ("Runtime disconnected"). This happens with bokeh version 1.3.4. You can find a demo of the problem here.
The text was updated successfully, but these errors were encountered: