[Python] Can't run Jupyter Notebook in VSCode - Vanilla Python, Windows 10

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    I have an existing vanilla Python installed on my Windows 10 computer and I do not want to reinstall Anaconda.

    When trying to run code from ipynb file in vscode, I get the following error:

    Error: Jupyter cannot be started. Error attempting to locate jupyter:
    at A.startServer (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:786120)
    at async A.ensureServerAndNotebookImpl (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:785575)
    at async A.ensureServerAndNotebook (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:785376)
    at async A.submitCode (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:1:782328)
    at async A.reexecuteCell (c:\Users\[username]\.vscode\extensions\ms-python.python-2020.2.64397\out\client\extension.js:75:879318)


    Also with the following error from VSCode:


    ⓘ Couldn't find kernel 'Python 3' that the notebook was created with. Re...

    ⓧ Jupyter server crashed. Unable to connect. Error code from jupyter: 1
    ​

    (screenshot)


    Below are some of the things I have tried:

    Check if the VSCode Extension in Correctly Installed

    "Jupyter" extension is deprecated. I had the "Python" plugin from Microsoft installed which contained Jupiter Notebook support.

    Jupyter Installed Correctly

    I tried reinstalling jupyter:

    > python -m pip install --upgrade pip
    > pip install jupyter
    > pip install notebook


    Tried to Run Jupyter on Terminal/Command Line

    > jupyter notebook //didn't work
    jupyter : The term 'jupyter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or
    if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + jupyter
    + ~~~~~~~
    + CategoryInfo : ObjectNotFound: (jupyter:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException


    This gave an error not able to find jupyter executable. According to this post I tried the following and it worked: How to fix "'jupyter' is not recognized as an internal or external command, operable program or batch file" when running Jupyter on Windows?

    > python -m notebook


    Check if pointing to the right interpreter

    As per "https://stackoverflow.com/questions/60330837/jupyter-server-not-started-no-kernel-in-vs-code" I tried:

    1. Press Command+Shift+P to open a new command pallete
    2. Type >Python: Select Intepreter to start jupyter notebook server

    But I only had one version of Python installed on my computer, and doing this didn't make a difference.

    Check the Path

    There was this comment about PYTHONPATH on "https://stackoverflow.com/questions/19917492/how-can-i-use-a-python-script-in-the-command-line-without-cd-ing-to-its-director" but since the python directory is correctly referenced and python works from the command line, I did not investigate it further.

    One thing to note is pip installs to my "C:/Users/[username]/appdata/Roaming/Python-38/" folder while my Python is installed in "C:\Program Files\Python38-32\".

    Continue reading...

Compartilhe esta Página