Python requires ipykernel to be installed

I encounter an issue when I use the jupyter notebook in VS code. The screen shows "Python 3.7.8 requires ipykernel to be installed". If I followed the pop-up to intall the ipykernel. It still does not work. The screenshots are as attached. It bothers me a lot. Could anyone help me on it? Tons of thanks.enter image description here

enter image description here

1 answer

  • answered 2020-11-25 08:02 Jill Cheng

    The reason is that your current VSCode terminal is in the environment "Deeplearning_Env", so "ipykernel" is installed in the environment "Deeplearning_Env" instead of the environment "base conda" displayed in the pop-up box.

    Solution: Please use the shortcut key Ctrl+Shift+` to open a new VScode terminal, it will automatically enter the currently selected VSCode environment (VSCode lower left corner), and activate this conda environment:

    enter image description here

    Then, click to install "ipykernel" according to the prompt in the pop-up box. Or, we could also install "ipykernel" manually: (pip install ipykernel)

    In addition, for the newly created Python environment (without installing "ipykernel"), before opening the Jupyter file, please refresh the VSCode terminal and enter the currently selected environment. For the conda environment, we need to activate it before using it.

    Check: Check the installation of "ipykernel":

    enter image description here

    More reference: Environment in VSCode.