What is the Jupyter notebook?
The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualisations and explanatory text.
The definition is from the official site. I use IPython/Jupyter
shell all time. If you haven’t tried, spend 30 minutes and witness the power!
At times, I want to share some code snippet with folks in the same building during work, workshop or training. The Jupyter notebook configuration allows the user to expose the notebook cluster, terminal over the network or the internet. The notebook is available over the network with two changes in the configuration file. The first config value is IP other than default localhost. The second one is the password for users to connect to the notebook.
- Run the command
jupyter notebook --generate-config
to generate the config file. The command creates configuration lies in the path~/.jupyter/jupyter_notebook_config.py
. By default, the server listens on localhost. Modify the IP address to local machine IP. You can useifconfig
to find out the IP and change the value ofc.NotebookApp.ip
to IP like# c.NotebookApp.ip = '192.168.0.101'
. - Next, find the line which contains
c.NotebookApp.password
declaration. Then executefrom the notebook.auth import passwd; passwd()
in the IPython/Jupyter shell. The code is to generate password, and placed above the attribute assignment. Enter the password; copy the output and assign the output to the attributec.NotebookApp.password
. Now run the server and open the URLhttp://IP:8888
from another PC or mobile to browse notebooks after entering the correct password.
The IP address can be overridden using the flag --ip
like jupyter notebook --ip 192.168.0.100
See also
- Python Typing Koans
- Model Field - Django ORM Working - Part 2
- Structure - Django ORM Working - Part 1
- jut - render jupyter notebook in the terminal
- Five reasons to use Py.test
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.