Description of Jupyter Notebook remote connection and configuration method

Intro:   When Jupyter Notebook is accessed locally, it is relatively simple to enter jupyter notebook directly on the cmd command line. However, notebook can be used not only to connect to the server remotely,

When Jupyter Notebook is accessed locally, it is relatively simple to enter jupyter notebook directly on the cmd command line. However, notebook can be used not only to connect to the server remotely, but also to connect to the server remotely, so that if you have a server with a lot of memory, but you do not like to operate and edit code on the linux, you can use notebook to the server on the local windows, write code locally, and use the resources on the server.

If you install anaconda, notebook is installed by default, and typing jupyter notebook, under the cmd command sees a command similar to the following

This means that you already have notebook, of course, if you don’t have a prompt, you can install it using the following command:

Pip install jupyter Jupyter Notebook’s remote connection configuration does the following on the server. Open python, and enter the following statement:

From notebook.auth import passwd passwd () # then enter the password according to the operation (this password is the password you will use when you log on to notebook later) # and you will get a string of characters when you enter it. Remember this character, and you will use 2 to generate the configuration file to exit python, to enter the following command:

Jupyter notebook-generate-config this command creates a .jupyter folder in the user’s home directory and generates a jupyter_notebook_config.py file under the folder

3. Modify the configuration file to open jupyter_notebook_config.py, to find the file using the following command

Find / grep jupyter_notebook_config.py vim. / .jupyter / jupyter_notebook_config.py image.png opens the jupyter_notebook_config.py file and modifies the inside:

C.NotebookApp.ip =’*’# sets the accessible ip to be arbitrary. The c.NotebookApp.open_browser = False # setting does not open the browser c.NotebookApp.password = ‘step 1 generated ciphertext’ c.NotebookApp.port = 6666 c.NotebookApp.notebook_dir =’/ your/file/saved/path/’ 4 by default. Start Jupyter Notebook and type jupyter notebook on the command line to turn on the service. But we usually want Jupyter Notebook to run in the background, so you can enter the following command

One of the numbers output by the system after the input of nohup jupyter notebook & gt;/dev/null 2 / GT / AMP / 1 & amp; is the port number 5. 5 of the notebook run. To configure a tunnel to access the Jupyter Notebook, locally, you need to establish a tunnel with the server, typically on the local terminal tool you use. If you use xshell, to click New:

Where the hostname and port are the ip address and port number of the server to which you want to connect

Then, click “tunnel” on the left “add”

6. Use the method to open the browser, enter http://localhost:1234 in the address bar (the local port you set), and enter the password set in step 1. You can get into notebook.

7. Extended applications can add plug-ins to notebook, such as jupyter-themes, Jupyter notebook extensions 7.1 jupyter-themes, which can be installed directly using pip

Once pip install jupyterthemes is installed, you can open the monokai topic using the command jt-t monokai. Jt-r can restore the default theme, and jt-l looks at which modes are currently available

Jt-l # View current optional mode jt-t monokai # turns on monokai theme jt-r # restore default theme 7.2 Jupyter notebook extensions Direct pip installation

Related Passages:

Leave a Reply

Your email address will not be published. Required fields are marked *