You can use VS Code with Jupyter Notebooks.
You can work on Jupyter Notebooks within VS Code. This gives
you all the great code completion, syntax highlighting and documentation hints that are part
of the VS Code experience and the interactivity of a Jupyter Notebook. Any changes you make to
the Notebook will be reflected on the CDSW / Cloudera Machine Learning server and can be viewed online using Jupyter
Notebook as a browser based editor.
-
Because of the way Cloudera Machine Learning uses
the internal networking and port forwarding of Kubernetes, when VS Code launches a Jupyter
Server it binds to the wrong address and access is blocked. You therefore have to launch
your own Jupyter Server and tell VS code to connect to that.
-
The first setting you need to set is the Python > Data Science: Jupyter Server URI
setting. Set this to
http://127.0.0.1:8888/?token=[some-token]
.
-
Then you need to open a terminal to launch a Jupiter Notebook server.
You can launch it using: /usr/local/bin/jupyter-notebook —no-browser
—ip=127.0.0.1 —NotebookApp.token=[some-token] —NotebookApp.allow_remote_access=True
.
This creates a Jupyter server that any new Notebooks you launch will run in.
-
After you install the Jupyter Notebooks, you can use it inside VS Code.
-
Another feature that you can use with VS Code is running a temporary Notebook for
executing random code snippets. Select code you want to run, right click and click
Run Current File in Python Interactive Window.
This is less robust though and will create many Untitled*.ipynb
files in your home directory.