skip to Main Content

I am trying to run a Jupyter Notebook in VS Code. However, I’m getting the following error message whenever I try to execute a cell:

Failed to start the Kernel. 
Jupyter server crashed. Unable to connect. 
Error code from Jupyter: 1
usage: jupyter.py [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]
                  [--paths] [--json] [--debug]
                  [subcommand]

Jupyter: Interactive Computing

positional arguments:
  subcommand     the subcommand to launch

options:
  -h, --help     show this help message and exit
  --version      show the versions of core jupyter packages and exit
  --config-dir   show Jupyter config dir
  --data-dir     show Jupyter data dir
  --runtime-dir  show Jupyter runtime dir
  --paths        show all Jupyter paths. Add --json for machine-readable
                 format.
  --json         output paths as machine-readable json
  --debug        output debug information about paths

Available subcommands:

Jupyter command `jupyter-notebook` not found. 
View Jupyter log for further details.

The Jupyter log referred to by the diagnostic message just contains the same text as the above diagnostic message repeated multiple times.

I believe this post refers to the same issue. Unfortunately, the accepted answer does not work for me because I do not have Python: Select Interpreter to Start Jupyter server in my Command Palette.

The file was working normally this morning. I also tried uninstalling and reinstalling the extensions.

How can I get the Kernel to start?

4

Answers


  1. Did you work in a python environment with jupyter installed?

    I think the problem is that you chose a kernel that does not have jupyter installed, which leads to failure.

    You can click the button on the top right to choose the kernel.

    enter image description here

    Login or Signup to reply.
  2. This sounds like it might be a bug that found in the 2023.1 version of the Jupyter extension that affects MacOS users: Starting a Jupyter server kernel fails (when zmq does not work)
    #12714
    (duplicates: Failed to start the Kernel, version v2023.1.2000312134 #12726, Jupyter server crashed. Unable to connect. #12746) The solution recommended there was to switch to the pre-release version while waiting for the fix to come to the regular-release-channel released the fix. Others in the threads there also found that rolling back to older extension versions also worked for them (you can rollback clicking into the down menu button next to the extension’s uninstall button).

    If none of those solutions work, try this:

    pip install --upgrade --force-reinstall --no-cache-dir jupyter
    

    And then restart VS Code. If you already have it open, you can do this in the VS Code command palette with the Developer: Reload Window command.

    Credit: The above command is based on this answer by @Spandana-r to the question After installing with pip, "jupyter: command not found".

    Login or Signup to reply.
  3. Close the vscode then uninstall jupyter and notebook one after another.

    1. pip uninstall jupyter
    2. pip uninstall notebook

    Now, open vs code and run cell like.
    print ("Hello")
    Vscode will ask you to download jupyter. Allow it. Now It is ready to work.

    Login or Signup to reply.
  4. I followed this suggestion and downgraded my VSCode to the previous version.

    https://stackoverflow.com/a/75405832/14573951

    The previous version worked fine but upgrading to the newest version brought back the issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search