Reputation: 143
It works well when I use command + shift + P then 'jupyter:create a new project'.
For this file, I used that function. One day I close VS Code and I found the 'ipynb' looks like 'json' when I open it again.
How can I make it back to a jupyter notebook?
Upvotes: 6
Views: 14344
Reputation: 340
Change the corresponding editor association in your user or profile settings (JSON) like so:
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
Upvotes: 0
Reputation: 132
This worked for me.
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb", // if commented, will open as JSON
// "*.ipynb": "default" //do not turn it on else will not open JupyterNB by default
Upvotes: 6
Reputation: 81
When Saving your notebook pick "All Files" instead of JSON.
Your file will show up as a IPYNB
Upvotes: 0
Reputation: 29560
Check that you are using the correct Jupyter extension.
The old donjayamanne.jupyter extension has now been merged into or replaced by the ms-toolsai.jupyter extension. Searching for "jupyter" in the extensions list should show both of them, with one of them marked as "(deprecated)".
If you still have the deprecated one, uninstall that, and install the new one. As mentioned in the old extension's description:
This extension is no longer being maintained and all of its functionality has been (or will be) placed into the Microsoft Jupyter extension.
Please download the Microsoft Jupyter Extension instead.
Check that you have Use Notebook Editor enabled.
From Setting up your environment:
By default, the Visual Studio Code Python extension will open a Jupyter Notebook (.ipynb) in the Notebook Editor. If you want to disable this behavior you can turn it off in settings. (Python > Data Science: Use Notebook Editor
The docs still mention the old setting, but as of VS Code 1.54 and with the new Microsoft Jupyter extension, it should now be:
"jupyter.useNotebookEditor":true
Check that you activated a Python environment with the Jupyter package.
From Setting up your environment:
To work with Jupyter notebooks, you must activate an Anaconda environment in VS Code, or another Python environment in which you've installed the Jupyter package. To select an environment, use the Python: Select Interpreter command from the Command Palette (
⌘
+SHIFT+P
).
Open a terminal and check that you have jupyter
and ipykernel
:
(venv) test$ jupyter --version
jupyter core : 4.7.1
jupyter-notebook : not installed
qtconsole : not installed
ipython : 7.21.0
ipykernel : 5.5.0
jupyter client : 6.1.11
jupyter lab : not installed
nbconvert : not installed
ipywidgets : not installed
nbformat : not installed
traitlets : 5.0.5
The Jupyter extension requires you to install ipykernel
:
(venv) test$ pip install ipykernel
Upvotes: 4