Cannot start Jupyter Notebook kernel in VSCode - python

I tried to install the Jupyter Notebook Kernel on VSCode, and it cant seem to connect, it shows this text in the VSCode:
Failed to start the Kernel.
C:\Users\Theodore\AppData\Roaming\Python\Python310\site-packages\traitlets\traitlets.py:2412: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
warn(
C:\Users\Theodore\AppData\Roaming\Python\Python310\site-packages\traitlets\traitlets.py:2366: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '7d0f2f44-841e-4868-9c82-374720d9f73e' instead of 'b"7d0f2f44-841e-4868-9c82-374720d9f73e"'.
warn(
Bad address (C:\projects\libzmq\src\epoll.cpp:100).
View Jupyter log for further details.
Python version : 3.10.4
Jupyter Notebook Version: 6.4.12
I tried switching to the kernel from Anaconda, but it also doesn't seem to work. Sometimes it just asks me to reinstall the ipykernel again. Thanks for your help.

Turns out I have a VPN, and it made it crash, i used this in the CMD:
netsh winsock reset
and it worked. Thanks for your help

Use command pip install ipykernel in the cmd.
Alternative method:
Use following command in the terminal to reinstall pyzmq package.
pip uninstall pyzmq
pip install pyzmq

Related

Jupyter cells go blank after scrolling in Vscode

I just upgraded to the latest version of VSCODE 1.75.0, and now jupyter is not working properly in VSCODE...
I am about to uninstall everything and reinstall VSCODE and jupyter. But if there is an easier fix for this I would love to know.
I can minimize the jupyter cell and then re-open it and the code will appear, but when I scroll down and scroll back up, everything is blank.
I have tried uninstalling the jupyter vscode extension, and python extensions using
python3 -m pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab_pygments notebook qtconsole nbconvert nbformat jupyterlab-widgets nbclient
but it is still opening the files as a notebook somehow... so there must be an extension somewhere causing this.
Update, uninstalling the entire application and re-installing it solved the problem. I noticed that it went from 1.75.0 to 1.75.1 as well.
According to this issue on github last week.
This is the error of VsCode 1.75.0. You can use the latest version of 1.75.1 or use the old version to solve this problem.
You can also add the following codes to your settings.json so that VsCode will update by itself:
"update.mode": "default",

Failed to start the Kernel : Supporting extra quotes around strings is deprecated in traitlets 5.0

This is the error message displayed when I run the code in vs code:
C:\Anaconda3\envs\paul\lib\site-packages\traitlets\traitlets.py:2202: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
I have tried the following and failed:
pip install pywin32==228
python -m pip install traitlets==4.3.3 --force-reinstall
python -m pip install pyzmq==19.0.2 --force-reinstall
I had the same issue. This is how i fixed it.
first open a terminal in your project dir and open jupyter-notebook using a browser.
try running the code there and check if kernel still crashes. For my case it was crashing becasue CUDnn was missing zlibwapi.dll file. This error didn't show up in jupyter log when i was running in vscode. So I downloaded it from: http://www.winimage.com/zLibDll/zlib123dllx64.zip
After downloading, I put the dll file into {cudnn_root}/bin/ folder
This fixed my problem. Alternatively u can try to install my exact environment. Here is the link: https://drive.google.com/file/d/1V2bash_j1tQNFfJtwOqXw-DmWGCe4Ive/view?usp=sharing. U can install it via pip install -r "filename.txt" command.

Trouble in jupyter notebook running by line (f10) with VS Code

Problem:
When I try running code by line (f10) with VS Code, "ipykernel setup required for this feature" message pops up.
What I've tried:
Using Anaconda Prompt: "conda install ipykernel", "conda install -c conda-forge ipykernel"
-When I tried this, the prompt said "conda-forge:: ipykernel-6.4.1-py38h595 --> pkgs/main:: ipykernel-6.2.0-py38haa95532_1"
Doesn't it mean I already install ipykernel v.6.20 or higher?
After I tried this I checked Jupyter --Version it said ipykernel 5.3.2
Other specs are qualified. (VS Code, Jupyter, Anaconda versions etc,)
Using Terminal (in VS Code): "pip install ipykernel"
Reinstalling all of add-ins such as Python for VS, Python, Anaconda, Jupyterlab, VS Code
Updating ExecutionPolicy: CurrentUser-RemoteSigned, LocalMachins-AllSigned, others Undefined.
+) Created virtual-env named envi which is conda env. In VS Code I selected this interpreter and also reloaded all windows.
As I understand, Conda install Ipkkernel > Reload is what pop-up msg required.
This is what I'm going through now.. I just got interested in Python and now I cannot doing anything..
I had the same problem. It seems there was a problem with the version of ipython or ipykernel since I managed to fix it by running the following commands in conda environment:
pip install --upgrade ipython
pip install --upgrade ipykernel
Don't know which of the two was the problem but I was able to use the jupyter notebook line-by-line feature after this.

Unable to start jupyter notebook in visual studio code

I am trying to make a jupyter notebook in visual studio code but I keep getting this:
''Unable to start session for kernel Python 3.8.3 64-bit ('Lenovo':
virtualenv). Select another kernel to launch with.''
I have anaconda installed and the jupyter notebook works fine in the anaconda navigator. I also tried to use python 3.8.3 base:'conda' but it didnt work. I'm using windows 10
This issue also occurs on my computer. The solution is to restore the version number of a dependency package "traitlets" of ipython kernel to 4.3.3.
You could try to use "pip list" to view the version of the module "traitlets" in the current virtual environment. If it shows version 5.0, it is recommended that you use version 4.3.3.
You could reinstall "traitlets 4.3.3" with the following command:
python -m pip install 'traitlets==4.3.3' --force-reinstall
If this command is not available, you could use 'pip' to uninstall traitlets5.0 (pip uninstall traitlets) and then use 'pip' to install traitlets4.3.3.(pip install traitlets==4.3.3)
Reference: Unable to start session for kernel Python.
I had the exact same problem. Fix it by uninstalling the Python extension that is linked to that error message.
If you are using conda to manage your Python environments, activate your target environment at a command prompt, then enter the following:
$ conda install traitlets=4.3.3
This solved the problem for me.

Unable to start Jupyter notebook on VS Code

(Using latest miniconda + VS Code on 64-bit Windows10:) After clean reinstalling VS Code, I can no longer launch jupyter notebook from within it. When I tried to create a new jupyter file for the first time, the Python extension installed ipykernel in my virtual environment "da38" (my main working environment). Then it stays on Connecting to IPython kernel: Connecting to kernel for an unusually long time, and stops with the error message Unable to start session for kernel Python 3.8.5 64-bit ('da38':conda) (images pasted below). I also removed and re-created da38 environment just in case. Used jupyter many times before with no issues until this new VS Code install today, and an identical setup is working on my other computer. Any help is appreciated. Thanks!
I had the latest version and below command worked for me
python -m pip install 'traitlets==4.3.3' --force-reinstall
This issue also occurs on my computer. The solution is to restore the version number of a dependency package "traitlets" of ipython kernel to 4.3.3.
You could try to use "conda list" to view the version of the module traitlets in the current conda environment. If it shows version 5.0, it is recommended that you use version 4.3.3.
Reference: Unable to start session for kernel Python.
I had this same problem. What worked for me is updating ipykernel.
$ pip install ipykernel --upgrade
I also did a few other upgrades just in case.
$ pip install traitlets --upgrade
$ pip install notebook --upgrade
I did not role back to an older version like 'traitlets==4.3.3'.
If anyone facing same issues now, Can check below steps which helped me to solve this
Update and Restart VS code
Install latest Jupyter Extension from Extensions.
We need to update "ipykernel" and restart VSC:
pip install ipykernel --upgrade

Categories