If you would like to work in the same environment as jupyterlab, check out Theia, the cloud IDE. The following highlights how we can install theia in your jupyter notebook's container.
For more information here's a post describing how Google Cloud Platform is using Theia as their default cloud IDE: https://cloud.google.com/blog/products/application-development/introducing-cloud-shell-editor.
-
Assuming
jupyter-0
pod is running, start Theia.# Assuming theia repo is found at `/workspace/theia` kubectl exec -it jupyter-0 -- bash -c '. ~/.bashrc; yarn --cwd /workspace/theia/examples/browser run start --hostname 0.0.0.0'
-
Port forward to localhost
# Theia is running on default port 3000 kubectl port-forward jupyter-0 3000 --address 0.0.0.0
Go to your browser http://localhost:3000/. Happy Coding π¬
-
Exec into notebook's container
kubectl exec -it jupyter-0 -- bash
-
Git clone theia into persisted volume
/workspace/theia
.git clone https://github.com/eclipse-theia/theia.git /workspace/theia
You do not have to do this every time, because the files are persisted in your volume,
/workspace/.nvm
however you'll need to add the PATH variable to your bash_rc.
-
Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
-
Append the following to jupyter-0's
~/.bashrc
export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
-
Use NVM to install node
12.22.5
nvm install v12.22.5 nvm alias default v12.22.5 # else system will continue to use system node
npm install --global yarn
apt install -y zsh curl less pkg-config make libx11-dev libxkbfile-dev libsecret-1-dev
This will install theia
cd /workspace/theia
yarn