A simple way to launch Jupyter Notebook / Lab and set a password

Introduction

Qiita has already mentioned how to set a password for Jupyter, but I wish it was simply written as "There is no doubt if you do it this way. It's easy and secure." I hope it will be helpful for those who set up a Jupyter Notebook server from scratch.

For the time being, from the installation of Jupyter server.

Premise

--Availability of pip

Launch the Jupyter Notebook server

terminal


$ pip install jupyter
$ jupyter notebook --port=8888 #If you want to specify the port

Launch Jupyter Lab server

terminal


$ pip install jupyterlab
$ jupyter labextension install jupyterlab-plotly #When using Plotly with Jupyter Lab (details will be described later)
$ jupyter lab --port=8888 #If you want to specify the port

Set password

You don't have to hash it yourself or write the password in clear text, it will be automatically encrypted and saved by keyboard input. It's easy. See also: Official Documentation

terminal


$ jupyter notebook password
Enter password: 
Verify password:
[NotebookPasswordApp] Wrote hashed password to $HOME/.jupyter/jupyter_notebook_config.json

Digression

Generate a configuration file

If you don't want to launch the browser when the server starts, you can edit this file directly. The method is common to Jupyter Notebook / Lab.

terminal


$ jupyter notebook --generate-config
Writing default config to: $HOME/.jupyter/jupyter_notebook_config.py

#actually$HOME is not displayed. The home directory of your environment is displayed.

Required settings if using Plotly with Jupyter Lab

When I try to draw a Plotly graph in Jupyter Lab, it may not be displayed. Let's install the plugin with the jupyter command. It is assumed that the node command can be used globally.

Install as described in * JupyterLab Support (Python 3.5+) * in Plotly Official Documentation.

terminal


$ brew install node #For macOS
$ node --version
v14.13.0
$ jupyter labextension install jupyterlab-plotly

Recommended Posts

A simple way to launch Jupyter Notebook / Lab and set a password
Install and set Jupyter Notebook to create a study note creation environment [Mac]
The usual way to add a Kernel with Jupyter Notebook
A very convenient way to give a presentation on Jupyter Notebook
Use Jupyter Lab and Jupyter Notebook with EC2
Easy way to enter and execute AtCoder test cases in Jupyter Notebook
How to set up a jupyter notebook on ssh destination (AWS EC2)
Jupyter notebook password
[Jupyter Notebook / Lab] 3 ways to debug on Jupyter [Pdb]
Build a PYNQ environment on Ultra96 V2 and log in to Jupyter Notebook
What to do if your Jupyter Notebook for beginners asks for a password or token
Steps to attach and debug from VS Code to Jupyter Lab on a remote server
Open Jupyter Lab (or Jupyter Notebook) by specifying a directory
How to instantly launch Jupyter Notebook from the terminal
[Simple procedure] To log in to ssh without a password
How to import NoteBook as a module in Jupyter (IPython)
Building a Python environment on a Mac and using Jupyter lab
A simple way to avoid multiple for loops in Python
A standard way to develop and distribute packages in Python
I want to use a virtual environment with jupyter notebook!
How to import NoteBook as a module in Jupyter (IPython)
Introduced Jupyter Notebook to CentOS 7
How to use Jupyter Notebook
Building a Python development environment on Windows -From installing Anaconda to linking Atom and Jupyter Notebook-
For those of you who don't know how to set a password with Jupyter on Docker
How to set a shortcut to switch full-width and half-width with IBus
How to batch start a python program created with Jupyter notebook
I wanted to create a smart presentation with Jupyter Notebook + nbpresent
Use Jupyter Notebook as a unit test and manual creation tool
Install Anaconda on Mac and upload Jupyter (IPython) notebook to Anaconda Cloud
Introduction and usage of Python bottle ・ Try to set up a simple web server with login function
Post a Jupyter Notebook as a blog post
Make a sound with Jupyter notebook
Jupyter Notebook: 4 banal tips and tricks
Launch jupyter notebook (+ take security measures)
Easy to use Jupyter notebook (Python3.5)
Specify the browser to use with Jupyter Notebook. Especially Mac. (And Vivaldi)
How to fix a bug that jupyter notebook does not start automatically