Running Jupyter Notebook through VSCode

I’m sure everybody and their mother knows this, but I just found out you can run Jupyter Notebook in VSCode! Do you know what this means to me? Oh, let me count the ways:

  • No more navigating to the folder through terminal, calling jupyter notebook, and working in my browser. I can just open VSCode.
  • I can see the files I’m working with in the explorer without switching tabs.
  • Dark themes without the drawbacks of Jupyter Themes. (Has anyone else installed Jupyter Themes just to find out the code box cuts off the last two characters? I have.)
  • Split screen in the same window that adjusts your code as you change the split, rather than covering your work with another window.
  • A built-in export as feature. I can export my work as python script, HTML, or even a pdf-- without Latex!
  • I can use my own environments instead of just Python 2 or Python 3.

I’m sure there are other things, too. VSCode has SO MANY extensions. What a game changer.

For more information, you can check out VSCode’s Jupyter Notebook Tutorial.

10 Likes

You can do this with Jupyter Lab.

I think you can already do this with Jupyter Notebooks? From the Menu Bar: File → Download As. But yes, the Jupyter export as pdf does seem to require Latex. But what’s wrong with that?

When I installed Jupyter Notebooks I got a Jupyter Notebooks App which you can pin to the start menu or taskbar (Windows 10). I run it through there and not the terminal.

With Anaconda you can manage switching between different environments each having their own instance of Jupyter.

You get this feature with Jupyter Lab

Yes this is a real benefit and game changer.

Hmm, at this point id like to mention other benefits of running Jupyter Notebooks in VSCode, which im not sure exist in Jupyter:

  • Convenient diffing of Jupyter notebooks. It provides you with a neat, organized view of the diffs.
  • You can debug code cells. There is a way to do it in Jupyter Lab but you have to set it up. In VSCode it is a feature that exists out of the box.

Of course there’s more than what’s been mentioned so far.

1 Like

The VSCode Jupyter extension also comes bundled with Intellitrace and a linter, allowing for more efficient debugging and cleaning your code. It also naturally comes with the other VSCode capabilities like integrated git tools (with the various git extensions), a more streamlined UX experience (Jupyter notebooks are sloooowwww in Jupyter Lab but are much more responsive in VSCode), and with CodeStream, you can more easily communicate your work with your peer group.

While Jupyter Lab has many of the features of VSCode, it does lack many others, and VSCode is much easier to get up and running when you don’t have administrator rights to the computer (like in my case at work).

2 Likes