Welcome to Raspberry Pi 4B repository
3.4 Install Jupyter Lab
1 .Install Jupyter Lab
Input following command to install Jupyter Lab.
sudo pip3 install jupyterlab
2. Add Jupyter lab path
When the system prompts successfully, the installation of Jupyter Lab is completed.
If the warning message shown in the thumbnail as shown below appears, the path is not found.We need to add the path.
Modify profile file.
Input following command:
sudo nano /etc/profile
Add configuration instructions, as shown below.
export PATH=$PATH:~/.local/bin
After modify is complete, press “Ctrl + X”, and press Y to save and exit.
Input following command start up Jupyter Lab.
source /etc/profile
The browser will automatically pop up the jupyterlab interface.
3. Set up the LAN to access Jupyter Lab
3.1 Input following command to create configuration file.(Please remember this path).
jupyter notebook --generate-config
3.2 modify configuration file
sudo nano /home/pi/.jupyter/jupyter_notebook_config.py
Write the following two pieces of code into the specified location.
c.NotebookApp.allow_origin = '*' #allow all origins
c.NotebookApp.ip = '0.0.0.0' # listen on all Ips
After modify is complete, press “Ctrl + X”, and press Y to save and exit.
3.3 Set password.
Input following command.
jupyter notebook password
The system will ask you to enter the password twice.
!Tip: In the state of entering the password, it will no display characters.
3.4 Input following command to restart Raspberry Pi.
sudo reboot
3.5 Test
jupyter lab
Next, we can enter http://127.0.0.1:8888 locally on the Raspberry Pi to access Jupyter Lab. Or enter http://<your-ip-address>:8888 on a machine in the local area network.
You can enter the password you set. Finally, you can operate your program on Webpage by JupyterLab.
As shown below.
4. Configure Jupyter Lab to start automatically
After the installation is complete. In normally, when use JupyterLab every time, you need to enter the command to start jupyter lab.
For convenience, we can make JupyterLab start the program automatically.
The operation is as follows:
4.1 Input following command to create a startup file.
nano /home/pi/yahboomlabboot.sh
4.2 Copy the code to the file, save and exit
# shell script to set path and run jupyter notebook server at boot
export PATH="$PATH:/home/pi/.local/bin/"
jupyter lab
After modify is complete, press “Ctrl + X”, and press Y to save and exit.
4.3 Add the file to the startup item
sudo nano /etc/rc.local
Copy the following code to the previous line of exit 0 in the file.
su pi -c 'bash /home/pi/yahboomlabboot.sh'
After modify is complete, press “Ctrl + X”, and press Y to save and exit.
4.4 Input following command to restart Raspberry Pi.
sudo reboot
4.5 Test
You can try to access http://127.0.0.1:8888 locally
or
access http://<your-ip-address>:8888 on the device in the same LAN, such as: http://192.168.1.220:8888
If it can be accessed normally, it means Jupyter Lab is successfully installed.