Opened 3 months ago

Last modified 3 months ago

#69357 assigned defect

py311-jupyterlab: jupyter lab fails to launch: ImportError: cannot import name 'run_sync_in_worker_thread' from 'anyio'

Reported by: agl2015 Owned by: stromnov (Andrey Stromnov)
Priority: Normal Milestone:
Component: ports Version: 2.9.1
Keywords: Cc: p-bro
Port: py311-jupyterlab

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Under the latest version of macOS Sonoma (14.3.1) running on a late 2020 15" MacBook Pro, the command "jupyter lab" fails with the following error:

Traceback (most recent call last):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/jupyter-lab", line 33, in <module>
    sys.exit(load_entry_point('jupyterlab==3.0.13', 'console_scripts', 'jupyter-lab')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/jupyter-lab", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyterlab/__init__.py", line 7, in <module>
    from .labapp import LabApp
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyterlab/labapp.py", line 15, in <module>
    from jupyterlab_server import slugify, WORKSPACE_EXTENSION
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyterlab_server/__init__.py", line 4, in <module>
    from .app import LabServerApp
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyterlab_server/app.py", line 7, in <module>
    from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyter_server/extension/application.py", line 21, in <module>
    from jupyter_server.serverapp import ServerApp
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyter_server/serverapp.py", line 75, in <module>
    from jupyter_server.services.contents.filemanager import AsyncFileContentsManager, FileContentsManager
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/jupyter_server/services/contents/filemanager.py", line 15, in <module>
    from anyio import run_sync_in_worker_thread
ImportError: cannot import name 'run_sync_in_worker_thread' from 'anyio' (/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/anyio/__init__.py)

Change History (2)

comment:1 Changed 3 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Owner: set to stromnov
Port: py311-jupyterlab added; py312-jupyter-lab removed
Status: newassigned
Summary: jupyter lab fails to launchpy311-jupyterlab: jupyter lab fails to launch: ImportError: cannot import name 'run_sync_in_worker_thread' from 'anyio'

The name run_sync_in_worker_thread was deprecated in py-anyio 3.0.0; the new name anyio.to_thread.run_sync should now be used. Last month py-anyio was updated from version 3.7.1 to 4.2.0. Although the py-anyio changelog does not mention it by name, I presume that run_sync_in_worker_thread was removed entirely in py-anyio 4.0.0 since there are half a dozen bullet points describing backwards-incompatible changes in that version.

comment:2 Changed 3 months ago by p-bro

Cc: p-bro added
Note: See TracTickets for help on using tickets.