JupyterLab is a web-based IDE(interactive development environment). It is well-known in the field of data science and scientific computing. And also with its help, the programmer can code anytime anywhere without any installations or configurations, one web browser is enough for all.
Install Jupiter Lab via pip.
sudo python3 -m pip install jupyterlab
Set a new password.
jupyter-notebook password
Get the sha1 of your password, and you will get an output like this 'sha1:xxxxxxxxxxxxxxxxxxx'.
ipython
from notebook.auth import passwd
passwd()
Generate a configuration file.
jupyter lab --generate-config
Modify the JupiterLab config file. The sha1 you get is used here.
sudo vim ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.allow_root = True
c.NotebookApp.allow_remote_access = True
c.NotebookApp.ip = '127.0.0.1'
c.NotebookApp.base_url = '/jupyter'
c.NotebookApp.notebook_dir = '/home/ubuntu'
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'sha1:xxxxxxxxxxxxxxxxxxx'
c.NotebookApp.port = 8888
c.IPKernelApp.pylab = 'inline'
Confirm the Jupyter Lab version and rebuild the app directory.
jupyter-lab --version
jupyter lab build
This is optional. Set up language parameter if you got an error of " UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128) ".
LANG=zn jupyter lab build
Optional installation of the nodejs package.
sudo apt install nodejs
nodejs --version
Optional installation of the npm package.
sudo apt install npm
npm --version
Also, not required, but they will solve some problems you may have.
sudo python3 -m ipykernel install --user
jupyter lab paths
sudo chmod -R 777 /usr/local/share/jupyter/
sudo chmod -R 777 /usr/share/jupyter/
Modify the Nginx default setting, append the location of the Jupyter block.
sudo vim /etc/nginx/sites-enabled/default
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
ssl on;
server_name www.caorussell.com;
charset utf-8;
ssl_certificate /home/ubuntu/mysite/ssl/caorussell.com.crt;
ssl_certificate_key /home/ubuntu/mysite/ssl/caorussell.com.key;
location / {
proxy_set_header x-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
include /etc/nginx/uwsgi_params;
uwsgi_pass 127.0.0.1:9000;
}
location /media {
alias /home/ubuntu/mysite/media;
}
location /static {
alias /home/ubuntu/mysite/static;
}
location /jupyter {
proxy_pass http://127.0.0.1:8888;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 120s;
}
}
Restart your Nginx server.
sudo /etc/init.d/nginx restart
Run the Jupyter lab at the background
nohup jupyter lab &
Login in to your Jupyter with the password you set before.
www.caorussell.com/jupyter/
Now we have the web-based online terminal, file editor, notebook, and python console. Well, the Jupyter offers the dark theme as well.
One more thing, Jupyter supports the extensions.
Check installed extensions.
jupyter labextension list
Enable Extension Manager.
Now you can manage the extensions.
Here is more information about Jupyter Widget from the official site.