question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error command 'python.viewOutput' already exists: Jupyter notebook does not connect to kernel

See original GitHub issue

It’s that time again: What time is it? The time when VS Code’s Jupyter extension randomly fails on the user! Hooray! Everyone’s favorite time!!!

Running VS Code locally connecting to our work server over SSH using the VS Code - Remote SSH extension. Was working fine until a few hours ago.

Jupyter extension v2022.5.1001601848 Python extension v2022.8.1

Connecting to kernel: my_conda_env_py_38 (Python 3.8.13): Activating Python Environment ‘Python 3.8.13 (‘my_conda_env_py_38’)’

Version: 1.68.1 (Universal) Commit: 30d9c6cd9483b2cc586687151bcbcd635f373630 Date: 2022-06-14T12:52:13.188Z Electron: 17.4.7 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Darwin x64 21.5.0

Steps to repro:

  1. Open a Jupyter notebook.
  2. Select kernel from upper right dropdown menu.
  3. Execute first cell of notebook with Shift+Enter.

Nothing happens:

Connecting to kernel: my_conda_env_py_38 (Python 3.8.13): Activating Python Environment ‘Python 3.8.13 (‘my_conda_env_py_38’)’ (Source: Jupyter (Extension)

Yes, I’m using the latest version of VS Code. Yes, I’m using the latest version of the Jupyter extension. Yes, I’m using the latest version of the Python extension. No, I didn’t update or change anything: one moment I’m executing cells in my notebook. Suddenly the notebook stops responding, and the “Select Kernel” appears in upper right of the notebook. Dunno why.

Try executing a cell with a simple print statement and all I see is “Go To Running Cell” spinning clockwise indefinitely while in the lower right, Connecting to kernel: my_conda_env_py_38 (Python 3.8.13): Activating Python Environment 'Python 3.8.13 ('my_conda_env_py_38')' (Source: Jupyter (Extension)

Several hours spent uninstalling Jupyter extension, uninstalling Python extension, reloading VS Code, reinstalling Jupyter extension, reinstalling Python extension, trying once again to run Jupyter notebook, getting the same error, trying to run the aforementioned steps in some other permutation. Cursing silently. Cursing aloud. Contemplating throwing laptop out of window.

I just want a stable IDE that is reliable, dependable, and doesn’t crash when using a notebook. That’s it.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:28 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
PixlRainbowcommented, Jul 10, 2022

Similar issue repro with a local Linux installation – using miniconda 4.12.0 Checking the logs appears to say that the conda environment could not be activated by vscode

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

however, activating the conda environment works fine when done manually from the bash terminal. It just seems as if the extension’s exec environment isn’t making use of the init script installed inside .bashrc.

Note that on a local installation, this produces a misleading error message on the GUI stating that jupyter and notebook need to be installed (even though they are already installed)

1reaction
karrtikrcommented, Oct 6, 2022

@loodvn Your issue seems different, can you create a new one with these details?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error command 'python.viewOutput' already exists: Jupyter ...
Running VS Code locally connecting to our work server over SSH using the VS Code - Remote SSH extension. Was working fine until...
Read more >
Failed to start the Kernel - Jupyter in VS Code - Stack Overflow
I got the same error message because the jupyter package was missing in my selected environment. pip install jupyter.
Read more >
How to Fix Kernel Error in Jupyter Notebook
So, a kernel error occurs when Jupyter fails to connect with a specific version of Python. When the system encounters difficulties locating ...
Read more >
How to fix Kernel Error or broken Python in Jupyter Notebook
TL;DW BELOW! If you delete or upgrade your python version, you might get a Kernel Error when trying to use Jupyter Notebooks !...
Read more >
What to do when things go wrong - The Jupyter Notebook
If Jupyter gives an error that it can't find notebook , check with pip or conda ... There's a special fallback for the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found