Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to restart kernel with the default interpreter with the standalone Windows installer #17042

Closed
dalthviz opened this issue Dec 16, 2021 · 5 comments

Comments

@dalthviz
Copy link
Member

dalthviz commented Dec 16, 2021

Problem Description

Trying to restart the kernel while using the default interpreter ends in the following being print in the console:

`Exception in thread Thread-8:
Traceback (most recent call last):
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\threading.py", line 926, in _bootstrap_inner
  File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\threading.py", line 870, in run
  File "C:\Users\dalth\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\comms\frontendcomm.py", line 124, in poll_thread
    self.poll_one()
  File "C:\Users\dalth\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\comms\frontendcomm.py", line 144, in poll_one
    self._comm_close(msg)
  File "C:\Users\dalth\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\comms\frontendcomm.py", line 241, in _comm_close
    self.close(comm_id)
  File "C:\Users\dalth\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\comms\frontendcomm.py", line 104, in close
    return super(FrontendComm, self).close(comm_id)
  File "C:\Users\dalth\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\comms\commbase.py", line 173, in close
    self._comms[comm_id]['comm'].close()
  File "C:\Users\dalth\AppData\Local\Programs\Spyder\pkgs\ipykernel\comm\comm.py", line 118, in close
    self.kernel.comm_manager.unregister_comm(self)
  File "C:\Users\dalth\AppData\Local\Programs\Spyder\pkgs\ipykernel\comm\manager.py", line 54, in unregister_comm
    comm = self.comms.pop(comm.comm_id)
KeyError: 'b98c76c05e9e11ec8766f8a2d65bae71'

Although sometimes no message is printed but the kernel seems like is dead since when trying to interact with the Variable Explore a message appears:

imagen

Checked with a conda installed version and there seems like the kernel restart is working

What steps reproduce the problem?

  1. Try to restart the kernel of the initial IPython Console launched with Spyder

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

Versions

  • Spyder version: 5.2.1 None
  • Python version: 3.7.9 64-bit
  • Qt version: 5.12.10
  • PyQt5 version: 5.12.3
  • Operating System: Windows 10

Dependencies

# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree                  :  None (OK)
IPython >=7.6.0               :  7.30.1 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jellyfish >=0.7               :  0.8.9 (OK)
jsonschema >=3.2.0            :  4.2.1 (OK)
keyring >=17.0.0              :  23.4.0 (OK)
nbconvert >=4.0               :  6.3.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.8.1 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.10.0 (OK)
pylint >=2.5.0                :  2.12.2 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.3.2;<1.4.0          :  1.3.3 (OK)
pylsp_black >=1.0.0           :  1.0.1 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.2.1;<5.3.0      :  5.2.2 (OK)
qtpy >=1.5.0                  :  1.11.3 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  59.6.0 (OK)
sphinx >=0.6.6                :  4.3.1 (OK)
spyder_kernels >=2.2.0;<2.3.0 :  2.2.0 (OK)
textdistance >=4.2.0          :  4.2.2 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog                      :  2.1.6 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  0.29.25 (OK)
matplotlib >=2.0.0            :  3.5.1 (OK)
numpy >=1.7                   :  1.19.3 (OK)
pandas >=1.1.1                :  1.3.5 (OK)
scipy >=0.17.0                :  1.7.3 (OK)
sympy >=0.7.3                 :  1.9 (OK)

@dalthviz
Copy link
Member Author

Pinging @ccordoba12 and @impact27 (maybe you have some ideas of why this could be happening)

@ccordoba12
Copy link
Member

ccordoba12 commented Dec 16, 2021

Hmm, this is bad news. What happens if you enclose this line

spyder_kernels\comms\commbase.py", line 173

in a try/except KeyError and pass on the error? I think that should solve the problem.

@dalthviz
Copy link
Member Author

Hmm, this is bad news. What happens if you enclose this line

spyder_kernels\comms\commbase.py", line 173

in a try/except KeyError and pass on the error? I think that should solve the problem.

Checked that but the problem persist

Also checked running on debug mode and this is what I'm getting when trying to restart the kernel in the log:

2021-12-17 10:50:58,728 [DEBUG] [traitlets] -> handle_close[f8e51e825f5011ecae9bf8a2d65bae71]({'header': {'msg_id': 'a9c1647a-693217bd498333ac1f3ed0a4_15000_414', 'msg_type': 'comm_close', 'username': 'username', 'session': 'a9c1647a-693217bd498333ac1f3ed0a4', 'date': datetime.datetime(2021, 12, 17, 15, 50, 58, 669705, tzinfo=tzutc()), 'version': '5.3'}, 'msg_id': 'a9c1647a-693217bd498333ac1f3ed0a4_15000_414', 'msg_type': 'comm_close', 'parent_header': {'msg_id': '6de7f0bb-83b363b4ca60eb0bd2794439_2320_155', 'msg_type': 'comm_msg', 'username': 'username', 'session': '6de7f0bb-83b363b4ca60eb0bd2794439', 'date': datetime.datetime(2021, 12, 17, 15, 50, 57, 899579, tzinfo=tzutc()), 'version': '5.3'}, 'metadata': {}, 'content': {'data': {}, 'comm_id': 'f8e51e825f5011ecae9bf8a2d65bae71'}, 'buffers': []})
2021-12-17 10:50:58,911 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std
2021-12-17 10:50:59,922 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std
2021-12-17 10:51:00,934 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std
2021-12-17 10:51:01,939 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std
2021-12-17 10:51:02,945 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std
2021-12-17 10:51:03,945 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std
2021-12-17 10:51:04,940 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std
2021-12-17 10:51:05,954 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std
2021-12-17 10:51:06,970 [DEBUG] [spyder_kernels.comms.commbase] -> Call to unconnected comm: flush_std

@impact27
Copy link
Contributor

This would be solved by #16890 I think

@ccordoba12
Copy link
Member

Trying to restart the kernel while using the default interpreter ends in the following being print in the console

This is going to be fixed when spyder-ide/spyder-kernels#362 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants