How do i convert and save as Notebooks as .py on Notebook Version 7.4.4

How do i convert a notebook into a python file on Notebook Version 7?

When i go under “File”–> “save and export as” the python format is not an option.

Using nbconvert doesnt work as nbextension seems only to work on Notebook 6 Versions.

I know i can go back to 6.X version but i want to use the built in AI assistant

That seems odd.
Do you see an option of Executable Script under ‘Save and Export Notebook As’? That is the option you want. If you are using the ipykernel, it seems it will automatically even add the correct extension if you just type a file name in the dialog after choosing it.

Demonstrate what you should see:
You can try it here with v7.5, separate from your own installation, by going here to the Jupyter Notebook repo. There click on the ‘launch binder’ badge and a session on a remote, virtual machine will spin up. When the Jupyter Dashboard comes up, choose to make a new notebook by using the ‘New’ button in the upper right side. You can write some code and try the conversion.

I know you specified v7.4.4; however, right now I cannot find that version as a separate offering. You can though go here and see the same thing with version 7.2.

If that isn’t what you see, you’d have to provide more details of how you installed things? For example, did you have an old version of Jupyter and not clean things out before trying something? Are you using it in the context of the Anaconda Distribution install? Etc. …


As an aside…
You state what I quoted above; however, nbconvert does not need nbextension working. nbconvert is a key support tool of modern Jupyter Notebook and JupyterLab. You are correct though that nbextension/ jupyter_contrib_nbextensions extensions only work in Notebook 6 and the more modern, related NbClassic. Most of the popular extensions though now have extensions that work in Notebook 7+/modern JupyterLab versions. Or the features they offer have been integrated now, such as the Table of Contents.

You should should be able to demonstrate this in the session(s) I suggest above by opening a new code cell and running !jupyter nbconvert. You’ll see it give the usage in the output.

Jupytext is actually highly related to nbconvert and offers a convenient command line conversion of Jupyter .ipynb files to Python scripts, among the many other things it can do. This would be more convenient if you are doing a lot of conversions ‘after-the-fact’, i.e., when you aren’t in an active session. See here for more about that. Also see here where you can have paired versions made automatically as you work. It is a great tool to have in your Jupyter ecosystem toolbox.

Extensions like Jupytext can now be installed with pip and enabled automatically when they are installed. (Usually.)