visual studio code – VSCode: Running cells with ‘.venv (Python 3.13.5)’ requires the ipykernel and pip package

I’m using VSCode version 1.105.0. I want to run some Python code in Jupyter Notebook. To do this, I need to install ipykernel, which I do after activating venv (pip install ipykernel). Next, I execute the first cell in my .ipynb file, and the following is shown in red below the cell:

Running cells with '.venv (Python 3.13.5)' requires the ipykernel package.
Install 'ipykernel' into the Python environment. 
Command: '"c:/[myDirectory]/.venv/Scripts/python.exe" -m pip install ipykernel -U --force-reinstall'

(I’ve edited the path to the directory and abbreviated it as \[myDirectory\] for readability here.)
Additionally, a pop-up message appears:

Running cells with '.venv (Python 3.13.5)' requires the ipykernel and pip package.

When i want to run the command suggested in the message, nothing seems to be happening (no output on the terminal suggesting that ipykernel is indeed being reinstalled). See below:

(.venv) PS C:/[myDirectory]/.venv/Scripts/python.exe" -m pip install ipykernel -U --force-reinstall
>> 

Additionally, when i go into ./venv/Lib/site-packages I can see both pip and ipykernel there.

Deleting the venv, recreating it and reactivating leads to the same output as described above.

I’d be very thankful for any help.

Read more here: Source link