Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set up and run a Bokeh server with Anaconda Cloud

It was announced on the Datacamp Bokeh course that Anaconda Cloud can serve bokeh code without any complicated installment issues. However, my knowledge regarding Anaconda is unsufficient to achieve this.

My problem is as follows:

Starting point: - I have a piece of Python code for an interactive Bokeh plot

Desired Endpoint: - I want to host the code on Anaconda Cloud so that external users can access the plot through their browser without having to install python.

My main question is, Is there currently an easy 'for dummies' tutorial on how to go from the starting point to the endpoint?

My current understanding of anaconda to fully understand which steps I have to take and which parts of the Anaconda/Bokeh documentation I need to achieve my goal.

Example code was taken from:

http://docs.bokeh.org/en/latest/docs/user_guide/server.html

like image 865
Arjan Groen Avatar asked Feb 26 '17 13:02

Arjan Groen


3 Answers

Oh this is nice, anaconda cloud can display your jupyter notebooks, and if you put some interactive bokeh code in them, that part will work great. The notebook will not be interactive, meaning python or whatever other language your notebook is written on will not run, but its cool that html with embedded JS code does. Here is a working example from a code I just uploaded to anaconda cloud: https://anaconda.org/pmreyes2/my_bokeh_interactive_code/notebook

The steps that I follow to do that are similar to what @Steven C. Howell writes in his answer:

  1. First register on https://anaconda.org
  2. Install the anaconda-client command line client.
    • Using pip: $ pip install anaconda-client
    • If you have conda: $ conda install anaconda-client
    • from sources GitHub repository: https://github.com/Anaconda-Platform/anaconda-client
  3. Login from your terminal:
    • $ anaconda login
    • use your username and password created in step 1.
  4. Now you can test the connection:
    • $ anaconda whoami
    • This connects to the cloud and your information should be displayed here
  5. Once you have created a jupyter notebook with some interactive bokeh code is time to upload it to your anaconda cloud space:
    • $ anaconda notebook upload my-notebook.ipynb

Note: This is only for viewing it. An html version of it is created just for viewing it, not for running it. But the cool thing is that if it contains bokeh code, it will run as the example I provide: https://anaconda.org/pmreyes2/my_bokeh_interactive_code/notebook

UPDATE

I would also like to mention that the same feature of sharing jupyter notebooks where the bokeh interactive code is alive, can be done using jupyter nbviewer to your GitHub repository. Here the same example shared in anaconda cloud, also in jupyter nbviewer from my GitHub repository: https://nbviewer.jupyter.org/github/pmreyes2/my_jupyter_notebooks/blob/master/My_Bokeh_Interactive_code.ipynb

like image 133
Pablo Reyes Avatar answered Oct 11 '22 16:10

Pablo Reyes


I doubt Anaconda Cloud is setup to run bokeh server as this would require an active Python backend to update calculations then send the new data to the server. It definitely can host interactive bokeh plots. I have a few examples in this notebook (note that bokeh server would be required for the interactive datashader plots to update when zooming).

You can review the Anaconda Cloud documentation to better understand how to accomplish different tasks using Anaconda Cloud, but here is a consolidated list of the required steps to upload a Jupyter notebook, which in your case should contain bokeh plots:

  1. Setup your Anaconda Cloud account online
  2. Install anaconda-client using one of the following commands:

    conda install anaconda-client

    pip install anaconda-client

    pip install git+https://github.com/Anaconda-Server/anaconda-client

  3. Login to anaconda-client using your Anaconda Cloud credentials

    anaconda login

  4. Install jupyter

    conda install jupyter

  5. Create a Jupyter notebook containing the code to your bokeh plot

    jupyter notebook interesting_bokeh_plots.ipynb

  6. Upload any notebook containing a rendered bokeh plot

    anaconda upload interesting_bokeh_plots.ipynb

All these commands should be executed on the command line, and require the anaconda bin/ directory to be in your $PATH (getting help with these steps would be a separate question).

like image 29
Steven C. Howell Avatar answered Oct 11 '22 18:10

Steven C. Howell


Arjun, I would post this question on the https://groups.google.com/a/continuum.io/forum/#!forum/bokeh forum. Bryan Van de ven who made the Anaconda Cloud reference on the Bokeh data camp course is active on that forum (as a core contributor to Bokeh).

like image 26
Steve Avatar answered Oct 11 '22 17:10

Steve