Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting interactive jupyter notebook on private website

I currently run a personal website using Wordpress (but hosted on siteground) that is a set of engineering study guides. I would like to move towards making these study guides interactive (i.e. refreshing graphics based on sliders, doing basic calculations to indicate if a design works or not, so I need numpy). A friend recommended that I utilize Jupyter notebooks for this purpose, as you can both render LaTeX (which I'm currently using Mathjax with Wordpress to do), as well as have the types of interactive graphics I want using either Bokeh or Plotly.

While I've seen tutorials for sharing notebooks on specific servers, what I'm after is being able for others to run my notebook in their browser (read-only), where the notebook is privately hosted.

I'm still not sure if Jupyter is the correct avenue to accomplish what I want, so I'm open to other suggestions (someone also recommended using Julia, but I've seen fewer examples of this).

like image 604
stagermane Avatar asked Apr 17 '18 08:04

stagermane


People also ask

Can you put a Jupyter notebook in a website?

Easily embed a console, a notebook, or a fully-fledged IDE on any web page. In a previous blog post, we announced JupyterLite, a JupyterLab distribution that runs entirely in the web browser, backed by in-browser language kernels.

Where can I host my Jupyter notebook?

Google Colaboratory is a free online Jupyter notebook environment that allows you to run your notebook without installation of dependencies and environments. Goole Colab accepts files from upload as well as GitHub repository, or you can connect it to your Google Drive and open any notebooks from there.


1 Answers

I agree with your friend that Jupyter Notebooks is an excellent approach. And while it's by no means the only method to accomplish what you're after, I'm hard-pressed to come up with an immediate alternative that doesn't require significant work to set up.

I can think of three primary methods of using Jupyter Notebooks which suit your needs:

1. Azure Notebooks

Microsoft has a new service called Azure Notebooks, which is (currently) totally free.

Azure Notebooks boasts the complete functionality of Jupyter Notebooks, and in addition to Python, users can also program cells in R and F#. As for typical usage of the service, here's a snippet from their FAQ:

Jupyter (formerly IPython), is a multi-lingual REPL on steroids. This is a free service that provides Jupyter notebooks along with supporting packages for R, Python and F# as a service. This means you can just login and get going since no installation/setup is necessary. Typical usage includes schools/instruction, giving webinars, learning languages, sharing ideas, etc. The service is provided by the Python team @ Microsoft, which is part of the Data Group.

2. nbviewer

The top banner of the main Jupyter site contains a link link to an application called nbviewer.

Evidently, you can create your markdown / Jupyter syntax as a discrete page somewhere else, feed the URL to your page into nbviewer, and it'll render it for you right there in the results. If I were going to use this, I would either;

  • Create a discrete WordPress page for my Jupyter syntax, then feed that into nbviewer; or, more likely
  • Use GitHub to host my Jupyter Notebook pages (mainly for posterity and version control, over the Gist option), and use the raw text link as the source to feed into nbviewer.

3. Hosting Your Own Solution

If you're technically savy enough, I'd recommend this approach over nbviewer.

When you launch Jupyter Notebooks on your own machine, you access it through your browser using the default URL of http://localhost:8888. That means there must exist some mechanism to expose that port to external users, and allow them to have access to your Notebook, using the exact same interface. Two methods of doing so:

  1. Using Jupyter Notebooks public server
  2. Remotely accessing your normal Jupyter Notebook

Hope that helps! I'm curious to know if any of these options works out for you.

like image 112
Michael Hoovler Avatar answered Sep 29 '22 18:09

Michael Hoovler