spyder: TimeoutError: Timeout while waiting for comm port.

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

this is a duplication of #11889 but as that one is closed, and the problem still persists, @goanpeca asked me to report this one next time it pops up.

The issue reporter however didn’t have the Submit to Github button enabled (not sure if that is a bug in itself) anyway, I’ll do it on Github itself 😉

What steps reproduce the problem?

On a Linux (Ubuntu 20.04) box, installed miniforge (so everything comes from conda-forge) and then I created a fresh environment like this:

(base) me@mybox:~$ conda create -n s4 python=3.7
(base) me@mybox:~$ conda activate s4
(s4) me@mybox:~$ conda install spyder
...
(s4) me@mybox:~$ conda list spyder
# packages in environment at /home/me/my-envs/s4:
#
# Name                    Version                   Build  Channel
spyder                    4.1.3                    py37_0  
spyder-kernels            1.9.1                    py37_0  
(s4) me@mybox:~$ spyder
libpng warning: bKGD: invalid
libpng warning: bKGD: invalid
libpng warning: bKGD: invalid
libpng warning: bKGD: invalid

the libpng warnings are probably not harmfull, but good to know I would say 😉 anyway, after a while the issue reporter pops up (best case), sometimes it doesn’t pop up, but one can see the exception on the internal console! (not sure what that is all about)

What is the expected output? What do you see instead?

N/A

Paste Traceback/Error Below (if applicable)

  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/qtconsole/base_frontend_mixin.py", line 138, in _dispatch
    handler(msg)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py", line 172, in _handle_execute_reply
    self.refresh_namespacebrowser()
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py", line 63, in refresh_namespacebrowser
    callback=self.set_namespace_view
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 538, in __call__
    call_dict, call_data, self._comm_id)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 130, in _get_call_return_value
    with self.comm_channel_manager(comm_id, queue_message=not interrupt):
  File "/home/nerohmot/my-envs/s4/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 87, in comm_channel_manager
    timeout)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 168, in _wait
    raise TimeoutError(timeout_msg)
TimeoutError: Timeout while waiting for comm port.
Traceback (most recent call last):
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/qtconsole/base_frontend_mixin.py", line 138, in _dispatch
    handler(msg)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py", line 172, in _handle_execute_reply
    self.refresh_namespacebrowser()
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py", line 63, in refresh_namespacebrowser
    callback=self.set_namespace_view
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 538, in __call__
    call_dict, call_data, self._comm_id)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 130, in _get_call_return_value
    with self.comm_channel_manager(comm_id, queue_message=not interrupt):
  File "/home/nerohmot/my-envs/s4/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 87, in comm_channel_manager
    timeout)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 168, in _wait
    raise TimeoutError(timeout_msg)
TimeoutError: Timeout while waiting for comm port.
Traceback (most recent call last):
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 554, in set_current_client_working_directory
    shellwidget.set_cwd(directory)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/widgets/shell.py", line 178, in set_cwd
    self.call_kernel(interrupt=True).set_cwd(dirname)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder_kernels/comms/commbase.py", line 538, in __call__
    call_dict, call_data, self._comm_id)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 130, in _get_call_return_value
    with self.comm_channel_manager(comm_id, queue_message=not interrupt):
  File "/home/nerohmot/my-envs/s4/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 87, in comm_channel_manager
    timeout)
  File "/home/nerohmot/my-envs/s4/lib/python3.7/site-packages/spyder/plugins/ipythonconsole/comms/kernelcomm.py", line 168, in _wait
    raise TimeoutError(timeout_msg)
TimeoutError: Timeout while waiting for comm port.

Versions

  • Spyder version: 4.1.3
  • Python version: 3.7.6
  • Qt version: 5.9.7
  • PyQt version: 5.9.2
  • Operating System name/version: Linux Ubuntu 20.04 (x86_64)

Dependencies

# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.5.0 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.16.1 (OK)
jedi =0.15.2                   :  0.15.2 (OK)
keyring                        :  None (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.5.3 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.10 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.2 (OK)
qtconsole >=4.6.0              :  4.7.5 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.1.2 (OK)
spyder_kernels >=1.9.1;<1.10.0 :  1.9.1 (OK)
watchdog                       :  None (OK)
xdg >=0.26                     :  0.26 (OK)
zmq >=17                       :  19.0.1 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  None (OK)
numpy >=1.7                    :  None (OK)
pandas >=0.13.1                :  None (OK)
scipy >=0.17.0                 :  None (OK)
sympy >=0.7.3                  :  None (OK)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (14 by maintainers)

Most upvoted comments

I think most of these timeout errors come from kernels that fail to launch for unrelated reasons.

Proposal:

  • The blocking=True option should automatically fail if the kernel is not connected.
  • Any function that calls blocking=True should handle the case where the kernel is not up yet.
  • The timeout error should only be displayed if the kernel is up and resonsive on the other comms. (And displayed in the shellwidget?)

I will try something on a PR

Hi @impact27

Ok, next time I have this situation again I will document it better. (don’t have anything anymore from that case)

So I think the only solution for it is to drop our comms channel and use instead the control channel, which is created at kernel initialization time (so there’s no need for us to do it) and it was added for this kind of job (i.e. to have an extra channel for debuggers and stuff like that).

This wouldn’t work, see https://github.com/ipython/ipykernel/issues/447