mwouts / jupytext

Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts
https://jupytext.readthedocs.io
MIT License
6.6k stars 386 forks source link

Can't create or open notebooks after installing jupytext #1264

Closed ctcjab closed 1 month ago

ctcjab commented 2 months ago

Just tried installing jupytext for the first time in a container running the jupyter-minimal-notebook image (by running pip install --user jupytext). Now when I try to create or open a notebook, I can't, and am shown an "unhandled error" message in the UI. In the console output, I see a TypeError: 'coroutine' object is not subscriptable error.

Click for full error output ``` [I 2024-07-30 01:45:58.333 ServerApp] Creating new notebook in [E 2024-07-30 01:45:58.334 ServerApp] Uncaught exception POST /api/contents?1722303958331 (192.168.65.1) HTTPServerRequest(protocol='http', host='127.0.0.1:8888', method='POST', uri='/api/contents?1722303958331', version='HTTP/1.1', remote_ip='192.168.65.1') Traceback (most recent call last): File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute result = await result ^^^^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupyter_server/auth/decorator.py", line 73, in inner return await out ^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 285, in post await self._new_untitled(path, type=type, ext=ext) File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 233, in _new_untitled self.contents_manager.new_untitled(path=path, type=type, ext=ext) File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 410, in new_untitled config = self.get_config(path) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 581, in get_config self.cached_config.config = self.load_config_file( ^^^^^^^^^^^^^^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 550, in load_config_file config_content = model["content"] ~~~~~^^^^^^^^^^^ TypeError: 'coroutine' object is not subscriptable [W 2024-07-30 01:45:58.337 ServerApp] wrote error: 'Unhandled error' Traceback (most recent call last): File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute result = await result ^^^^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupyter_server/auth/decorator.py", line 73, in inner return await out ^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 285, in post await self._new_untitled(path, type=type, ext=ext) File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 233, in _new_untitled self.contents_manager.new_untitled(path=path, type=type, ext=ext) File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 410, in new_untitled config = self.get_config(path) ^^^^^^^^^^^^^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 581, in get_config self.cached_config.config = self.load_config_file( ^^^^^^^^^^^^^^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 550, in load_config_file config_content = model["content"] ~~~~~^^^^^^^^^^^ TypeError: 'coroutine' object is not subscriptable ```

I noticed that my pip install jupytext command installed v1.16.3, which is currently the latest version published to PyPI, but a v1.16.4 was tagged two weeks ago and not published to PyPI (looks like some associated CI jobs failed, maybe that's why?). In any case, I tried pip installing v1.16.4 from git, and still got a TypeError: 'coroutine' object is not subscriptable, though the traceback was different.

Click for full error output ``` [I 2024-07-30 02:22:44.447 ServerApp] Creating new notebook in [E 2024-07-30 02:22:44.447 ServerApp] Uncaught exception POST /api/contents?1722306164441 (192.168.65.1) HTTPServerRequest(protocol='http', host='127.0.0.1:8888', method='POST', uri='/api/contents?1722306164441', version='HTTP/1.1', remote_ip='192.168.65.1') Traceback (most recent call last): File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute result = await result ^^^^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupyter_server/auth/decorator.py", line 73, in inner return await out ^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 285, in post await self._new_untitled(path, type=type, ext=ext) File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 233, in _new_untitled self.contents_manager.new_untitled(path=path, type=type, ext=ext) File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 410, in new_untitled File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 581, in get_config File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 550, in load_config_file TypeError: 'coroutine' object is not subscriptable [W 2024-07-30 02:22:44.450 ServerApp] wrote error: 'Unhandled error' Traceback (most recent call last): File "/opt/conda/lib/python3.11/site-packages/tornado/web.py", line 1790, in _execute result = await result ^^^^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupyter_server/auth/decorator.py", line 73, in inner return await out ^^^^^^^^^ File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 285, in post await self._new_untitled(path, type=type, ext=ext) File "/opt/conda/lib/python3.11/site-packages/jupyter_server/services/contents/handlers.py", line 233, in _new_untitled self.contents_manager.new_untitled(path=path, type=type, ext=ext) File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 410, in new_untitled File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 581, in get_config File "/opt/conda/lib/python3.11/site-packages/jupytext/contentsmanager.py", line 550, in load_config_file TypeError: 'coroutine' object is not subscriptable ```

A similar issue was reported in #1020 but that was closed as completed 6 months ago. Perhaps this is a regression.

(base) jovyan@56a646cfa1b5:~$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.26.0
ipykernel        : 6.29.5
ipywidgets       : not installed
jupyter_client   : 8.6.2
jupyter_core     : 5.7.2
jupyter_server   : 2.14.2
jupyterlab       : 4.1.8
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.1.3
qtconsole        : not installed
traitlets        : 5.14.3
mwouts commented 1 month ago

Thank you @ctcjab for reporting this. I've just fixed the publish CI and now jupytext==1.16.4 is available on pypi. Would you mind retrying with that version? Thanks!

ctcjab commented 1 month ago

Looks like that did the trick. Thanks for the quick fix, @mwouts!

mwouts commented 1 month ago

Awesome! Thank you for the confirmation!