Welcome to Jetson Orin NX SUPER repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
03.Use Jupyter Lab
Use Jupyter Lab
Use Jupyter Lab1. Jupyter Lab installation1.1. Jupyter Lab1.2、Node.js2. Jupyter Lab startup2.1. Set the default browser2.2. Start Jupyter Lab2.3. Host access3. Jupyter Lab configuration3.1. LAN access3.1.1, create a configuration file3.1.2, modify the configuration file3.2, Configure access password3.3, Start the service automatically at boot3.3.1, Edit the service file3.3.2, Set up automatic serviceAutomatic service at startupStart the serviceCheck the service statusVerify auto-startup4. Use Jupyter Lab4.1. Kernel4.2. Run the program4.2.1. Running4.2.2. Running completed
1. Jupyter Lab installation
1.1. Jupyter Lab
Use the following command to install Jupyter Lab: If the download speed of Jupyter Lab is slow, you can use the specified source to install it
sudo apt updatesudo apt install python3-pip -ysudo pip3 install --upgrade pip
xxxxxxxxxxsudo pip3 install jupyterlab# Tsinghua source: pip3 install jupyterlab -i https://pypi.tuna.tsinghua.edu.cn/simple# Alibaba Cloud source: sudo pip3 install jupyterlab -i https://mirrors.aliyun.com/pypi/simple/


1.2、Node.js
Use the following command to install the latest Node.js:
xxxxxxxxxxsudo apt install curl -y
xxxxxxxxxxsudo curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
xxxxxxxxxxsudo apt install nodejs -y
Verify the version:
xxxxxxxxxxnode -v && npm -v

2. Jupyter Lab startup
Before starting Jupyter Lab, you need to set the system default browser, otherwise some prompts will appear when starting the terminal.
2.1. Set the default browser
Open the system Chromium browser and select Set the default browser:


2.2. Start Jupyter Lab
xxxxxxxxxxjupyter lab# Start without browser jupyter lab --no-browser# Start as administrator sudo jupyter lab --allow-root


2.3. Host access
The host refers to the Jetson motherboard system access, which can be accessed directly through http://localhost:8888/:
xxxxxxxxxxhttp://localhost:8888/

3. Jupyter Lab configuration
Configure LAN access, access password, and auto-start for Jupyter Lab.
3.1. LAN access
Device in the same LAN can be accessed by entering IP:8888 in the browser!
Note: The LAN of the campus network is generally inaccessible. You can change the laptop/mobile phone hotspot to test
xxxxxxxxxxFor example, the motherboard IP: 192.168.2.114; we can enter 192.168.2.114:8888 through the browser in the same LAN to perform Jupyter Lab on the motherboard
3.1.1, create a configuration file
xxxxxxxxxxsudo jupyter lab --generate-config
The location of the automatically generated configuration file: Writing default config to: /root/.jupyter/jupyter_lab_config.py
3.1.2, modify the configuration file
xxxxxxxxxxsudo gedit /root/.jupyter/jupyter_lab_config.py
Modified content: After modification, click Save and close the file
xxxxxxxxxx# Allow requests from any source to access the Jupyter Lab serverc.ServerApp.allow_origin = '*'# 0.0.0.0 means binding all available network interfaces and allowing access from any addressc.ServerApp.ip = '0.0.0.0'# Allow Jupyter Lab server to be started as root userc.ServerApp.allow_root = True# Modify the default port to avoid conflictsc.ServerApp.port = 8888

3.2, Configure access password
Enter the command to set the password in the terminal twice, and the input will not be displayed when entering the password!
xxxxxxxxxxsudo jupyter lab password
Automatically generated configuration file location: [JupyterPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_server_config.json

3.3, Start the service automatically at boot
3.3.1, Edit the service file
xxxxxxxxxxsudo gedit /etc/systemd/system/jupyterlab.service
Add content: Click Save and close the file after adding
xxxxxxxxxx[Unit]Description=jupyterlabAfter=network.target[Service]Type=simpleExecStart=/usr/local/bin/jupyter-labconfig=/root/.jupyter/jupyter_lab_config.py --no-browserUser=rootGroup=rootWorkingDirectory=/home/jetson/Restart=alwaysRestartSec=10[Install]WantedBy=multi-user.target
root: System user name
ExecStart: Command to start Jupyter lab, change to JupyterLab installation path
config: Change to JupyterLab configuration file path
WorkingDirectory: The working directory opened when Jupyter-lab is started, which can be changed by yourself (it is recommended to change to the user directory)
xxxxxxxxxxView Jupyter-lab installation path: which jupyter-labConfiguration file path: Refer to the path of the configuration file generated above

3.3.2, Set up automatic service
Automatic service at startup
xxxxxxxxxxsudo systemctl enable jupyterlab# Disable auto-startup systemctl disable jupyterlab
Start the service
xxxxxxxxxxsudo systemctl start jupyterlab# Stop the service sudo systemctl stop jupyterlab
Check the service status
xxxxxxxxxxsystemctl status jupyterlab

Verify auto-startup
After restarting the system, use the device in the same LAN to access the motherboard IP:8888 according to the system IP.
xxxxxxxxxxYou need to enter a password for the first access, which is the information set in the previous step;When taking the screenshot, the IP of the motherboard is 192.168.2.114, so devices in the same LAN can access 192.168.2.114:8888

4. Use Jupyter Lab
4.1. Kernel
It is recommended to restart the kernel and clear all unit block output information every time you run a program or the program is abnormal:

4.2. Run the program
Through Jupyter Open the program file to be run in Lab, and run the program from top to bottom to run the unit blocks in sequence:
4.2.1. Running
[*] is displayed in the upper left corner of the unit block to indicate that it is running:

4.2.2. Running completed
[Number] is displayed in the upper left corner of the unit block to indicate the number of times it has been run: for example, [1] → the program has run the unit block code for the first time
