spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.17k stars 1.58k forks source link

Spyder freezes on new project creation #3874

Closed xxblx closed 7 years ago

xxblx commented 7 years ago

Description

Spyder's GUI freezes on new project creation. When new project crated spyder need to be re-opened for working with recently created project because at project creation moment GUI freezes. Already exists projects opens fine.

What steps will reproduce the problem?

  1. Create new empty project
  2. And spyder's GUI will freezes

If start spyder from terminal on freeze it shows exception in stdout/stderr

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/spyder/plugins/projects.py", line 226, in create_new_project
    self.restart_consoles()
  File "/usr/local/lib/python3.5/site-packages/spyder/plugins/projects.py", line 385, in restart_consoles
    self.main.ipyconsole.restart()
  File "/usr/local/lib/python3.5/site-packages/spyder/plugins/ipythonconsole.py", line 1165, in restart
    client.shutdown()
  File "/usr/local/lib/python3.5/site-packages/spyder/widgets/ipythonconsole/client.py", line 300, in shutdown
    self.shellwidget.kernel_manager.shutdown_kernel()
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/manager.py", line 302, in shutdown_kernel
    self.request_shutdown(restart=restart)
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/manager.py", line 252, in request_shutdown
    self.session.send(self._control_socket, msg)
  File "/usr/local/lib/python3.5/site-packages/jupyter_client/session.py", line 684, in send
    stream.send_multipart(to_send, copy=copy)
AttributeError: 'NoneType' object has no attribute 'send_multipart'

Versions and main components

Dependencies

jedi >=0.8.1     :  0.9.0 (OK)
matplotlib >=1.0 :  1.5.3 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
numpy >=1.7      :  1.11.2 (OK)
pandas >=0.13.1  :  0.19.1 (OK)
pep8 >=0.6       :  1.7.0 (OK)
psutil >=0.3     :  5.0.0 (OK)
pyflakes >=0.6.0 :  1.3.0 (OK)
pygments >=2.0   :  2.1.3 (OK)
pylint >=0.25    :  1.6.4 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
rope >=0.9.4     :  0.10.3 (OK)
sphinx >=0.6.6   :  1.5a1 (OK)
sympy >=0.7.3    :  1.0 (OK)
ccordoba12 commented 7 years ago

This problem seems to be related to jupyter_client instead of Spyder. A fix was provided here:

https://github.com/jupyter/jupyter_client/pull/226

However, it's very ugly that Spyder freezes because of this error.


@andfoy, please work on this one. It requires a simple fix: catch any error generated when running client.shutdown() in the restart method of plugins/ipythonconsole.py and show the error in a QMessageBox.warning dialog, saying something like

It was not possible to restart the IPython console when switching to this project. The error was {}

and you put the error in {}