I have installed jupyter notebook and my Python is version 3.10, and there is a problem that is saying :
usr/lib/python3/dist-packages/traitlets/config/loader.py:795: SyntaxWarning: "is" with a literal. Did you mean "=="?
if len(key) is 1:
/usr/lib/python3/dist-packages/traitlets/config/loader.py:804: SyntaxWarning: "is" with a literal. Did you mean "=="?
if len(key) is 1:
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/home/browni/.local/lib/python3.10/site-packages/notebook/notebookapp.py", line 77, in <module>
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
File "/home/browni/.local/lib/python3.10/site-packages/notebook/services/kernels/kernelmanager.py", line 18, in <module>
from jupyter_client.session import Session
File "/home/browni/.local/lib/python3.10/site-packages/jupyter_client/__init__.py", line 8, in <module>
from .asynchronous import AsyncKernelClient # noqa
File "/home/browni/.local/lib/python3.10/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
from .client import AsyncKernelClient # noqa
File "/home/browni/.local/lib/python3.10/site-packages/jupyter_client/asynchronous/client.py", line 6, in <module>
from jupyter_client.channels import HBChannel
File "/home/browni/.local/lib/python3.10/site-packages/jupyter_client/channels.py", line 12, in <module>
import zmq.asyncio
File "/usr/lib/python3/dist-packages/zmq/__init__.py", line 34, in <module>
from zmq import backend
File "/usr/lib/python3/dist-packages/zmq/backend/__init__.py", line 40, in <module>
reraise(*exc_info)
File "/usr/lib/python3/dist-packages/zmq/utils/sixcerpt.py", line 34, in reraise
raise value
File "/usr/lib/python3/dist-packages/zmq/backend/__init__.py", line 27, in <module>
_ns = select_backend(first)
File "/usr/lib/python3/dist-packages/zmq/backend/select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "/usr/lib/python3/dist-packages/zmq/backend/cython/__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (/usr/lib/python3/dist-packages/zmq/backend/cython/__init__.py)
How to make Jupyter Notebook work?
Thanks.
Edited:
I even try to create a virtual environment to install a new jupyter notebook and it still does not work.
I see this problem like mine, but I cannot use the solution:
You have a file named “constants.py” somewhere in your PYTHONPATH, probably in your working directory. It is shadowing a file with the same name belonging to the zmq package. You need to move or rename this file.
I think the real problem is because I install Python 3.10 version, try to replace the Python that comes with the OS that is Python 3.9. Not to mention, I create virtual environment, and then install JULIA and create conda inside it, and call Python from conda inside JULIA. Too many things at the same time thus I forgot how to revert to the original setting. The rule of thumb is to reinstall the OS, a clean start, but it will take time to back up few files first.
It is because I want to use Jupyter Notebook again, if I try to call Python code with ‘python3 test.py’ it can do the work like usual.
But I will try to see and remove this “constants.py” I will get back if it works. Thanks for replying.