jhicks2306
jhicks2306

Reputation: 101

Failed to start the Kernel. Cannot run Jupyter Notebook in VS Code for Windows. Issue with Traitlets

I am trying to run a Jupyter Notebook in VS Code for Windows and running into an issue with traitlets. Can anyone help?

Following steps to re-create:

  1. Start new Python virtual environment.
  2. Create new Jupyter Notebook (.ipynb file)
  3. Open file in VS Code for Windows and select virtual environment's interpreter.
  4. Try and run print('hello') in the first kernel.

The error message I get:

Failed to start the Kernel. 
c:\Users\XX\python_projects\demo_issue\myenv\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.
  warn(
c:\Users\XX\python_projects\demo_issue\myenv\lib\site-packages\traitlets\traitlets.py:2157: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '7518421c-2675-406f-81c8-3e4a669b0c20' instead of 'b"7518421c-2675-406f-81c8-3e4a669b0c20"'.
  warn(
Bad file descriptor (C:\projects\libzmq\src\epoll.cpp:100). 
View Jupyter log for further details.

I have tried to install an earlier version of traitlets (python -m pip install traitlets<5 --force-reinstall) but it creates dependency conflicts:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
ipython 8.3.0 requires traitlets>=5, but you have traitlets 4.3.3 which is incompatible.
ipykernel 6.13.0 requires traitlets>=5.1.0, but you have traitlets 4.3.3 which is incompatible.

And I also get this error under the kernel:

The file 'myenv\lib\site-packages\traitlets\utils\__init__.py' seems to be overriding built in modules and interfering with the startup of the kernel. Consider renaming the file and starting the kernel again.
Click here for more info.

Here is a screenshot of the main issue, in case helpful. enter image description here

Does anyone how any ideas of how I might fix? What am I doing wrong?

Thank you for any help you can give!

Upvotes: 3

Views: 8416

Answers (1)

jhicks2306
jhicks2306

Reputation: 101

Update

I followed this part of the original error message for a solution:

Bad file descriptor (C:\projects\libzmq\src\epoll.cpp:100). 

Installing an earlier version for pyzmq seemed to address the issue for now:

python -m pip install pyzmq==19.0.2 --force-reinstall

Although it still gives this warning:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
jupyter-client 7.3.0 requires pyzmq>=22.3, but you have pyzmq 19.0.2 which is incompatible.

Upvotes: 5

Related Questions