Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code does not find Python kernel

I am running VS Code on a Mac OS. I have installed Jupyter extension but I'm unable connect to my Python virtual environments. When I create a new virtual environment with Anaconda, VS Code appropriately recognizes the virtual environments but the ones I create manually do not work.

I have no problem launching Jupyter Notebook in the browser from the command line but I'd like to be able to use VS Code. Also, I have no issues running plain Python scripts in the virtual environment I have created.

I have tried the following steps:

  1. Create a new virtual environment:

    cd ~/.virtuaenvs/
    python3 -m venv new_venv
    
  2. Activate the new virtual environment:

    source new_venv/bin/activate
    
  3. Install ipykernel and jupyter

    pip install ipykernel jupyter
    
  4. Add environment to kernels list

    python3 -m ipykernel install --name "new_venv" --user
    
  5. Restart VS Code. But the new_venv does not show in my list of kernels when opening a Jupyter notebook.

like image 940
Alex Avatar asked Jan 26 '26 23:01

Alex


1 Answers

Had to update the Jupyter extension, even though I had auto-update on.

like image 185
Richard Avatar answered Jan 28 '26 13:01

Richard