skip to Main Content
import ipykernel
ipykernel.__version__

the error message is:

The kernel failed to start due to an error with the ‘pyzmq’ module. Consider re-installing this module.

but reinstalling did nothing.
I used vscode, venv, pip, jupyter extensions, python3.11.5

yesterday all worked. Now it doesn’t

Log message is kind of messy. I don’t understand a thing from here, since I never learned to read them. And its message exceeds character limit somehow, so i truncated a middle of it

09:18:29.351 [info] Handle Execution of Cells 0 for Untitled-1.ipynb
09:18:29.352 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd064bd3ed3dfaad75b33d4543646600efc649c4d108c57943078021384b3b64381.~/projects/in_progres/music_lib/.venv/python.~/projects/in_progres/music_lib/.venv/python.-m#ipykernel_launcher  (Python Path: ~/projects/in_progres/music_lib/.venv/bin/python, Venv, .venv, 3.11.5) for 'Untitled-1.ipynb' (disableUI=false)
09:18:29.366 [info] Process Execution: ~/projects/in_progres/music_lib/.venv/bin/python -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
09:18:29.383 [info] Process Execution: ~/projects/in_progres/music_lib/.venv/bin/python -m ipykernel_launcher --ip=127.0.0.1 --stdin=9027 --control=9025 --hb=9024 --Session.signature_scheme="hmac-sha256" --Session.key=b"f75843bc-7cbe-4df7-811d-00f2ee05d919" --shell=9026 --transport="tcp" --iopub=9028 --f=~/.local/share/jupyter/runtime/kernel-v2-14046k3xqZCgo7M18.json
    > cwd: ~/projects/in_progres/music_lib
09:18:29.421 [warn] StdErr from Kernel Process Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
09:18:29.422 [warn] StdErr from Kernel Process from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^

  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
  
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined... View Jupyter [log](command:jupyter.viewOutput) for further details.
09:18:29.431 [error] Failed to connect raw kernel session: Error: The kernel died. Error: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined... View Jupyter [log](command:jupyter.viewOutput) for further details.
09:18:29.432 [warn] Error occurred while trying to start the kernel, options.disableUI=false Error: The kernel died. Error: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .jvsc74a57bd064bd3ed3dfaad75b33d4543646600efc649c4d108c57943078021384b3b64381.~/projects/in_progres/music_lib/.venv/python.~/projects/in_progres/music_lib/.venv/python.-m#ipykernel_launcher
    > Interpreter Id = ~/projects/in_progres/music_lib/.venv/bin/python
    > at ChildProcess.<anonymous> (~/.vscode/extensions/ms-toolsai.jupyter-2023.9.1102792234-linux-x64/out/extension.node.js:24:86356)
    > stdErr = Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined
09:18:29.432 [warn] Kernel Error, context = start Error: The kernel died. Error: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .jvsc74a57bd064bd3ed3dfaad75b33d4543646600efc649c4d108c57943078021384b3b64381.~/projects/in_progres/music_lib/.venv/python.~/projects/in_progres/music_lib/.venv/python.-m#ipykernel_launcher
    > Interpreter Id = ~/projects/in_progres/music_lib/.venv/bin/python
    > at ChildProcess.<anonymous> (~/.vscode/extensions/ms-toolsai.jupyter-2023.9.1102792234-linux-x64/out/extension.node.js:24:86356)
    > stdErr = Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined
09:18:29.447 [info] Process Execution: ~/projects/in_progres/music_lib/.venv/bin/python -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
09:18:29.590 [info] Dispose Kernel 'Untitled-1.ipynb' associated with 'Untitled-1.ipynb'
09:18:29.591 [error] Error in execution Error: The kernel died. Error: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .jvsc74a57bd064bd3ed3dfaad75b33d4543646600efc649c4d108c57943078021384b3b64381.~/projects/in_progres/music_lib/.venv/python.~/projects/in_progres/music_lib/.venv/python.-m#ipykernel_launcher
    > Interpreter Id = ~/projects/in_progres/music_lib/.venv/bin/python
    > at ChildProcess.<anonymous> (~/.vscode/extensions/ms-toolsai.jupyter-2023.9.1102792234-linux-x64/out/extension.node.js:24:86356)
    > stdErr = Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined
09:18:29.591 [error] Error in execution (get message for cell) Error: The kernel died. Error: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined... View Jupyter [log](command:jupyter.viewOutput) for further details.
    > Kernel Id = .jvsc74a57bd064bd3ed3dfaad75b33d4543646600efc649c4d108c57943078021384b3b64381.~/projects/in_progres/music_lib/.venv/python.~/projects/in_progres/music_lib/.venv/python.-m#ipykernel_launcher
    > Interpreter Id = ~/projects/in_progres/music_lib/.venv/bin/python
    > at ChildProcess.<anonymous> (~/.vscode/extensions/ms-toolsai.jupyter-2023.9.1102792234-linux-x64/out/extension.node.js:24:86356)
    > stdErr = Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/__init__.py", line 5, in <module>
    from .connect import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/ipykernel/connect.py", line 11, in <module>
    import jupyter_client
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/__init__.py", line 3, in <module>
    from .asynchronous import AsyncKernelClient
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/jupyter_client/asynchronous/client.py", line 5, in <module>
    import zmq.asyncio
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/__init__.py", line 103, in <module>
    from zmq import backend
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 31, in <module>
    raise original_error from None
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/__init__.py", line 26, in <module>
    _ns = select_backend(first)
          ^^^^^^^^^^^^^^^^^^^^^
  File "~/projects/in_progres/music_lib/.venv/lib/python3.11/site-packages/zmq/backend/select.py", line 35, in select_backend
    raise ImportError(f"Importing {name} failed with {e}") from e
ImportError: Importing zmq.backend.cython failed with name 'Self' is not defined
09:18:29.605 [info] Process Execution: ~/projects/in_progres/music_lib/.venv/bin/python -c "import ipykernel;print('6af208d0-cb9c-427f-b937-ff563e17efdf')"
09:18:29.780 [info] End cell 0 execution @ undefined, started @ undefined, elapsed time = 0s

What I tried:

  • reinstall pyzmq
  • downgrade pyzmq
  • recreate virtual env (i don’t use conda)
  • reinstall python

What I expect: To run code in jupyter block

2

Answers


  1. Chosen as BEST ANSWER

    Ok, turns out the culprit was another file situated in working directory. That file did nothing and was just a stash for code pieces, but its name were "copy.py" and apparently that causes some error when one chooses a venv python interpreter and tries to run notebook (if you create such file "copy.py" while working with existing notebook file, the error doesn't occur, that's why I couldn't identify the source of the problem at once)... p.s. JialeDu, thanks for trying to help)


  2. Use the following command to install a specific version of pyzmq (Make sure you are in the correct kernel environment).

    python -m pip install pyzmq==19.0.2 --force-reinstall
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search