Welcome to Jetson Orin NX Developer Kit 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 the configuration file3.1.2. Modify the configuration file3.2. Configure the access password3.3. Auto-start the service at boot3.3.1. Edit the service file3.3.2. Set up the auto-start serviceAuto-start the service at bootStart the serviceCheck the service statusVerify the auto-start4. Use Jupyter Lab4.1. Kernel4.2. Run the program4.2.1. Running4.2.2. Run completed
pip installation notes: Under PEP 668, Ubuntu 24.04 marks the system Python as "externally managed", so installing directly with pip may report
externally-managed-environment.--break-system-packagesallows pip to install packages in that environment; virtual environments usually do not need this parameter, but it is kept here so that the instructions remain consistent throughout this tutorial.
The factory system already has the relevant environment set up, so the installation steps below can be skipped.
1. Jupyter Lab installation
1.1. Jupyter Lab
Use the following commands to install Jupyter Lab: if the download of Jupyter Lab is slow, you can install it with a specified mirror.
sudo apt updatesudo apt install python3-pip -ysudo pip3 install --upgrade pip --break-system-packages
xxxxxxxxxxsudo pip3 install jupyterlab --break-system-packages# Tsinghua mirror: pip3 install jupyterlab -i https://pypi.tuna.tsinghua.edu.cn/simple --break-system-packages# Alibaba Cloud mirror: sudo pip3 install jupyterlab -i https://mirrors.aliyun.com/pypi/simple/ --break-system-packages


1.2. Node.js
Use the following commands 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 the terminal starts.
2.1. Set the default browser
Open the system Chromium browser and choose to set the default browser:


2.2. Start Jupyter Lab
The factory system is already configured to start Jupyterlab automatically at boot, so you can jump directly to 2.3.
xxxxxxxxxxjupyter lab# Start without a browser jupyter lab --no-browser# Start as administrator sudo jupyter lab --allow-root


2.3. Host access
The host refers to access from the Jetson mainboard system itself, which can be reached directly through http://localhost:8888/:
xxxxxxxxxxhttp://localhost:8888/

3. Jupyter Lab configuration
Configure LAN access, the access password, auto-start at boot and so on for Jupyter Lab.
3.1. LAN access
A device on the same LAN can access it by entering IP:8888 in the browser!
Note: The LAN of a campus network is generally not reachable; you can switch to a laptop/mobile phone hotspot to test
xxxxxxxxxxFor example, the mainboard IP: 192.168.2.114; you can enter 192.168.2.114:8888 in the browser of any device on the same LAN to open the mainboard's Jupyter Lab
3.1.1. Create the 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
Content to modify: after modifying it, click Save and close the file
Operations that can be done with ctrl+F can be found and modified quickly; you can also simply copy and paste this to the bottom
xxxxxxxxxx# Allow requests from any origin to access the Jupyter Lab serverc.ServerApp.allow_origin = '*'# 0.0.0.0 means binding all available network interfaces and allows access from any addressc.ServerApp.ip = '0.0.0.0'# Allow the Jupyter Lab server to be started as the root userc.ServerApp.allow_root = True# Modify the default port to avoid conflictsc.ServerApp.port = 8888# Force the automatically generated Token to be cleared, preventing the Token login box from popping up firstc.ServerApp.token = ''# Clear the automatically generated default password configuration and let the password set manually by us take overc.ServerApp.password = ''# Force authentication (password) to be required for login; access without a password is not allowedc.ServerApp.allow_login_without_authentication = False# Keep the cross-site request forgery (XSRF) check enabled to ensure the security of password loginc.ServerApp.disable_check_xsrf = False

3.2. Configure the access password
Enter the command to set the password in the terminal; it has to be entered twice, and the input is not displayed while you type the password!
xxxxxxxxxxsudo jupyter lab password
The location of the automatically generated configuration file: [JupyterPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_server_config.json

3.3. Auto-start the service at boot
3.3.1. Edit the service file
xxxxxxxxxxsudo gedit /etc/systemd/system/jupyterlab.service
Content to add: after adding it, click Save and close the file
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: the system user name
ExecStart: the command that starts Jupyter lab; change it to the JupyterLab installation path
config: change it to the path of the JupyterLab configuration file
WorkingDirectory: the working directory opened when Jupyter-lab starts; you can change it yourself (it is recommended to change it to the user directory)
xxxxxxxxxxCheck the Jupyter-lab installation path: which jupyter-labConfiguration file path: refer to the path of the configuration file generated above

3.3.2. Set up the auto-start service
Auto-start the service at boot
xxxxxxxxxxsudo systemctl enable jupyterlab# Disable auto-start 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 the auto-start
After restarting the system, use a device on the same LAN to access mainboardIP:8888 according to the system IP.
xxxxxxxxxxThe password is required on the first access; it is the one set in the previous steps;the mainboard IP in the screenshot is 192.168.2.114, so devices on 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 the output of all cells every time you run a program or when the program behaves abnormally:

4.2. Run the program
Open the program file that you want to run through Jupyter Lab, and run the program by executing the cells from top to bottom:
4.2.1. Running
[*] displayed in the upper left corner of the cell means it is running:

4.2.2. Run completed
[Number] displayed in the upper left corner of the cell means the number of the execution order: for example, [1] → the program ran the code of that cell for the first time
