'How to fix Jupyter extension activation failed when opening python files?

I installed python lately on my macos system and when I try to open a python file I see this error popup about Jupyter extension : enter image description here



Solution 1:[1]

Just ran into this today (I'm on MacOS for my work computer). In my case, upgrading to the pre-release version of the Jupyter extension (v2022.5.1001281006) solved it right away.

If you're not an experienced programmer/software engineer, as is the case for me, I suggest trying to upgrade (or roll back) either VS code or the plugin itself before going with your own dev code for the plugin, as with @CAG2 pt2 answer. (Personally, I had trouble finding a 'product.json' file; perhaps you need an insider's build of VS code for that kind of thing [edit]: https://code.visualstudio.com/api/advanced-topics/using-proposed-api, in which case I think you'd be editing 'package.json').

Solution 2:[2]

I had this same issue and finally got it fixed!


If you are on an Linux and are using an Arch-based distro with AUR support, simply install the code-features package using:

yay -S code-features

or any AUR helper of your choosing.


On other operating systems, you should do the following:

Open your VSCode's product.json. I do not know where this file is on your operating system, so please do some research.

Look for the following line:

"extensionAllowedProposedApi": [ ...

Add the following entry to that array:

"ms-toolsai.jupyter": ["notebookConcatTextDocument", 
    "notebookControllerKind", "notebookDebugOptions", "notebookDeprecated", 
    "notebookEditor", "notebookEditorDecorationType", "notebookEditorEdit", 
    "notebookMessaging", "notebookMime", "notebookCellExecutionState", 
    "portsAttributes", "textDocumentNotebook", "quickPickSortByLabel"]

For example, if the line was originally:

"extensionAllowedProposedApi": [ "extension1", "extension2" ]

Then change it to:

"extensionAllowedProposedApi": [ "extension1", "extension2", 
    "ms-toolsai.jupyter": ["notebookConcatTextDocument", 
    "notebookControllerKind", "notebookDebugOptions", "notebookDeprecated", 
    "notebookEditor", "notebookEditorDecorationType", "notebookEditorEdit", 
    "notebookMessaging", "notebookMime", "notebookCellExecutionState", 
    "portsAttributes", "textDocumentNotebook", "quickPickSortByLabel"] ]

Note that with the second method, you will need to edit product.json every time you update VSCode.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 CAG2