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
Need to press run twice with matplotlib in spyder #1831
Comments
From contrebasse on 2014-05-27T00:28:48Z Are you in interactive mode or do you call show() at the end of your script ? The show() call is blocking and it could explain why the script doesn't run the second time. However it doesn't explain why it would run fine the third time... |
From dive...@gmail.com on 2014-05-28T05:15:05Z I have the same problem after installing Spyder 2.3.0rc, with the same configuration as markfran. I note however that the problem is present when pressing F5 from a Python console, but not from an IPython one. |
From dive...@gmail.com on 2014-06-02T07:31:12Z Changing interactive mode with plt.ion() or plt.ioff() does not affect this bug. I typically use interactive mode and my procedures show plots without using the plt.show() command. But if I call plt.ioff() before calling my matplotlib procedure, the "press-run-twice" bug appears even if my procedure did not actually show any plot. In summary, as long as I first call from the Python console a procedure which uses a matplotlib function, I need to press run twice to run any subsequent procedure. |
From ccordoba12 on 2014-06-22T20:57:01Z I can't reproduce this in Python 2. Maybe it's an error with Python 3 and Matplotlib, I'm going to check it out. Summary: Need to press run twice with matplotlib in spyder (was: need to press run twice with matplotlib in spyder) |
From ccordoba12 on 2014-06-22T22:38:09Z I have two questions for you (just out of curiousity):
|
From dive...@gmail.com on 2014-06-23T04:24:03Z I tried two different distributions:
The above bug behaves in the same way in both distributions. |
From ccordoba12 on 2014-06-23T13:15:02Z No luck at reproducing this one for me after several hours of work :) I installed the latest Anaconda for 32bit and everything is working as expected (I don't have Win64 to test on). I was also unable to verify issue #1837 and issue #1861 , so I don't see any of them as showstoppers for 2.3, sorry. Maybe you would be better by using IPython instead of plain Python, because IPython guys have worked really hard to smooth all interactions with Matplotlib. @-Sylvain, if you have some free time and access to Win64, could test it just to be sure? |
From sylvain....@gmail.com on 2014-06-23T13:36:09Z Ok I can look into it tonight. I have a win64 at hand. S. |
From dive...@gmail.com on 2014-06-23T15:41:09Z @-ccordoba12 thank you very much for looking into this, and in general for your great work on improving spyder. I love it! My main reason for not using an IPython console with spyder is the lack of a history buffer during debugging. The history only works for me during debugging in the normal Python Console. I am not sure this is intended/expected, or I am doing something wrong... |
From ccordoba12 on 2014-06-23T15:53:04Z I understand your point about IPython. That's a technical limitation on its side, so (unfortunately) we can't do anything about it. You could also try to test your issues in another machine, just to be sure if they are related to Win64 or to your particular setup. |
From sylvain....@gmail.com on 2014-06-23T16:40:11Z Hi, I don't reproduce the described behavior with the current tip of the default branch, with Win7 64bits. Local version of PyQt is 4.10.4. A problem that I have experienced with windows in general is that the matplotlib window is created and remains hidden behind the Spyder window. |
From ccordoba12 on 2014-06-24T04:29:29Z Yes, that's a terrible nuisance that hopefully one day mpl devs fix :) Thanks for your help Sylvain. |
From dive...@gmail.com on 2014-06-24T13:39:59Z @-Sylvain just to be sure, did you try to reproduce this bug on Python 3.3 on Windows? I only have this bug with Python 3.3, but the same Spyder 2.3.0rc work well for me with Python 2.7. |
From sylvain....@gmail.com on 2014-06-24T14:36:14Z Indeed it seems to be a Python 3 specific thing. I will need to test it in a different environment. (Besides, the booststrap script does not seem to work with Python 3) |
From dive...@gmail.com on 2014-06-24T15:23:12Z I also had problems using the booststrap.py script with Python 3. It failed to start. I wanted to be sure I could reproduce the bug with the latest Spyder version. After deleting "C:\Users\myname.spyder2-py3" a few times, Spyder eventually started and gave me the same bug as with the officially released and normally installed 2.3.0rc version. |
From dive...@gmail.com on 2014-06-26T03:16:32Z @ccordoba12 and @-Sylvain I noted that issue #1810 is also the same as this issue #1831 . So it appears this bug was confirmed by at least three different people on different computer and configurations. It appears to be there since Spyder 2.3.0beta2. In all cases the bug appears only under Python 3, whose support is one of the highlights of Spyder 2.3. The bug, with the related issue #1837 and issue #1861 makes the Python Console essentially unusable under Python 3. These issues force one to use IPython for debugging in Spyder, which implies one has to loose the command history. I would vote for raising the priority of this related series of issues, if Spyder 2.3 intends to support Python 3. |
From dive...@gmail.com on 2014-06-27T04:48:19Z I did an additional test, which may help locate the source of the problems. I just downloaded the latest Spyder version from the repository and I used bootstrap.py to start it under Python 2.7.6 (WinPython 64bit). I then went to Preferences/Console/Advanced_settings/Python_Executable and at the section "Use the following Python interpreter" I selected Python 3.3.5. I can confirm that issue #1810 , issue #1831 , issue #1837 and issue #1861 all still apply when I run, compile or debug programs on a Python 3 console, even when running Spyder under Python 2. Hopefully this test will help with finding a solution. |
From sylvain....@gmail.com on 2014-06-27T06:18:47Z @-divenex, thank you for investigating this further. I will look further into it tonight. |
From ccordoba12 on 2014-06-27T10:13:36Z issue #1810 has been merged into this issue. |
From ccordoba12 on 2014-06-27T10:24:59Z A couple of comments:
|
From dive...@gmail.com on 2014-06-27T10:42:58Z @-ccordoba12 thanks a lot for the tests. I really hoped you could reproduce it, as I can't make it go away no matter what I try, on the two Windows (7 and 8) 64bit computers and two distributions (WinPython and Anaconda) I have tried. And two other users reported it... But of course I understand that it's impossible for you to fix it without seeing the bug on your machine. |
From ccordoba12 on 2014-06-27T10:59:08Z Sigh, I'll see if I can borrow a Win64 this weekend. But even if I could confirm it, I think we should release with what we have because this seems pretty subtle and hard to debug, so solving it could take us two weeks or more. |
From ccordoba12 on 2014-06-27T22:46:38Z Just a hunch but could you try to deactivate your firewall/antivirus and run everything again to see what happens? Maybe they are interfering with the communication between Spyder and the process where code is run (which is external to Spyder so as not blocking the GUI). |
From dive...@gmail.com on 2014-06-28T05:12:29Z Thanks for the suggestion. I tried to disable both firewall and antivirus but unfortunately nothing changes. All reported bugs are still here. As one more test I installed the 32bit version of WinPython 3.3.5.0. I can confirm that the issue #1831 , issue #1837 and issue #1861 are still there also with 32bit Python 3 under Windows. This is true both when running with boostrap.py the latest Spyder 2.3.0rc version from the repository and when running the Spyder 2.3.0beta2, which comes preinstalled with WinPython 3.3.5.0. The latter agrees with what originally reported by markfran, who started issue #1831 and with sstef, who opened issue #1810 . |
I must report this long standing bug is still there in 3.0.0b6. |
Sorry, I really don't know how to solve this bug. Have you tried with Qt5? Does this bug appear with it too? |
@divenex, I think I found a fix for this problem (after some experimentation :-) Will you be able to test it from a pull request? |
@ccordoba12 sorry for my slow reply. I have now tested Spyder 3.0.0 with QT5 (qt: 5.6.0) and the problem is still there. The Python console is still completely unusable, and only the IPython console works. This is for Anaconda with Python 3.5 under Windows 10 64bit. |
@ccordoba12 |
Yes, the problems with b7 were fixed in the final release. |
The bad behaviour described in the first comment of this issue seems to be still persistent. The two problems are:
In my case all this started after updating from spyder 2 to 3.
|
Just want to bump this issue, and add something I haven't seen others mention.. With a fresh console, anything entered interactively returns immediately:
As others have stated running the current file with f5 requires clicking back to the console and hitting <return> again. After this all interactive entries also require an extra <return>:
Running the file again continually increments the number of times I have to hit <return> to get a response back from the interpreter:
|
I'm sorry but the Python console is going to be removed in Spyder 3.2, so we don't plan to fix this or any other bug related to it. I'll create an issue explaining our reasons to do that, but one of the main ones is that the Python console is broken on Windows. |
Let's not forget that the Python console is the only one that currently supports a command history during debugging. So I would not remove the Python console before implementing the command history in the IPython one. I am still wondering how people can tolerate debugging in Spyder using the IPython console, without a command history! FYI: The Linux version of Spyder, with a working Python console, can be used in Windows 10 with the Windows Subsystem for Linux |
That is sad to hear that the Python console is going to be removed! I use that exclusively. I have been having the same problem with the delayed execution after upgrading to Anaconda (1.5) and Spyder (3.1.3) with Python (3.6). There is a simple workaround for those who wish to have similar functionality with the console while avoiding the delayed execution. Maybe it will help others. Just go to the Run>Configure. Then in the 'Console' group switch from 'Execute in current Python or IPython console' to 'Execute in new dedicated Python console'. I also checked 'Interact with the Python console after execution' and 'Show warning when killing running process'. It is maybe not the best work around but at least it gets rid of the delayed execution. |
@rpg32, unfortunately the Python console is holding us back on several fronts, and it's really unmaintained right now (I've done my best to fix its bugs throughout the years, but it's very hard to debug). However, let me assure you that we will migrate all its features to the IPython console so that people don't miss a thing about it in 3.2. |
@ccordoba12 it is great to hear you plan to migrate the Python Console features to the IPython one. In that case, it makes full sense to consolidate development onto a single console. I am looking forward to 3.2 then. |
@ccordoba12 you are right, history browsing while debugging is indeed the only feature I have been missing in the IPython console. Excellent to see a PR about it. |
Closing because the Python console is going to be removed in Spyder 3.2. Please see issue #4524 for our reasons to do this. |
From markfran...@gmail.com on 2014-05-26T19:10:46Z
Spyder Version: 2.3.0beta2
Python Version: 3.3.5
Qt Version : 4.8.4, PyQt4 (API v2) 4.9.6 on Windows
pyflakes >=0.6.0: None (OK)
pep8 >=0.6 : None (NOK)
IPython >=0.13 : 2.0.0 (OK)
rope >=0.9.2 : 0.9.4 (OK)
sphinx >=0.6.6 : 1.2.2 (OK)
matplotlib >=1.0: 1.3.1 (OK)
sympy >=0.7.0 : 0.7.5 (OK)
pylint >=0.25 : 1.1.0 (OK)
What steps will reproduce the problem?
What is the expected output? What do you see instead?
When you try to run a script with matplotlib you press run and it works normally the first time. Press run again and the script doesn't run. You have to hit run a second time in order for the script to run
Spyder is in "Execute in current python or ipython interpreter" mode
In the console it looks like this (i removed the file paths to make it shorter). F5 puts the runfile in. The second time you try to run it, when you click F5 or the green run arrow twice you runfile goes into the console twice before it runs.
">>> runfile('C:/.../figure_title.py', wdir=r'C:/...')
Please provide any additional information below
. I thought it was a problem with my own script, but the problem repeats even with code from the matplotlib website.
I only have this problem when I have a script with matplotlib. For example, when I run a simple script like below I can run it over and over no problem. I never have to press F5 twice.
x = int(input("enter an number: "))
if x < 0:
x = 0
print('Negative')
elif x > 0:
print('Positive')
elif x == 0:
print('Zero')
Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1831
The text was updated successfully, but these errors were encountered: