[PYTHON] Allow external connections with jupyter notebook

When launching jupyter in a VM environment, the connection is refused even if the port for jupyter is set to be forwarded to localhost on the VM side. I could have imagined that LISTEN would be something like localhost, but I didn't know how to set it until I looked it up, so I made a note.

First, create a configuration file.

$ jupyter notebook --generate-config

By default, a file called jupyter_notebook_config.py is created in~ / .jupyter /. Edit the following lines in this file.

## The IP address the notebook server will listen on.
c.NotebookApp.ip = 'localhost'

You can change this localhost to 0.0.0.0 or *.

## The IP address the notebook server will listen on.
c.NotebookApp.ip = '0.0.0.0'

You can now access it from outside the VM. By the way, if it's annoying that the browser starts up every time Jupyter starts up,

## Whether to open in a browser after starting. The specific browser used is
#  platform dependent and determined by the python standard library `webbrowser`
#  module, unless it is overridden using the --browser (NotebookApp.browser)
#  configuration option.
c.NotebookApp.open_browser = False

If you set the ʻopen_browser value to False`, you can prevent anything from opening at startup.


** Addition **

I told you in the comment section, but if you want to do ad hoc

$ jupyter notebook --ip=* --no-browser

Seems to be good. It's convenient.

Recommended Posts

Allow external connections with jupyter notebook
Using Graphviz with Jupyter Notebook
Use pip with Jupyter Notebook
Use Cython with Jupyter Notebook
Play with Jupyter Notebook (IPython Notebook)
Formatting with autopep8 on Jupyter notebook
Visualize decision trees with jupyter notebook
Make a sound with Jupyter notebook
Use markdown with jupyter notebook (with shortcut)
Add more kernels with Jupyter Notebook
Convenient analysis with Pandas + Jupyter notebook
Use nb extensions with Anaconda's Jupyter notebook
Use apache Spark with jupyter notebook (IPython notebook)
I want to blog with Jupyter Notebook
Use Jupyter Lab and Jupyter Notebook with EC2
Try SVM with scikit-learn on Jupyter Notebook
How to use jupyter notebook with ABCI
Linking python and JavaScript with jupyter notebook
[Jupyter Notebook memo] Display kanji with matplotlib
Rich cell output with Jupyter Notebook (IPython)
Jupyter Notebook memo
Introducing Jupyter Notebook
Powerful Jupyter Notebook
Jupyter notebook password
Jupyter Notebook memo
How to debug with Jupyter or iPython Notebook
When Html cannot be output with Jupyter Notebook
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
Data analysis for improving POG 2 ~ Analysis with jupyter notebook ~
Verify NLC accuracy with Watson Studio's Jupyter Notebook
Enable Jupyter Notebook with conda on remote server
Try using conda virtual environment with Jupyter Notebook
Fill the browser with the width of Jupyter Notebook
Graph drawing with jupyter (ipython notebook) + matplotlib + vagrant
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
Multiple selections with Jupyter
Candlestick with plotly + Jupyter
Get started Jupyter Notebook
Monitor the training model with TensorBord on Jupyter Notebook
Drawing a tree structure with D3.js in Jupyter Notebook
Import specific cells from other notebooks with Jupyter notebook
EC2 provisioning with Vagrant + Jupyter (IPython Notebook) on Docker
3 Jupyter notebook (Python) tricks
Use nim with Jupyter
[Cloud103] # 3 Jupyter Notebook again
Machine learning with Jupyter Notebook in OCI Always Free environment (2019/12/17)
Reflect the virtual environment created with Miniconda in Jupyter notebook
Day 65 (Solution) Jupyter notebook does not work with Kernel Not Conected.
I want to use a virtual environment with jupyter notebook!
The usual way to add a Kernel with Jupyter Notebook
Connect the Jupyter Notebook kernel to Spyder with Jupytext enabled
Write charts in real time with Matplotlib on Jupyter notebook
Try clustering with a mixed Gaussian model on a Jupyter Notebook
Shortcut key for Jupyter notebook
Accept external access with SimpleHTTPServer
Embed audio data with Jupyter
Parallel computing with iPython notebook
Introduced Jupyter Notebook to CentOS 7
Display HTML in Jupyter notebook
Multiprocessing error in Jupyter Notebook
Try using Jupyter Notebook dynamically