Welcome to Jetson Orin NANO Developer Kit repository
03.Use Jupyter Lab
Using Jupyter Lab
Using 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. Service Auto-Start at Boot3.3.1. Edit the Service File3.3.2. Set Up the Auto-Start ServiceService Auto-Start at BootStart the ServiceCheck the Service StatusVerify Auto-Start at Boot4. Using Jupyter Lab4.1. Kernel4.2. Run the Program4.2.1. Running4.2.2. Running Completed
pip Installation Note: Ubuntu 24.04 marks the system Python as "externally managed" according to PEP 668, so installing directly with pip may report
externally-managed-environment.--break-system-packagesallows pip to install packages in that environment; a virtual environment usually does not need this parameter, but this tutorial keeps it to keep the commands consistent.
The factory system already has the relevant environment set up, so the following installation steps can be skipped.
1. Jupyter Lab Installation
1.1. Jupyter Lab
Use the following commands to install Jupyter Lab: if the download speed for installing Jupyter Lab is slow, you can use a specified source for the installation
sudo apt updatesudo apt install python3-pip -ysudo pip3 install --upgrade pip --break-system-packages
xxxxxxxxxxsudo pip3 install jupyterlab --break-system-packages# Tsinghua source: pip3 install jupyterlab -i https://pypi.tuna.tsinghua.edu.cn/simple --break-system-packages# Alibaba Cloud source: 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, the system default browser needs to be set; otherwise, some prompts appear when the terminal is started.
2.1. Set the Default Browser
Open the system Chromium browser and choose to set it as the default browser:


2.2. Start Jupyter Lab
The factory system has been set to start Jupyterlab automatically at boot, so you can jump directly to 2.3 to check.
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; access it directly through http://localhost:8888/:
xxxxxxxxxxhttp://localhost:8888/

3. Jupyter Lab Configuration
Configure LAN access, the access password, auto-start at boot, and other operations for Jupyter Lab.
3.1. LAN Access
Set it so that devices on the same LAN can enter IP:8888 in a browser for access!
Note: The LAN of a campus network is generally inaccessible; you can switch to a laptop/mobile phone hotspot for testing
xxxxxxxxxxFor example, the mainboard IP is 192.168.2.114; you can enter 192.168.2.114:8888 in a browser on the same LAN to access the Jupyter Lab on the mainboard
3.1.1. Create the Configuration File
xxxxxxxxxxsudo jupyter lab --generate-config
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 modifying, 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, allowing access from any addressc.ServerApp.ip = '0.0.0.0'# Allow starting the Jupyter Lab server as the root userc.ServerApp.allow_root = True# Modify the default port to avoid conflictsc.ServerApp.port = 8888

3.2. Configure the Access Password
Enter the command to set the password in the terminal; it needs to be entered twice, and the entered password is not displayed!
xxxxxxxxxxsudo jupyter lab password
Location of the automatically generated configuration file: [JupyterPasswordApp] Wrote hashed password to /root/.jupyter/jupyter_server_config.json

3.3. Service Auto-Start at Boot
3.3.1. Edit the Service File
xxxxxxxxxxsudo gedit /etc/systemd/system/jupyterlab.service
Added content: after adding, 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 to start Jupyter lab; change it to the JupyterLab installation path
config: change it to the JupyterLab configuration file path
WorkingDirectory: the working directory opened when Jupyter-lab is started; it can be changed as needed (changing it to the user directory is recommended)
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
Service Auto-Start at Boot
xxxxxxxxxxsudo systemctl enable jupyterlab# Disable auto-start at boot 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-Start at Boot
After rebooting the system, use a device on the same LAN to access the mainboard IP:8888 according to the system IP.
xxxxxxxxxxA password is required for the first access; the password is the information set in the previous steps;At the time of the screenshot, the mainboard IP is 192.168.2.114, so devices on the same LAN can access 192.168.2.114:8888

4. Using Jupyter Lab
4.1. Kernel
It is recommended to restart the kernel and clear the output information of all cells each time a program is run or when a program is abnormal:

4.2. Run the Program
Open the program file to be run through Jupyter Lab, and run the cells in sequence from top to bottom when running the program:
4.2.1. Running
[*] displayed at the upper left of the cell means it is running:

4.2.2. Running Completed
[Number] displayed at the upper left of the cell indicates the run sequence count: for example, [1] → the program ran the code of that cell on the first run
