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

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.