Search code examples
pythonpython-3.xjupyter-notebookjupyterjupyter-lab

Error starting kernel failed to fetch whenever starting jupyter lab from terminal


I feel like this may be a really easy fix since it's such a commonly asked question but for some reason, all the solutions I find on stackoverflow are not working for me (though I might just be misunderstanding application). I use Windows10, I have always started jupyter lab from the Powershell terminal as $ jupyter lab, I recently updated Python 3.10.? to 3.12.2, and I also updated jupyter by using $ pip install --upgrade IPython ipykernel ipywidgets jupyter_client jupyter_core jupyter_server jupyterlab nbclient nbconvert nbformat notebook qtconsole traitlets since I saw a post on stackoverflow suggest manually inputting each core package name into the update command.

No matter what I do, when I open jupyter lab it cycles through 2 warnings:

  • "Error Starting Kernel Failed to fetch"

  • "Server Connection Error A connection to the Jupyter server could not be established. JupyterLab will continue trying to reconnect. Check your network connection or Jupyter server configuration."

If I remember correctly, however, jupyter lab was doing this prior to any updates. The only kernel available is listed as "Python 3 (ipykernel)". Jupyter notebook suffers the same warning popups.

I tried $ jupyter kernelspec list, opening the kernel.json file, and typing in the path I wanted it to take; it was stored in python3 C:\Users\M S\AppData\Local\Programs\Python\Python310\share\jupyter\kernels\python3 and the path I type in for argv was "C:\\Users\\M S\\AppData\\Local\\Programs\\Python\\Python312\\python.exe". When this didn't change anything I reverted the argv back to what it originally said-- just "python".

I tried this sequence of lines in the terminal:

  • python -m venv \AppData\Local\Programs\Python\Python312
  • python -m pip install ipykernel
  • python -m ipykernel install --name python3.12.2kernel --display-name "Python 3.12.2 (ipykernel)" --user and afterwards tried starting from that kernel.

I have tried going into .jupyter\lab\workspaces and deleting the most recent default workspace.

I have tried uninstalling my old Python ver, uninstalling jupyter, and reinstalling only jupyterlab.

I have tried deleting my browser cache.

I haven't revisited Python or jupyter in over a year and have never gotten to know the language very intimately. I'm quite the noob so let me know if there's any other info required to fix this and if the answer exists elsewhere, I'll delete the post. Thank you for reading


Solution

  • I found the answer to my question here after taking a closer look at what Powershell spits out when I try to run jupyter lab: at the end before booting up jupyter lab it spits out Bad address (C:\projects\libzmq\src\epoll.cpp:100) , apparently having something to do with a VPN software I installed that modified my default winsock settings.

    I ran netsh winsock reset as admin, restarted my computer, and jupyter lab is up and working.