Skip to content

JupyterLab

In this article

Information

JupyterLab is a modern web-based interactive development environment that extends and improves upon the classic Jupyter Notebook. It provides a flexible interface for working with documents and activities related to Jupyter, such as notebooks, terminals, text editors, file browsers, and more. JupyterLab is fully extensible and supports a wide range of workflows in scientific computing, data analysis, and machine learning.

Key Features of JupyterLab

  • Modular and Extensible Interface: Customize your workspace to fit your needs.
  • Multi-Format Support: Work with notebooks, text files, images, and other document types.
  • Integrated File Browser: Navigate your file system with ease.
  • Interactive Dashboards: Create and use interactive control panels.
  • Enhanced Text Editor: Features syntax highlighting and code autocompletion.
  • Flexible Extension System: Add new features and tools to your environment.

Deployment Features

ID Compatible OS VM BM VGPU GPU Min CPU (Cores) Min RAM (Gb) Min HDD/SDD (Gb) Active
192 Ubuntu 24.04 + + + + 1 1 10 Yes
  • Pre-installed Dependencies:
  • Python 3
  • pip
  • virtualenv

  • Working Directory: /root

    • JupyterLab Installation:
    • Main Directory: /opt/data/jupyter/
    • Executable Files: /opt/data/jupyter/bin/
    • Configuration Files: /opt/data/jupyter/etc/jupyter/
    • Common Resources: /opt/data/jupyter/share/jupyter/
    • Python Packages: /opt/data/jupyter/lib/python3.12/site-packages/
  • Key Installed Libraries:

    • numpy
    • matplotlib
    • ipython
    • jupyter_core
    • notebook
    • ipykernel
    • nbconvert
    • nbformat
    • jupyterlab-pygments
    • ipywidgets
    • jinja2
    • pillow

The web interface will be accessible at: https://lab{Server_ID_from_Invapi}.hostkey.in

Note

Unless otherwise specified, by default we install the latest release version of software from the developer's website or operating system repositories.

Getting Started After JupyterLab Deployment

After purchasing an order, you'll receive a notification email when your server is ready. This email will include your VPS IP address and login credentials for connection. Our company clients manage their equipment through the server control panel and APIInvapi.

You can find authentication data, either in the Info >> Tags section of your server's control panel or in the email you received:

  • Link to access JupyterLab's web interface: - in the webpanel tag;
  • Login: root - for server management, only a password is required to authenticate with JupyterLab;
  • Password: Sent to your email address after the server is ready for use following software deployment.

Authorization and the Starting Menu

After a successful login, you'll be presented with the JupyterLab start page:

This page features an intuitive interface providing access to JupyterLab's core functions and tools:

  1. Top Bar:

    • Standard menu with options: File, Edit, View, Run, Kernel, Tabs, Settings, Help.
    • + Button for creating a new file or opening a new terminal.
    • Icons for saving, uploading, and updating.
  2. Left Sidebar:

    • File browser with a Filter files by name search field.
    • Displays the root directory / and the nginx folder, last modified 2 hours ago.
  3. Central Area (Launcher):

    • Notebook section with an option to create a new Python 3 notebook (ipykernel).
    • Console section also with a Python 3 (ipykernel) option.
    • Other section with additional options:
      • Terminal (to open a command line);
      • Text File (to create a text file);
      • Markdown File (to create a markup file);
      • Python File (to create a Python script);
      • Show Contextual Help (to display contextual help).

Note

Detailed information about JupyterLab's main settings can be found in the developer documentation.

Ordering JupyterLab via API

To install this software using the API, follow this instruction.

Here is the complete Bash script with the systemd service template added:

Installing JupyterLab on Ubuntu from Ansible Script (Bash Commands)

This guide converts the provided Ansible script into a step-by-step set of Bash commands for manual installation on an Ubuntu system.

Self-Installing JupyterLab on Ubuntu

  1. Update System Packages:

    sudo apt update
    sudo apt upgrade -y
    
  2. User and Group Setup

    sudo groupadd jupyter
    sudo useradd -g jupyter -u 2841 -m -s /bin/bash jupyter
    
    sudo mkdir -p /opt/data
    sudo chown jupyter:jupyter /opt/data
    sudo chmod 777 /opt/data
    
  3. Install Required Packages

    sudo apt update
    sudo apt install -y python3 python3-pip jupyter python3-virtualenv jupyter-server
    
  4. Virtual Environment Setup

    mkdir -p /opt/data/jupyter
    chown jupyter:jupyter /opt/data/jupyter
    chmod 755 /opt/data/jupyter
    
    sudo su - jupyter -c "virtualenv -p python3 /opt/data/jupyter"
    
  5. Install JupyterLab and Dependencies

    source /opt/data/jupyter/bin/activate
    pip install -U jupyterlab jupyter-core voila jupyter-server
    deactivate
    
  6. Configure JupyterLab Settings

    sudo -u jupyter /opt/data/jupyter/bin/jupyter notebook --generate-config -y
    sudo /opt/data/jupyter/bin/jupyter notebook --generate-config -y
    
  7. Customize JupyterLab Configuration (Optional)

    sudo sed -i 's/^# c.ServerApp.allow_origin = '\''\''$/c.ServerApp.allow_origin = '\''*'\''/' /root/.jupyter/jupyter_notebook_config.py
    
  8. Create Systemd service. Copy and paste the below into a file named jupyterlab.service) in you current directory via vim or nano.

    [Service]
    Type=simple
    PIDFile=/run/jupyterlab.pid
    WorkingDirectory=/opt/data
    ExecStart=/opt/data/jupyter/bin/jupyter-lab --config=/root/.jupyter/jupyter_server_config.json --allow-root --ip=0.0.0.0 --no-browser --notebook-dir=/opt/data/jupyter/share/jupyter
    User=root   
    Group=root   
    Restart=always
    RestartSec=10
    [Install]
    WantedBy=multi-user.target
    
  9. Start and Enable JupyterLab Service

    sudo cp jupyterlab.service /usr/lib/systemd/system/jupyterlab.service
    sudo systemctl daemon-reload
    sudo systemctl start jupyterlab
    sudo systemctl enable jupyterlab
    
    10. Obtain server token

    jupyter server list
    
    for see server token

  10. Access Jupiter Web UI and setup password:

    Open a web browser and navigate to https://your-server-ip:8888. (Replace your-server-ip with your server's actual IP address). Then use server token to setup new password.

Attention

  • No SSL Certificate: This setup uses HTTP (port 80) without SSL. This is not recommended for production environments . Consider obtaining and configuring an SSL certificate for secure communication.
  • Security Risk: Running on HTTP exposes your data to potential interception and man-in-the-middle attacks. Exercise extreme caution if you choose to use this configuration.

Easy Setup with a Bash Script (SSH and Invapi Deployment)

#!/bin/bash

# Update system
sudo apt update -y

# Setup User and Group
groupadd jupyter   # Create group 'jupyter' if it doesn't exist
useradd -g jupyter -u 2841 -m -s /bin/bash jupyter  # Create user 'jupyter' with specified gid, uid, etc.

# Create Directories and Set Permissions
mkdir -p /opt/data  
chown jupyter:jupyter /opt/data
chmod 777 /opt/data

# Install Packages
sudo apt update
sudo apt install -y python3 python3-pip jupyter python3-virtualenv jupyter-server

# Create Virtual Environment
mkdir -p /opt/data/jupyter
chown jupyter:jupyter /opt/data/jupyter
chmod 755 /opt/data/jupyter
sudo su - jupyter -c "virtualenv -p python3 /opt/data/jupyter"


# Install JupyterLab and Dependencies
source /opt/data/jupyter/bin/activate
pip install -U jupyterlab jupyter-core voila jupyter-server
deactivate

# Configure JupyterLab Settings
sudo -u jupyter /opt/data/jupyter/bin/jupyter notebook --generate-config -y
sudo /opt/data/jupyter/bin/jupyter notebook --generate-config -y

# Customize JupyterLab Configuration (Optional)
sudo sed -i 's/^# c.ServerApp.allow_origin = '\''\''$/c.ServerApp.allow_origin = '\''*'\''/' /root/.jupyter/jupyter_notebook_config.py

#Acquire IP-address of the server
IP_ADDRESS=$(hostname -I | awk '{print $1}')

# Create Systemd Service File
cat << EOF > /etc/systemd/system/jupyterlab.service 
[Service]
Type=simple
PIDFile=/run/jupyterlab.pid
WorkingDirectory=/opt/data
ExecStart=/opt/data/jupyter/bin/jupyter-lab --config=/root/.jupyter/jupyter_server_config.json --allow-root --ip=0.0.0.0 --no-browser --notebook-dir=/opt/data/jupyter/share/jupyter
User=root   
Group=root   
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF

# Enable and Start JupyterLab Service
sudo systemctl daemon-reload
sudo systemctl start jupyterlab
sudo systemctl enable jupyterlab

echo "JupyterLab installation complete."

Use script on BASH commandline

  • Connect to your server via SSH.
  • Save the script as a .sh file (e.g., install.sh).
  • Make it executable: chmod +x install.sh.
  • Run the script on your server: ./install.sh.
  • Use http://:8888/ for connect to web interface. You would obtain you IP via commandline:

    hostname -I | awk '{print $1}'
    
    * Find token for you server use the command:

    jupyter server list
    
    * Use this token to set new password.

Using the Script During Server Reinstallation

  • Select the desired OS in the Reinstall >> Operating System tab.
  • Paste the script for the supported OS into the Post-install script field in the Advanced options tab.
  • Start the reinstallation by clicking the button Reinstall this server