6

I keep getting this error message when trying to run the python interactive window in VS Code. I have tried this on another laptop with no issue but for some reason, it happens on my other laptop. The error message is:

"Executing code failed : Error: Jupyter server crashed. Unable to connect. 
Error code from jupyter: 1"

I've tried uninstalling VS Code, uninstalling the python extension, researching the error code online, but no luck.

Jee Mok
  • 6,157
  • 8
  • 47
  • 80
sethtjf
  • 63
  • 1
  • 2
  • 6
  • Perhaps you already have something running on port `8888` which Jupyter uses by default. I doubt it though. – Kermit Sep 18 '19 at 00:41
  • How would check that? – sethtjf Sep 18 '19 at 02:59
  • Hey @sethtjf. I'm a developer on this extension. I have a couple of things that could help to diagnose this. 1. First off, you are launching jupyter from your selected python environment in VSCode when you use the interactive window. When using that same environment outside of vscode (from the command like) can you run jupyter notebook and get a valid server? 2. If your answer to #1 is yes, can you also look at your console log in VSCode. Just try to run the interactive window and copy out what you see in Help->Toggle Developer Tools in the console window. – Ian Huff Sep 18 '19 at 18:07
  • Hi Ian, thank you for your response. I am not able to launch jupyter from the command line and connect to a server. – sethtjf Sep 19 '19 at 21:32

4 Answers4

12

I had a similar issue. I had to configure a setting in the VSCODE command palette.

"Python: Select Interpreter to Start Jupyter server"

and select an environment with Jupyter installed, to allow vscode to start the server.

https://github.com/microsoft/vscode-python/issues/11048 (see comment on 9th April)

jmarlow
  • 176
  • 2
  • 6
  • thanks this fixes it. had an issue with a venv that although had all the jupyter packages installed, failed to start up. – oronimbus Feb 25 '23 at 11:17
  • This worked for me too, but on Mac I had to write: "Jupyter: Select Interpreter to start Jupyter server" in the command palette and select my virtual environment. – chilifan Mar 23 '23 at 11:20
3
sudo -H pip install jupyter

This is your solution. I was have same problem.

halilsaral
  • 31
  • 1
  • This does not really answer the question. If you have a different question, you can ask it by clicking [Ask Question](https://stackoverflow.com/questions/ask). To get notified when this question gets new answers, you can [follow this question](https://meta.stackexchange.com/q/345661). Once you have enough [reputation](https://stackoverflow.com/help/whats-reputation), you can also [add a bounty](https://stackoverflow.com/help/privileges/set-bounties) to draw more attention to this question. - [From Review](/review/late-answers/33889129) – Ihor Baklykov Feb 24 '23 at 11:04
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – xlmaster Feb 24 '23 at 12:20
2

In VS Code you can go to command palette by ctrl+shift+P and type jupyter and you will get a dropdown and select filter kernels it should activate your jupyter sessions.

buddemat
  • 4,552
  • 14
  • 29
  • 49
0

Run this on the terminal and this should solve the problem.

sudo -H pip install jupyter
S.B
  • 13,077
  • 10
  • 22
  • 49