欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ModuleNotFoundError No module named ‘zmq.backend.cython.context‘

程序员文章站 2022-05-27 23:25:55
...

ModuleNotFoundError No module named ‘zmq.backend.cython.context’

ModuleNotFoundError No module named ‘zmq.backend.cython.context‘

在启动jupyter lab的时候,出现No module named 'zmq.backend.cython.context'问题。

(jupyterlab) D:\AWJ\Project>jupyter lab
Traceback (most recent call last):
  File "c:\users\administrator\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\administrator\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Administrator\Envs\jupyterlab\Scripts\jupyter-lab.EXE\__main__.py", line 4, in <module>
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyterlab\__init__.py", line 7, in <module>
    from .labapp import LabApp
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyterlab\labapp.py", line 16, in <module>
    from jupyterlab_server import slugify, WORKSPACE_EXTENSION
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyterlab_server\__init__.py", line 4, in <module>
    from .app import LabServerApp
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyterlab_server\app.py", line 11, in <module>
    from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyter_server\extension\application.py", line 21, in <module>
    from jupyter_server.serverapp import ServerApp
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyter_server\serverapp.py", line 73, in <module>
    from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 19, in <module>
    from jupyter_client.session import Session
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyter_client\__init__.py", line 4, in <module>
    from .connect import *
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyter_client\connect.py", line 21, in <module>
    import zmq
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\zmq\__init__.py", line 62, in <module>
    from zmq import backend
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\zmq\backend\__init__.py", line 32, in <module>
    raise original_error from None
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
    _ns = select_backend(first)
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\zmq\backend\select.py", line 32, in select_backend
    mod = import_module(name)
  File "c:\users\administrator\appdata\local\programs\python\python39\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "c:\users\administrator\envs\jupyterlab\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (
  File "zmq\backend\cython\socket.pyx", line 1, in init zmq.backend.cython.socket
ModuleNotFoundError: No module named 'zmq.backend.cython.context'

卸载重新安装pyzmq

(jupyterlab) D:\AWJ\Project>pip uninstall pyzmq
Found existing installation: pyzmq 21.0.1
Uninstalling pyzmq-21.0.1:
  Would remove:
    c:\users\administrator\envs\jupyterlab\lib\site-packages\pyzmq-21.0.1.dist-info\*
    c:\users\administrator\envs\jupyterlab\lib\site-packages\zmq\*
Proceed (Y/n)? Y
  Successfully uninstalled pyzmq-21.0.1

(jupyterlab) D:\AWJ\Project>pip install pyzmq
Collecting pyzmq
  Downloading pyzmq-22.3.0-cp39-cp39-win_amd64.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 18 kB/s
Installing collected packages: pyzmq
Successfully installed pyzmq-22.3.0

成功启动!

(jupyterlab) D:\AWJ\Project>jupyter lab
[I 2022-01-11 15:18:43.991 ServerApp] jupyterlab | extension was successfully linked.
[W 2022-01-11 15:18:58.436 ServerApp] The 'min_open_files_limit' trait of a ServerApp instance expected an int, not the NoneType None.
[W 2022-01-11 15:18:58.506 ServerApp] Terminals not available (error was No module named 'winpty.cywinpty')
[I 2022-01-11 15:18:58.507 LabApp] JupyterLab extension loaded from c:\users\administrator\envs\jupyterlab\lib\site-packages\jupyterlab
[I 2022-01-11 15:18:58.507 LabApp] JupyterLab application directory is c:\users\administrator\envs\jupyterlab\share\jupyter\lab
[I 2022-01-11 15:18:58.516 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-01-11 15:18:59.296 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-01-11 15:18:59.519 ServerApp] Serving notebooks from local directory: D:\AWJ\Project
[I 2022-01-11 15:18:59.519 ServerApp] Jupyter Server 1.2.2 is running at:
[I 2022-01-11 15:18:59.520 ServerApp] http://localhost:8888/lab?token=a2d46ce69f087d9c958f8927874414b2313fc29f4d75b1c6
[I 2022-01-11 15:18:59.525 ServerApp]  or http://127.0.0.1:8888/lab?token=a2d46ce69f087d9c958f8927874414b2313fc29f4d75b1c6
[I 2022-01-11 15:18:59.525 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2022-01-11 15:18:59.732 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/jpserver-11620-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=a2d46ce69f087d9c958f8927874414b2313fc29f4d75b1c6
     or http://127.0.0.1:8888/lab?token=a2d46ce69f087d9c958f8927874414b2313fc29f4d75b1c6
[W 2022-01-11 15:19:05.835 LabApp] Could not determine jupyterlab build status without nodejs