These are the steps you need to follow, to allow others to access your locally hosted jupyter notebook (or jupyter lab)
-
Open a terminal and run
jupyter notebook --generate-config
-
This will print out in the terminal something like:
Writing default config to: C:\Users\username\.jupyter\jupyter_notebook_config.py
-
Locate and open with a text editor the file
C:\Users\username\.jupyter\jupyter_notebook_config.py
-
Within the file locate the comment:
c.NotebookApp.allow_remote_access = False
and change it toc.NotebookApp.allow_remote_access = True
then save and close. -
run
jupyter notebook password
to create a password for jupyter (you will share this password with people you will collaborate!) I propose the team agrees to have a common password -
Run
pip install jupyter_contrib_nbextensions
to install jupyter extentions -
Create an account at ngrok
-
Then download ngrok depending on you operating system
-
Unzip the zip file
-
Once extracted, run the executable (you might get a warning*, please proceed: show more -> run anyway)
-
In the downlad page it will create a code snippet you should run in the executable it will be something like
ngrok config add-authtoken 29EfheI8IknZXC9dTivgk6M4jVc_4zGtHaKadsvsdvfsvg2G
-
Close everything (the terminal, and the executable)
*In case you are on Windows you might need to do the following for the ngrok executable to Bypass Microsoft Defender SmartScreen
- Right-click on the file.
- Select Properties.
- Make sure you are in the General tab.
- Press the Unblock button.
- Click Apply/OK and exit. The file will be unblocked.
- Start your jupyter notebook or jupyter lab (notice which port jupyter is running on, its usually on port 8888, localhost:8888 )
- Run the ngrok executable
- run
ngrok http 8888
in the ngrok terminal - It will print out something in the terminal, copy and share the url it prints (it will be something like
https://5f74-2a02-85f-f0f5-2300-653e-4c82-42ed-782c.eu.ngrok.io
Once you close the ngrok executable, the person or people you shared the url will no longer have access to your jupyter notebook.