Spyder: psutil.NoSuchProcess when restarting the kernel

Created on 19 Mar 2020  路  6Comments  路  Source: spyder-ide/spyder

Description

What steps will reproduce the problem?

import turtle as tt

def draw_square():
    window = tt.Screen()
    window.bgcolor('light blue')

    pony = tt.Turtle()
    pony.speed(1)
    pony.forward(100)
    pony.right(90)

    window.exitonclick()

draw_square()
tt.bye()

This script will have no response while the second time I run it.

Traceback

  File "C:\Users\zhour\Anaconda3\lib\site-packages\psutil\_pswindows.py", line 707, in wrapper
    return fun(self, *args, **kwargs)
  File "C:\Users\zhour\Anaconda3\lib\site-packages\psutil\_pswindows.py", line 954, in create_time
    return cext.proc_create_time(self.pid)
ProcessLookupError: [Errno 3] No such process

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\zhour\Anaconda3\lib\site-packages\psutil\__init__.py", line 474, in _init
    self.create_time()
  File "C:\Users\zhour\Anaconda3\lib\site-packages\psutil\__init__.py", line 824, in create_time
    self._create_time = self._proc.create_time()
  File "C:\Users\zhour\Anaconda3\lib\site-packages\psutil\_pswindows.py", line 709, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=16124)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\zhour\Anaconda3\lib\site-packages\qtconsole\manager.py", line 27, in poll
    super(QtKernelRestarter, self).poll()
  File "C:\Users\zhour\Anaconda3\lib\site-packages\jupyter_client\restarter.py", line 113, in poll
    self.kernel_manager.restart_kernel(now=True, newports=newports)
  File "C:\Users\zhour\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 361, in restart_kernel
    self.shutdown_kernel(now=now, restart=True)
  File "C:\Users\zhour\Anaconda3\lib\site-packages\jupyter_client\manager.py", line 321, in shutdown_kernel
    self._kill_kernel()
  File "C:\Users\zhour\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\utils\manager.py", line 78, in _kill_kernel
    self.kill_proc_tree(self.kernel.pid)
  File "C:\Users\zhour\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole\utils\manager.py", line 44, in kill_proc_tree
    parent = psutil.Process(pid)
  File "C:\Users\zhour\Anaconda3\lib\site-packages\psutil\__init__.py", line 447, in __init__
    self._init(pid)
  File "C:\Users\zhour\Anaconda3\lib\site-packages\psutil\__init__.py", line 487, in _init
    raise NoSuchProcess(pid, None, msg)
psutil.NoSuchProcess: psutil.NoSuchProcess no process found with pid 16124
WARNING:traitlets:kernel died: 18.000895500183105
WARNING:traitlets:kernel died: 18.000853061676025
WARNING:traitlets:kernel died: 18.000853538513184
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853061676025
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853061676025
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000852823257446
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853300094604
WARNING:traitlets:kernel died: 18.000853061676025

Versions

  • Spyder version: 4.1.0
  • Python version: 3.7.6
  • Qt version: 5.9.6
  • PyQt5 version: 5.9.2
  • Operating System: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.3.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.3.0 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.11.1 (OK)
jedi =0.14.1                   :  0.14.1 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
paramiko >=2.4.0               :  2.7.1 (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.6.7 (OK)
pygments >=2.0                 :  2.5.2 (OK)
pylint >=0.25                  :  2.4.4 (OK)
pyls >=0.31.2;<0.32.0          :  0.31.8 (OK)
qdarkstyle >=2.8               :  2.8 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.1 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.3 (OK)
sphinx >=0.6.6                 :  2.4.0 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.0 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  3.1.2 (OK)
numpy >=1.7                    :  1.18.1 (OK)
pandas >=0.13.1                :  1.0.0 (OK)
scipy >=0.17.0                 :  1.3.2 (OK)
sympy >=0.7.3                  :  None (OK)
Windows IPython Console Bug

Most helpful comment

It's confusing that I cannot reproduce this as well today. I will post new info if I meet any similar situation. Thank you guys

All 6 comments

THIS SCRIPT WILL HAVE NO RESPONSE WHILE THE SECOND TIME I RUN IT.

Please stop using caps in your next messages. That's considered rude and not due to that we're going to help you faster.

@dalthviz could you help me and see if you can reproduce this? (I have not been able to reproduce it)

@goanpeca I was unable to reproduce this with 4.1.0 and 4.1.1. Just in case this is my env (using Spyder 4.1.1):


# packages in environment at C:\Users\Daniel\Anaconda3\envs\4v:
#
# Name                    Version                   Build  Channel
alabaster                 0.7.12                   py37_0
argh                      0.26.2                   py37_0
asn1crypto                1.3.0                    py37_0
astroid                   2.3.3                    py37_0
atomicwrites              1.3.0                    py37_1
attrs                     19.3.0                     py_0
autopep8                  1.4.4                      py_0
babel                     2.8.0                      py_0
backcall                  0.1.0                    py37_0
bcrypt                    3.1.7            py37he774522_0
blas                      1.0                         mkl
bleach                    3.1.0                    py37_0
ca-certificates           2020.1.1                      0
certifi                   2019.11.28               py37_0
cffi                      1.13.2           py37h7a1dbc1_0
chardet                   3.0.4                 py37_1003
cloudpickle               1.2.2                      py_0
colorama                  0.4.3                      py_0
cryptography              2.8              py37h7a1dbc1_0
cycler                    0.10.0                   py37_0
decorator                 4.4.1                      py_0
defusedxml                0.6.0                      py_0
diff-match-patch          20181111                   py_0
docutils                  0.15.2                   py37_0
entrypoints               0.3                      py37_0
flake8                    3.7.9                    py37_0
freetype                  2.9.1                ha9979f8_1
future                    0.18.2                   py37_0
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2                 ha66f8fd_1
idna                      2.8                      py37_0
imagesize                 1.2.0                      py_0
importlib_metadata        1.3.0                    py37_0
intel-openmp              2019.4                      245
intervaltree              3.0.2                      py_0
ipykernel                 5.1.3            py37h39e3cac_0
ipython                   7.11.1           py37h39e3cac_0
ipython_genutils          0.2.0                    py37_0
isort                     4.3.21                   py37_0
jedi                      0.15.2                   py37_0
jinja2                    2.10.3                     py_0
joblib                    0.14.1                     py_0
jpeg                      9b                   hb83a4c4_2
jsonschema                3.2.0                    py37_0
jupyter_client            5.3.4                    py37_0
jupyter_core              4.6.1                    py37_0
keyring                   20.0.0                   py37_0
kiwisolver                1.1.0            py37ha925a31_0
lazy-object-proxy         1.4.3            py37he774522_0
libpng                    1.6.37               h2a8f88b_0
libsodium                 1.0.16               h9d3ae62_0
libspatialindex           1.9.3                h33f27b4_0
markupsafe                1.1.1            py37he774522_0
matplotlib                3.1.1            py37hc8f65d3_0
mccabe                    0.6.1                    py37_1
mistune                   0.8.4            py37he774522_0
mkl                       2019.4                      245
mkl-service               2.3.0            py37hb782905_0
mkl_fft                   1.0.15           py37h14836fe_0
mkl_random                1.1.0            py37h675688f_0
more-itertools            8.0.2                      py_0
nbconvert                 5.6.1                    py37_0
nbformat                  4.4.0                    py37_0
numpy                     1.17.4           py37h4320e6b_0
numpy-base                1.17.4           py37hc3f5095_0
numpydoc                  0.9.2                      py_0
openssl                   1.1.1e               he774522_0
packaging                 20.0                       py_0
pandas                    0.25.3           py37ha925a31_0
pandoc                    2.2.3.2                       0
pandocfilters             1.4.2                    py37_1
paramiko                  2.6.0                    py37_0
parso                     0.5.2                      py_0
pathtools                 0.1.2                      py_1
pexpect                   4.7.0                    py37_0
pickleshare               0.7.5                    py37_0
pip                       19.3.1                   py37_0
pluggy                    0.13.1                   py37_0
prompt_toolkit            3.0.2                      py_0
psutil                    5.6.7            py37he774522_0
pycodestyle               2.5.0                    py37_0
pycparser                 2.19                     py37_0
pydocstyle                4.0.1                      py_0
pyflakes                  2.1.1                    py37_0
pygments                  2.5.2                      py_0
pylint                    2.4.4                    py37_0
pynacl                    1.3.0            py37h62dcd97_0
pyopenssl                 19.1.0                   py37_0
pyparsing                 2.4.6                      py_0
pyqt                      5.9.2            py37h6538335_2
pyrsistent                0.15.6           py37he774522_0
pysocks                   1.7.1                    py37_0
python                    3.7.6                h60c2a47_2
python-dateutil           2.8.1                      py_0
python-jsonrpc-server     0.3.2                      py_0
python-language-server    0.31.9                   py37_0
pytz                      2019.3                     py_0
pywin32                   227              py37he774522_0
pywin32-ctypes            0.2.0                    py37_0
pyyaml                    5.2              py37he774522_0
pyzmq                     18.1.0           py37ha925a31_0
qdarkstyle                2.8                        py_0
qt                        5.9.7            vc14h73c81de_0
qtawesome                 0.6.0                      py_0
qtconsole                 4.6.0                      py_1
qtpy                      1.9.0                      py_0
requests                  2.22.0                   py37_1
rope                      0.14.0                     py_0
rtree                     0.8.3                    py37_0
scikit-learn              0.22.1           py37h6288b17_0
scipy                     1.3.2            py37h29ff71c_0
setuptools                44.0.0                   py37_0
sip                       4.19.8           py37h6538335_0
six                       1.13.0                   py37_0
snowballstemmer           2.0.0                      py_0
sortedcontainers          2.1.0                    py37_0
sphinx                    2.3.1                      py_0
sphinxcontrib-applehelp   1.0.1                      py_0
sphinxcontrib-devhelp     1.0.1                      py_0
sphinxcontrib-htmlhelp    1.0.2                      py_0
sphinxcontrib-jsmath      1.0.1                      py_0
sphinxcontrib-qthelp      1.0.2                      py_0
sphinxcontrib-serializinghtml 1.1.3                      py_0
spyder                    4.1.1                    py37_1
spyder-kernels            1.9.0                    py37_0
sqlite                    3.30.1               he774522_0
testpath                  0.4.4                      py_0
tornado                   6.0.3            py37he774522_0
traitlets                 4.3.3                    py37_0
ujson                     1.35             py37hfa6e2cd_0
urllib3                   1.25.7                   py37_0
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_1
watchdog                  0.9.0                    py37_1
wcwidth                   0.1.7                    py37_0
webencodings              0.5.1                    py37_1
wheel                     0.33.6                   py37_0
win_inet_pton             1.1.0                    py37_0
wincertstore              0.2                      py37_0
wrapt                     1.11.2           py37he774522_0
yaml                      0.1.7                hc54c509_2
yapf                      0.28.0                     py_0
zeromq                    4.3.1                h33f27b4_3
zipp                      0.6.0                      py_0
zlib                      1.2.11               h62dcd97_3


turtle

@WhatFishBoat how are you running the script? could you provide more details about the way the issue is showing for you? Any new info is greatly appreciated in order to reproduce this

It's confusing that I cannot reproduce this as well today. I will post new info if I meet any similar situation. Thank you guys

Thanks @WhatFishBoat!

I could reproduce it and it'll be fixed in 4.1.2.

Was this page helpful?
0 / 5 - 0 ratings