psutil.NoSuchProcess when restarting the kernel
See original GitHub issueDescription
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)
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
psutil 5.9.5 documentation
On some systems such as Linux, on a very busy or long-lived system, the numbers returned by the kernel may overflow and wrap...
Read more >Jupyter lab: Execute destructors on kernel restart
Let's say I instantiate the following class in jupyter lab: class my_class(object): def __init__(self): self.proc = multiprocessing.
Read more >Python Examples of psutil.Process - ProgramCreek.com
This page shows Python examples of psutil.Process.
Read more >How to Use the psutil Module to Retrieve Process and System ...
You can use the psutil module in Python scripts to retrieve information about running processes and system utilization on the device, for example,...
Read more >SaltStack: salt/modules/restartcheck.py - Fossies
82 """ 83 if HAS_PSUTIL: 84 return HAS_PSUTIL 85 else: 86 return (False, ... 214 if kernel_restart: 215 packages.append("System restart required.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
I could reproduce it and it’ll be fixed in 4.1.2.