Tuesday, September 01, 2020

Quick tip: workaround kernelspec module not installed with jupyter notebooks in Visual Studio Code

This weekend I tried out working with Jupyter Notebooks in Visual Studio Code. Since I already have Jupyter up and running as part of the Anaconda distro I thought this would be easy but it took me longer than expected. 

First step is to install the Python extension for VS Code  and then you can start working with existing Jupyter Notebooks by just double clicking an existing notebook. Unfortunately this immediately threw an exception "Error: Jupyter cannot be started. Error attempting to locate jupyter: 'Kernelspec' module not installed in the selected interpreter." The workaround suggested on StackOverflow Python/Jupyter notebook in VSCode does not use the right environment did not resolve the issue and also the fixes described on Github - New version tries to install kernelspec were not working.


The workaround which seems to be working for me is starting VS Code from the Anaconda Prompt in the Jupyter workspace directory by typing "code ."




No comments: