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

Step-by-step debugging with IPython console doesn't work in 3.1.4. #4421

Closed
larschristensen opened this issue May 2, 2017 · 24 comments
Closed

Comments

@larschristensen
Copy link

larschristensen commented May 2, 2017

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.

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)

@ccordoba12
Copy link
Member

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

You can revert to 3.1.3 in the meantime.

@ccordoba12 ccordoba12 added this to the v3.2 milestone May 2, 2017
@ccordoba12 ccordoba12 changed the title Step-by-step debugging with IPython doesn't work under Windows 10 with Spyder 3.1.4. Step-by-step debugging with IPython console in 3.1.4. May 2, 2017
@ccordoba12 ccordoba12 changed the title Step-by-step debugging with IPython console in 3.1.4. Step-by-step debugging with IPython console doesn't work in 3.1.4. May 2, 2017
@larschristensen
Copy link
Author

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?

@ccordoba12
Copy link
Member

Just run in a terminal

spyder --show-console

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

@larschristensen
Copy link
Author

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

@ccordoba12
Copy link
Member

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

@denson
Copy link

denson commented May 11, 2017

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

@ccordoba12
Copy link
Member

ccordoba12 commented May 11, 2017

@denson, please read my explanation in #4395.

@fscarpa58
Copy link

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?

@ccordoba12
Copy link
Member

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

@fscarpa58
Copy link

done. thank you

@amine-aboufirass
Copy link

amine-aboufirass commented Jun 1, 2017

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//issues/3040)].

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

@j-chacon
Copy link

j-chacon commented Jun 7, 2017

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

@ccordoba12
Copy link
Member

@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).

@sebma
Copy link

sebma commented Jun 29, 2017

@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 ?

@sebma
Copy link

sebma commented Jun 29, 2017

@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 ?

@ccordoba12
Copy link
Member

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).

@sebma
Copy link

sebma commented Jun 29, 2017

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 ?

@ccordoba12
Copy link
Member

Yes, it is.

@sebma
Copy link

sebma commented Jun 30, 2017

@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 ?

@ccordoba12
Copy link
Member

I can't do that, sorry.

@sebma
Copy link

sebma commented Jun 30, 2017

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

@ccordoba12
Copy link
Member

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.

@sebma
Copy link

sebma commented Jun 30, 2017

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

@ccordoba12
Copy link
Member

It does, this is just an unfortunate case.

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

7 participants