python3 -m venv mypython
source mypython/bin/activate
pip install --upgrade pip
pip install jupiterlab
pip install --upgrade webio_jupyter_extension
For the Julia kernel:
julia> Pkg.add("IJulia")
Generate a config file in ~/.jupyter
- backup this folder if you have it already.
jupyter lab --generate-config
generate a key pair for https protocol
cd ~/.jupyter
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout mykey.key -out mycert.pem
suncommented and change lines in my .jupyter/jupyter_lab_config.py
c.ServerApp.allow_origin = '*'
c.ServerApp.browser = ''
c.ServerApp.certfile = u'/home/USER/.jupyter/mycert.pem'
c.ServerApp.disable_check_xsrf = True
c.ServerApp.ip = '*'
c.ServerApp.keyfile = u'/home/USER/.jupyter/mykey.key'
c.ServerApp.open_browser = False
c.ServerApp.port = PORT
c.ServerApp.token = 'TOKEN'
To see these lines I used grep -v "^#" jupyter_lab_config.py |grep "c"
.
USER
is the usernamePORT
a random port number, e.g.13267
TOKEN
a long random string, e.g.dsfdsjfjsGDDGFAHj73527466523sjdfgjgfjsgfjsdjjfdgjdfgjdsfkghfkbh
You may use the following script to startup a jupyter lab session:
#!/bin/bash
token=$(grep ServerApp.token ~/.jupyter/jupyter_lab_config.py | cut -d ' ' -f 3)
token=${token:1:-1}
hostname=$(hostname -s)
port=$(grep "c.ServerApp.port " ~/.jupyter/jupyter_lab_config.py | cut -d' ' -f3)
echo connect to:
echo https://${hostname}:${port}/lab?token=$token
echo
echo
jupyter lab --no-browser --LabApp.workspaces_dir=.
To avoid "self-signed certificate" error add the following in VS Code settings .json
"jupyter.allowUnauthorizedRemoteConnection": true,
"http.proxyStrictSSL": false,
and the next in .bashrc
export NODE_TLS_REJECT_UNAUTHORIZED='0'
Make sure to kill all VS Code servers which may be still running in the background and restart VS Code (cmd+shift+p remote-ssh: kill remote host... ).