Spyder: Step-by-step debugging with IPython console doesn't work in 3.1.4.

Created on 2 May 2017  路  24Comments  路  Source: spyder-ide/spyder

Description

After upgrading from Spyder 3.1.3 to 3.1.4, step-by-step debugging with IPython in Spyder doesn't work anymore as it fails on all programs after a few single-steps with the error "Restarting kernel because an error occurred while debugging". Single-step debugging the same code in an ipython terminal works fine, so it seems to only be a problem when debugging via Spyder.

What steps will reproduce the problem?

  1. Start the debugger on any program, e.g. the trivial test program below.
  2. Single-step a couple of times for the error to occur. It is not consistent how many single-steps are required before the error occurs, but it is just a few and thus effectively making debugging in Spyder unusable.
  3. 3.

What is the expected output? What do you see instead?
Single-step debugging should work.

Please provide any additional information below
Here is the trivial test program (test.py) used:

for i in range(10):
    print("i = {}".format(i))

The IPython console output when single-step debugging the test program in Spyder is as follows:

Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 6.0.0 -- An enhanced Interactive Python.

debugfile('C:/Users/lars/Desktop/test.py', wdir='C:/Users/lars/Desktop')

c:\users\lars\desktop\test.py(1)()
----> 1 for i in range(10):
2 print("i = {}".format(i))
3
4

c:\users\lars\desktop\test.py(2)()
1 for i in range(10):
----> 2 print("i = {}".format(i))
3
4

i = 0

c:\users\lars\desktop\test.py(1)()
----> 1 for i in range(10):
2 print("i = {}".format(i))
3
4

ipdb>
ipdb> > c:\users\lars\desktop\test.py(2)()
1 for i in range(10):
----> 2 print("i = {}".format(i))
3
4

ipdb> i = 1

c:\users\lars\desktop\test.py(1)()
----> 1 for i in range(10):
2 print("i = {}".format(i))
3
4

c:\users\lars\desktop\test.py(2)()
1 for i in range(10):
----> 2 print("i = {}".format(i))
3
4

ipdb>
Restarting kernel because an error occurred while debugging

ipdb>
Kernel died, restarting

Version and main components

  • Spyder Version: 3.1.4
  • Python Version: 3.5.3
  • Qt Versions: 5.8.0, PyQt5 5.8.2 on Windows

Dependencies

jedi >=0.9.0     :  0.10.2 (OK)
matplotlib >=1.0 :  2.0.0 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
pandas >=0.13.1  :  None (NOK)
pep8 >=0.6       :  1.7.0 (OK)
pyflakes >=0.6.0 :  1.5.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.7.1 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
sphinx >=0.6.6   :  1.5.5 (OK)
sympy >=0.7.3    :  None (NOK)

Debugger Bug

Most helpful comment

This bug only happens if you're using print's in the middle of a debugging session. Sorry for that, we didn't consider that case.

To revert to 3.1.3 (3.1.2 has other ugly bugs) you have to run

conda install spyder=3.1.3

or

pip install spyder==3.1.3

All 24 comments

Sorry for this error, it's going to be fixed in Spyder 3.2.

You can revert to 3.1.3 in the meantime.

After uninstalling 3.1.4 and installing 3.1.3 via "pip3 install spyder==3.1.3", Spyder 3.1.3 unfortunately doesn't want to start as it just says "Spyder crashed during last session". Is it possible to enable a verbose log in order understand what the problem could be?

Just run in a terminal

spyder --show-console

to see the error message generated while Spyder is starting up.

I have tried running "spyder3.exe --show-console" in a terminal, but there is no output to the terminal.

--show-console should show what errors are affecting Spyder, so I don't know what happens in your case, sorry.

Why is the python console being removed? I _never_ use the IPython console because there always seems to be some issue like this one.

@denson, please read my explanation in #4395.

please,
How can I revert to 3.1.2 version? thank you.
p.s. why do not put this information (3.1.4 bug) on the download page?

This bug only happens if you're using print's in the middle of a debugging session. Sorry for that, we didn't consider that case.

To revert to 3.1.3 (3.1.2 has other ugly bugs) you have to run

conda install spyder=3.1.3

or

pip install spyder==3.1.3

done. thank you

Hello. Same problem here. I downgraded Spyder to 3.1.3 but now I am getting an error regarding the jedi 0.9.0 dependency. Same as this thread: [(https://github.com/spyder-ide/spyder/issues/3040)].

Which version can I use to debug my code with no issues?

Will it be possible to avoid removing the python console (even if it's broken) until there is a consistent place for debugging? or try to fix this before the release of 3.2?

Thanks

@j-chacon, the Python console was already removed, sorry. However, this and many other bugs about debugging are already fixed and will be part of Spyder 3.2 (to be released in two or three weeks).

@ccordoba12 Hi,

I also have this major problem of kernel restarting when doing step-by-step debugging.

Do you know approximately when you will release Spyder 3.2 ?

@ccordoba12 I have just downgraded Spyder to 3.1.3 and therefore jedi to 0.9.0.

This downgrade has downgraded IPython to 6.0.0.

When I run Spyder 3.1.3, I get two errors in the Internal console :

Spyder Internal Console

This console is used to report application
internal errors and to inspect Spyder
internals with the following commands:
  spy.app, spy.window, dir(spy)

Please don't use it to run your code

>>> Traceback (most recent call last):
  File "/usr/local/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'banner'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/miniconda3/lib/python3.6/site-packages/qtconsole/base_frontend_mixin.py", line 163, in _dispatch
    handler(msg)
  File "/usr/local/miniconda3/lib/python3.6/site-packages/qtconsole/jupyter_widget.py", line 296, in _handle_kernel_info_reply
    super(JupyterWidget, self)._started_channels()
  File "/usr/local/miniconda3/lib/python3.6/site-packages/qtconsole/frontend_widget.py", line 617, in _started_channels
    self.reset(clear=True)
  File "/usr/local/miniconda3/lib/python3.6/site-packages/qtconsole/frontend_widget.py", line 661, in reset
    self._append_plain_text(self.banner)
  File "/usr/local/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "/usr/local/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "/usr/local/miniconda3/lib/python3.6/site-packages/spyder/widgets/ipythonconsole/shell.py", line 280, in _banner_default
    return self.long_banner()
  File "/usr/local/miniconda3/lib/python3.6/site-packages/spyder/widgets/ipythonconsole/shell.py", line 91, in long_banner
    from IPython.core.usage import quick_guide
ImportError: cannot import name 'quick_guide'

In the Issue #4382 you are saying it (the ImportError: cannot import name 'quick_guide') will be fixed in Spyder 3.1.4

But Spyder 3.1.4 cannot do step-by-step debugging anymore, which Spyder release can I use ?

Sorry for the confusion. You need to downgrade to IPython 5 for this to work.

which Spyder release can I use ?

Spyder 3.2 will fix this (to be released in a week or two).

If I run conda install ipython=5, conda wants to downgrade it to IPython 5.3.0.

Is that OK for Spyder 3.1.3 ?

Yes, it is.

@ccordoba12 Hi,

This command show the actual dependencies of Spyder 3.1.3 :

$ conda info spyder=3.1.3=py36_0 | sed -n '/^dependencies:/,$p'
dependencies:
    chardet >=2.0.0
    jedi >=0.8
    nbconvert
    numpydoc
    pep8
    pickleshare
    psutil
    pyflakes
    pygments >=2.0
    pylint
    pyqt
    python 3.6*
    python.app
    pyzmq
    qtawesome >=0.4.1
    qtconsole >=4.2
    qtpy >=1.1
    rope
    sphinx

But it does not say that jedi specific version 0.9.0 nor ipython=5 are needed.

Can please you fix Spyder 3.1.3 conda dependencies so that no other people will bother you with them when downgrading spyder ?

I can't do that, sorry.

Do I have to ask conda for them to do it ?

No. The package dependencies were fine when it was published. New IPython and Jedi versions were published between 3.1.3 and 3.1.4, so we created fixes for them in 3.1.4.

I thought conda was well able to manage dependencies when downgrading a package without having to ask the developer for help :(

It does, this is just an unfortunate case.

Was this page helpful?
0 / 5 - 0 ratings