"Failed to find a kernel to run the code. Please install the Jupyter extension"

Trying the interpreter mode and always get these messages when trying something… The thing is I installed the “Jupyter” extension already lol. I’m not familiar with Python though (using С#), just installed this extension but it didn’t help. Any tips?

1 Like

Have you installed Python?

Yes, I’ve already figured it out, thank you.

How did you fix this?
I have python and the extension installed on cursor
Still getting the same error

im getting this error too, i’ve installed python - is that documented as a requirement anywhere? cant find any references to this issue

@Niko_Bellic can you post your solution?

I don’t remember exactly, I asked the GPT chat for a step-by-step instruction. Besides just installing Python, I needed to install and check if Python and Jupyter Notebook are working correctly on my computer. For this, something had to be written in the command line. In short, it’s better to ask the chat again, it’s aware of this error - tell it that although the extension is installed in VSCODE, the error still occurs. And it will clarify the steps.

I found a temporary workaround

Tell the interpreter to use “python os module” when requesting changes

This accomplishes the same result

You can put in in settings->rules to make it default

I am getting the same error:

I give this prompt in ‘Interpreter Mode’:

“create a new file named ‘testing_only.js’ in the root directory”

It returns this error:

“Failed to find a kernel to run the code. Please install the Jupyter extension”

Environment Details:

From the Cursor > ‘Help’ > ‘About’ menu item:

Version: 0.36.2
VSCode Version: 1.89.1
Commit: 9a6d781540ba2732cf26551c07629e68121c6580
Date: 2024-07-07T21:57:45.723Z
Electron: 28.2.8
ElectronBuildId: undefined
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22631

Windows 11 Home

I have the Jupyter extension installed in Cursor, it has this version:

v2024.4.0

I have Python installed:

python --version 
Python 3.12.2

Further Troubleshooting:

The Cursor Chat said to try checking the Jupyter version via the terminal:

jupyter --version

Which returned:

jupyter: The term ‘jupyter’ is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The Cursor Chat then said to try running this:

pip install jupyter

So I did, and it kind of looked like it completed, but it also displayed this error:

“ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: ‘C:\Python312\Scripts\pywin32_postinstall.py’
Consider using the --user option or check the permissions.”

So Cursor Chat said to try running this:

pip install --user jupyter

So I did that, and it looks like it completed without errors, but it displayed warnings like:

“WARNING: The script wsdump.exe is installed in ‘C:\Users<my-name>\AppData\Roaming\Python\Python312\Scripts’ which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.”

I restarted Cursor, and again tried to accept the code that Cursor Chat wanted to run, ie:

from ide import IDE

ide = IDE()
ide.new("testing_only.js")

But I got the same error:

“Failed to find a kernel to run the code. Please install the Jupyter extension”.

Then Cursor Chat told me to add this to the PATH (user variables):

C:\Users\<my-username>\AppData\Roaming\Python\Python312\Scripts

So I did, and now when I run jupyter --version, it returns this:

jupyter --version
Selected Jupyter core packages…
IPython : 8.26.0
ipykernel : 6.29.5
ipywidgets : 8.1.3
jupyter_client : 8.6.2
jupyter_core : 5.7.2
jupyter_server : 2.14.2
jupyterlab : 4.2.3
nbclient : 0.10.0
nbconvert : 7.16.4
nbformat : 5.10.4
notebook : 7.2.1
qtconsole : 5.5.2
traitlets : 5.14.3

But again when I try and execute the code provided by Cursor Chat in interpreter mode, it says:

“Failed to find a kernel to run the code. Please install the Jupyter extension.”

The Cursor Chat told me to run this:

pip install --upgrade --force-reinstall jupyter

And it completed with error:

“ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: ‘C:\Python312\Scripts\pywin32_postinstall.py’
Consider using the --user option or check the permissions.”

So it said to run this:

pip install --user --upgrade --force-reinstall jupyter

So I did and it completed successfully.

I restarted Cursor and tried to run the ‘Interpreter Mode’ code again, ie:

from ide import IDE

ide = IDE()
ide.new("testing_only.js")

And it returned the same error:

“Failed to find a kernel to run the code. Please install the Jupyter extension.”

I told Cursor Chat I was getting frustrated, and in Interpreter Mode it offered me some simple echo code and trying to execute it returned an error:

“Shell not supported. Command detection must be available, for now.”

In case it helps anyone else…

It seems to be working now.

Below are all the steps I tried, as documented in the last post:

  • Installing the Jupyter extension in Cursor Marketplace
    (‘release’ and then later switched to ‘pre-release’ in case it helped)
  • pip install jupyter
  • pip install --user jupyter
  • Add this to PATH:
    C:\Users\<my-username>\AppData\Roaming\Python\Python312\Scripts
  • pip install --upgrade --force-reinstall jupyter
  • pip install --user --upgrade --force-reinstall jupyter

I am assuming some of those steps are not required.

I hope this incorrect list of steps will assist someone make an officially correct list of steps.

Then I completed these steps, which seem to have made it work:

  • Install the Python extension from ‘ms-python’ in Cursor Marketplace
  • Press ‘Ctrl’ + ‘Shift’ + ‘P’ in Cursor to bring up command palette
  • Type Python and select ‘Python: Select Interpreter’
  • Select the 3.12.2 version

Attached screenshot shows these last steps.

Prior to those last steps, Cursor Chat took me down a rabbit hall that lasted a couple of hours where it asked me to create Jupyter notebooks and run various Jupyter commands like this:

jupyter notebook 

I have no idea what Jupyter is (even after Cursor Chat has tried to explain it to me) and what those commands actually did or created on my system.

It would be good if the docs were updated to give specific instructions on how to enable ‘Interpreter Mode’ and perhaps some succinct information on what exactly Jupyter is and why it is required.

UPDATE:

After restarting Cursor and trying ‘Interpreter Mode’ again, I got this message:

Running cells with ‘Python 3.11.0’ requires the ipykernel package.

Install
Change Kernel
More Info
Cancel

I don’t know what this means.

interpreter_mode_after_cursor_restart

I have pressed Ctrl + Shift + P to bring up command palette and the interpreter for both Python and Jupyter is the 3.12.2 version.

Command Palette:
select_jupyter_and_python_interpreter

Jupyter interpreter setting;
select_jupyter_interpreter

Python interpreter setting:
select_python_interpreter

But for some reason, the 3.11 version of Jupyter keeps starting up when I start an Interpreter Mode chat.

“Connecting to kernel: Python 3.11.1: Connecting to kernel: Python 3.11…”

when_starting_interpreter_mode_chat

It’s working now, but it took me several hours.

Hopefully this provides clearer steps to reproduce and unpack further.

============

Now, I only have Python 3.12.2 installed on my computer.

And I installed these extensions in Cursor Marketplace:

  • Python from ms-python
  • Jupyter from ms-toolsai

When I start a chat with ‘Interpreter Mode’, it tries to connect to the 3.12 kernel (as shown in the notification message in the bottom right of the screen).

connecting_to_3.12.2

Then it displays a message saying:

“Running cells with ‘Python 3.12.2’ requires the ipkernel package”.

requires_ipkernel

And the options are:

Install
Change Kernel
More Info
Cancel

After trying the ‘Install’ button many times before and it not resolving the issue, I just clicked ‘Cancel’.

I looked at the ‘More Info’ link and it says:

When the Python extension is installed, any Python environment (meaning a Python interpreter and an associated location for Python packages), installed on the system can be used as a kernel to execute Python code. Without the Python extension installed, the Jupyter extension can only find kernels installed into Jupyter-registered locations. The default kernel for Python is provided by the IPyKernel package. If you select an environment on the system that does not have IPyKernel installed and attempt to run the notebook, you will be prompted to install IPyKernel. If it’s installed, that environment can be used as a valid kernel for Jupyter notebooks in Visual Studio Code.

Note: You do not need to install jupyter into the Python environment you want to use. Only IPython and IPyKernel are required to launch a Python process as a kernel and execute code against your notebook, e.g., pip install ipython ipykernel.

If I press ‘Ctrl’ + ‘Shift’ + ‘P’ in Cursor to bring up the Command Palette and select:

Jupyter: Select Interpreter to Start Jupyter Server

and then select:

Python 3.12.2

select_jupyter_intepreter_3.12.2

I get an error dialog message:

“Running cells with ‘Python 3.12.2’ requires the jupyter package”

requires_jupyter_package

And the options are:

Install
Change Interpreter
Cancel

Again, because I don’t trust that ‘Install’ will resolve the issue, I just click ‘Cancel’.

Per the jupyter docs, I tried to just install the following (in cmd prompt as admin):

pip install ipython ipykernel

And there was an ERROR at the bottom, and some messages about missing dependencies:

C:\Windows\System32>pip install ipython ipykernel
Collecting ipython
  Using cached ipython-8.26.0-py3-none-any.whl.metadata (5.0 kB)
Collecting ipykernel
  Using cached ipykernel-6.29.5-py3-none-any.whl.metadata (6.3 kB)
Requirement already satisfied: decorator in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipython) (5.1.1)
Requirement already satisfied: jedi>=0.16 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipython) (0.19.1)
Requirement already satisfied: matplotlib-inline in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipython) (0.1.7)
Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipython) (3.0.47)
Requirement already satisfied: pygments>=2.4.0 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipython) (2.18.0)
Requirement already satisfied: stack-data in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipython) (0.6.3)
Collecting traitlets>=5.13.0 (from ipython)
  Using cached traitlets-5.14.3-py3-none-any.whl.metadata (10 kB)
Requirement already satisfied: colorama in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipython) (0.4.6)
Requirement already satisfied: comm>=0.1.1 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipykernel) (0.2.2)
Requirement already satisfied: debugpy>=1.6.5 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipykernel) (1.8.2)
Collecting jupyter-client>=6.1.12 (from ipykernel)
  Using cached jupyter_client-8.6.2-py3-none-any.whl.metadata (8.3 kB)
Collecting jupyter-core!=5.0.*,>=4.12 (from ipykernel)
  Using cached jupyter_core-5.7.2-py3-none-any.whl.metadata (3.4 kB)
Requirement already satisfied: nest-asyncio in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipykernel) (1.6.0)
Requirement already satisfied: packaging in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipykernel) (24.1)
Requirement already satisfied: psutil in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from ipykernel) (6.0.0)
Collecting pyzmq>=24 (from ipykernel)
  Using cached pyzmq-26.0.3-cp312-cp312-win_amd64.whl.metadata (6.1 kB)
Collecting tornado>=6.1 (from ipykernel)
  Using cached tornado-6.4.1-cp38-abi3-win_amd64.whl.metadata (2.6 kB)
Requirement already satisfied: parso<0.9.0,>=0.8.3 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from jedi>=0.16->ipython) (0.8.4)
Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from jupyter-client>=6.1.12->ipykernel) (2.9.0.post0)
Requirement already satisfied: platformdirs>=2.5 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (4.2.2)
Requirement already satisfied: pywin32>=300 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from jupyter-core!=5.0.*,>=4.12->ipykernel) (306)
Requirement already satisfied: wcwidth in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython) (0.2.13)
Requirement already satisfied: executing>=1.2.0 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from stack-data->ipython) (2.0.1)
Requirement already satisfied: asttokens>=2.1.0 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from stack-data->ipython) (2.4.1)
Requirement already satisfied: pure-eval in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from stack-data->ipython) (0.2.2)
Requirement already satisfied: six>=1.12.0 in c:\users\<my-username>\appdata\roaming\python\python312\site-packages (from asttokens>=2.1.0->stack-data->ipython) (1.16.0)
Using cached ipython-8.26.0-py3-none-any.whl (817 kB)
Using cached ipykernel-6.29.5-py3-none-any.whl (117 kB)
Using cached jupyter_client-8.6.2-py3-none-any.whl (105 kB)
Using cached jupyter_core-5.7.2-py3-none-any.whl (28 kB)
Using cached pyzmq-26.0.3-cp312-cp312-win_amd64.whl (770 kB)
Using cached tornado-6.4.1-cp38-abi3-win_amd64.whl (438 kB)
Using cached traitlets-5.14.3-py3-none-any.whl (85 kB)
Installing collected packages: traitlets, tornado, pyzmq, jupyter-core, jupyter-client, ipython, ipykernel
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
ipywidgets 8.1.3 requires jupyterlab-widgets~=3.0.11, which is not installed.
nbconvert 7.16.4 requires jupyterlab-pygments, which is not installed.
notebook 7.2.1 requires jupyter-server<3,>=2.4.0, which is not installed.
notebook 7.2.1 requires jupyterlab<4.3,>=4.2.0, which is not installed.
notebook 7.2.1 requires jupyterlab-server<3,>=2.27.1, which is not installed.
Successfully installed ipykernel-6.29.5 ipython-8.26.0 jupyter-client-8.6.2 jupyter-core-5.7.2 pyzmq-26.0.3 tornado-6.4.1 traitlets-5.14.3

Cursor Chat said to install the missing dependencies one-by-one, so i did (in cmd prompt as admin):

pip install jupyterlab-widgets~=3.0.11
pip install jupyterlab-pygments
pip install jupyter-server==2.4.0
pip install jupyterlab==4.2.0
pip install jupyterlab-server==2.27.1

It then said to check:

jupyter --version

Which returned:

Selected Jupyter core packages...
IPython          : 8.26.0
ipykernel        : 6.29.5
ipywidgets       : 8.1.3
jupyter_client   : 8.6.2
jupyter_core     : 5.7.2
jupyter_server   : 2.4.0
jupyterlab       : 4.2.0
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.2.1
qtconsole        : 5.5.2
traitlets        : 5.14.3

Interestingly, I didn’t have to adjust the PATH environment variable in order for the jupyter command to work (i had to do this on previous attempts).

The result of jupyter kernelspec list is:

Available kernels:
python3 C:\Python312\share\jupyter\kernels\python3

I then closed Cursor, restarted it, did this step again:

Press ‘Ctrl’ + ‘Shift’ + ‘P’ in Cursor to bring up the Command Palette and select:

Jupyter: Select Interpreter to Start Jupyter Server

and then select:

Python 3.12.2

And there were no errors.

When I started chatting in Interpreter Mode again, I could see that it was connected to the 3.12.2 kernel.

And there were no errors and it seemed to work.

So that was a very horrible way to do it.

I am sure there must be a better way.

But hopefully my troubleshooting makes it clear what some of the issues are.