[MacPorts] #69357: py311-jupyterlab: jupyter lab fails to launch: ImportError: cannot import name 'run_sync_in_worker_thread' from 'anyio' (was: jupyter lab fails to launch)

MacPorts noreply at macports.org
Sat Feb 17 23:46:53 UTC 2024


#69357: py311-jupyterlab: jupyter lab fails to launch: ImportError: cannot import
name 'run_sync_in_worker_thread' from 'anyio'
-------------------------------+----------------------
  Reporter:  agl2015           |      Owner:  stromnov
      Type:  defect            |     Status:  assigned
  Priority:  Normal            |  Milestone:
 Component:  ports             |    Version:  2.9.1
Resolution:                    |   Keywords:
      Port:  py311-jupyterlab  |
-------------------------------+----------------------
Changes (by ryandesign):

 * status:  new => assigned
 * owner:  (none) => stromnov
 * port:  py312-jupyter-lab => py311-jupyterlab


Old description:

> 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)

New description:

 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)
 }}}

--

Comment:

 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.

-- 
Ticket URL: <https://trac.macports.org/ticket/69357#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list