How to run Jupyter Lab as systemd service
This guide explains how to run Jupyter Lab as a systemd service on Linux. Below you find the systemd unit file and a simple start script.
Create a systemd service file /etc/systemd/system/jupyter-lab.service
containing:
jupyter-lab.service
[Unit]
Description=Jupyter Lab
After=network.target
[Service]
Type=simple
User=uli
WorkingDirectory=/home/uli
ExecStart=/usr/local/bin/jupyter-lab --no-browser --ip=0.0.0.0
Restart=on-failure
[Install]
WantedBy=multi-user.target
Create a small start script in /usr/local/bin/jupyter-lab-start.sh
:
jupyter-lab-start.sh
#!/bin/bash
source /home/uli/.venv/bin/activate
exec jupyter-lab --no-browser --ip=0.0.0.0
Enable and start the service:
enable_jupyter_service.sh
sudo systemctl daemon-reload
sudo systemctl enable --now jupyter-lab.service
sudo systemctl status jupyter-lab.service
If you run into path issues, check the ExecStart
used by systemd in the unit file and ensure paths are absolute.
Check out similar posts by category:
DevOps
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow