VSCode... export Jupyter Notebook as HTML

In the past, I could export Jupyter Notebooks as HTML in the following way:

  • Click on the dots at the RHS of the notebook menu

  • Choose Export

  • Choose …as HTML

This opened the file browser, and one could choose file name. Presto, it worked.

Not any more!!! Now, instead an obnoxious sticky text input box appears:

I have no idea what to fill in here, and the process just stalls. In order to get rid of this text input box, I have to exit VSCode and restart it.

In the past, this text-box only appeared if I chose to export to PDF.

Question: What “Python Environment” am I supposed to select??

You need to select a python environment with the jupyter and notebook package installed. Otherwise, you get this error.
error-notebook

To fix this:

  • install Python
  • select your version of Python from the drop-down menu
  • click install when the error occurs

You could open an issue in the vscode-jupyter extension repo. It assumes you have Python installed and it shouldn’t do that.

This used to work on this PC 3-4 months ago. What can have changed?

And what is a “Python environment”? Like miniconda, or something?

Python and Julia share the concept of an environment: a mechanism for isolating packages from one project to another. Python has several tools for managing environments, and miniconda is one of them. But, if you don’t use Python for anything else, it is more convenient to download just Python.

I’m not a Computer Scientist or Python expert (I used Python last time in 2017). Here is what I have done so far:

  • Go to Microsoft Store and downloaded Python 3.12
  • In VSCode, go to Extension and installed the core Python extension

Next, I’m trying to create a “Python Environment” (whatever that is). So I type Ctrl+Shift+P, and search for Python Environment. One choice is “conda” (…since I used Anaconda in the past…). When I do that, I’m stuck again by “computer speak”:
image

  • I don’t know what a “workspace” is. It seams like it is a directory (if so, why not say so?). But I have no idea whether there are any requirements about where to put it.

You don’t need to create an environment. After installing Python and the Python extension, the drop-down menu should detect your version of Python.

In my case, I have Python 3.9 and the drop-down menu can detect it.

Hm. It seems to work now. I had to install Jupyter 2.0 (or something) – weird; I already hade the Jupyter plugin.