Using Javascript Kernel in Vscode Jupyter Notebooks

2021-04-07

I haven’t worked in python that much, but even I know about jupyter notebooks. They are great prototyping tool. And while python is the poster child of notebooks, you can actually run them with any language. One thing which looked great is the ability in VSCode to run notebooks directly. One issue though, I’m not a python developer and would love to use javascript kernel instead.

So, at the moment there is no official support for different kernels, BUT by accident I’ve realised it’s possible to still use id 🤯.

While not the most convenient way to do this, it’s pretty straightforward.

  1. Setup jupyter notebooks for your platform, I won’t get into details of this as there is official documentation. In nutshell, you should be able to run jupyter notebook and get working notebook running in your browser.
  2. Next part of this puzzle is the javascript kernel. Follow the ijavascript installation steps.
  3. Now start jupyter in your working directory jupyter notebook
  4. Go to the url provided from CLI.
  5. Create a new notebook, with javascript kernel newnotebook
  6. Now you can open the newly created notebook with VSCode. On macos with vscode cli code <notebook-name>.ipynb
  7. You can now stop the server from step 3.

If all went well, you should see notebook open and running similar to this running notebook

NOTE you might need to select the appropriate interpreter and trust the notebook. Also I needed restart of vscode after doing that.

Tags