DEV Community

Cover image for Share your local Jupyter Notebook on Internet for Free
Zoheb Abai
Zoheb Abai

Posted on • Edited on

Share your local Jupyter Notebook on Internet for Free

During this global lockdown, it's interesting to observe an upsurge in learning python and in particular machine learning. There are innumerable free online resources and teachers from where or whom you can learn, but all use a common open-source software (or its clone) - Jupyter Notebooks. It's one of the most useful tools for all ranks of data scientists/engineers/analysts.

While teaching online, the teachers either prerecord the sessions or consider taking sessions live. During live sessions most of the teachers use one of several video conferencing platforms, coding on their local machine (or ready-to-run notebooks) and share it live. This has two serious demerits -

  1. Internet penetration is still worse for many developing countries. So viewing code onscreen or receiving a clear audio is a still a distant dream for many.
  2. If students want to just run few lines of code or check their doubts regarding the code shared onscreen during sessions, they have no option to copy. It has to be either shared by the teacher before the session or the teacher has to pause for extra few minutes on each code blocks.

Being a teaching assistant myself for several data science courses, I have noticed few good and enthusiastic teachers discussing on the lack of free video conferencing with live code sharing platforms. There isn't any!

Well, for now, an audio conference with live code sharing shall suffice.

For live code sharing, one solution is very obvious - Google Colab Notebooks. It's the best resource built for data science EVER!

Kind of solved

In this article I shall provide you an alternate free option for live code sharing, which might help you. At the least, it's a good feature to know.

You can share your local Jupyter notebooks live with a small group while hosting a session.

Prerequisite:

You already have Jupyter notebooks installed locally.

Requirements:

  • Download ngrok locally.
  • Follow all the steps mentioned till step 3.

Steps:

  • Before firing up the ngrok or a Jupyter notebook, run

Step 1

  • Copy the address mentioned after Writing default config to:

Step 2

  • Then run the code below, replacing your address (from the step above) instead of mine.

Step 3

  • For a secured session, set the password for your Jupyter Notebook by running

Step 4

  • Fire up your Jupyter notebook and keep a note of the port

Step 5

  • Open a new tab in your terminal and fire up ngrok on your port

Step 6

Your terminal would show something similar to

Output

Copy the HTTP link with ngrok.io at the end and share it with your group with the notebook password. You get an 8-hour session.
Each time you write a new line/block of code in your notebook press Ctrl+S (Linux/Windows) or Cmd+S (macOS) to share the updated notebook. The group members have to refresh on their end to see those changes.

Note: As a host if you receive an alert like this

Alert

Just click Overwrite so that whatever changes you make during the session remains intact for that session.

That's how you share your code session live with a group for free while working on your local machine and simultaneously allowing your group to code on the notebook during the session and eventually letting them download the session notebook.

Thanks to Project Jupyter and ngrok.

Let me know if you have any better idea.

Top comments (1)

Collapse
 
jankaifer profile image
Jan Kaifer

Screenshots are nice but they cannot be copies.
And some of those commands are quite long.

Code snippets would be more useful.