jupyter_client: Release 6.1.13 nbconvert failing with `TypeError: 'coroutine' object is not subscriptable`

We have a CI build that runs this notebook:

https://github.com/Qiskit/qiskit-tutorials/blob/stable/0.23.x/tutorials/circuits/1_getting_started_with_qiskit.ipynb

It started failing this morning with this error:

[NbConvertApp] Converting notebook /tmp/qiskit-iqx-tutorials/qiskit/tutorials/circuits/1_getting_started_with_qiskit.ipynb to html
[NbConvertApp] Executing notebook with kernel: python3
Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-nbconvert", line 11, in <module>
    sys.exit(main())
  File "/opt/conda/lib/python3.8/site-packages/jupyter_core/application.py", line 254, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/traitlets/config/application.py", line 837, in launch_instance
    app.start()
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 340, in start
    self.convert_notebooks()
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 510, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 481, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/nbconvertapp.py", line 410, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 179, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 197, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/exporters/html.py", line 95, in from_notebook_node
    return super(HTMLExporter, self).from_notebook_node(nb, resources, **kw)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line 307, in from_notebook_node
    nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 139, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/exporters/exporter.py", line 316, in _preprocess
    nbc, resc = preprocessor(nbc, resc)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/preprocessors/base.py", line 47, in __call__
    return self.preprocess(nb, resources)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 405, in preprocess
    nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/preprocessors/base.py", line 69, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 438, in preprocess_cell
    reply, outputs = self.run_cell(cell, cell_index, store_history)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 578, in run_cell
    exec_reply = self._poll_for_reply(parent_msg_id, cell, timeout)
  File "/opt/conda/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 479, in _poll_for_reply
    if msg['parent_header'].get('msg_id') == msg_id:
TypeError: 'coroutine' object is not subscriptable
sys:1: RuntimeWarning: coroutine 'ZMQSocketChannel.get_msg' was never awaited

The only difference in the package lists was jupyter-client 6.1.13 (note that nbconvert is pinned to 5.6.1 in our case).

I don’t know how all of this is related, but was wondering if #623 might be causing some issue.

I have excluded the jupyter-client 6.1.13 version from our build and things are working again. My concern is if this comes back in the next release (6.2?).

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 13
  • Comments: 30 (11 by maintainers)

Commits related to this issue

Most upvoted comments

This issue appears to have cropped up again with jupyter-client 7.0.0 released a couple hours ago: https://pypi.org/project/jupyter-client/#history

Just wanted to confirm that https://github.com/jupyter/jupyter_console/pull/244 indeed fixed my problem. Thanks, @davidbrochart !

@davidbrochart I just merged the PR – though I need ping someone with release privilages to add me or run a patch release for the repo. I’ll check if I can get that added for this week so we can unblock it.

One thing I noticed between @astafan8’s pip freeze output and ours is we’re both using nbconvert 5.6.1 (we’re capped on that project until jupyter/nbconvert#1439 is fixed). So running latest nbconvert unit tests with latest jupyter-client might not show the issue but what about nbconvert==5.6.1?

Recreated here jupyter/nbconvert/pull/1550 with jupyter-client 6.2.0 and nbconvert 5.6.1:

https://travis-ci.org/github/jupyter/nbconvert/jobs/766808690#L1370

self = <nbconvert.preprocessors.execute.ExecutePreprocessor object at 0x7f3e7ca1dd30>

msg_id = '238d6f9e-e6ea4495439b51dfd5175f5b_1'

cell = {'cell_type': 'code', 'metadata': {}, 'outputs': [], 'source': 'from __future__ import print_function\nfrom IPython.display import clear_output'}

timeout = 1

    def _poll_for_reply(self, msg_id, cell=None, timeout=None):

        try:

            # check with timeout if kernel is still alive

            msg = self.kc.shell_channel.get_msg(timeout=timeout)

>           if msg['parent_header'].get('msg_id') == msg_id:

E           TypeError: 'coroutine' object is not subscriptable

This PR should fix it: https://github.com/jupyter/jupyter_console/pull/244 But I don’t have the rights to merge it.

Both releases 6.1.13 and 6.2.0 have been pulled, we are working towards a 7.0.0 release, see #642.

allow me to report that indeed, using the latest nbconvert as opposed to 5.6.1 removed the issue, and luckily we did not experience any slowdowns in the docs build mentioned in jupyter/nbconvert#1439 .

Cool. Note that the performance slowdown issue there is because we’re using object storage with s3fs to back our user notebook pods rather than PVCs (with zero-to-jupyterhub-k8s). The entrypoint import times can get slow with s3fs.