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
IPython terminal issue with Qt4Agg on XP SP3 #481
Comments
I'm marking this as critical for 0.11 so that at least we check (I can do it) if one of us can reproduce it. If this is systemic, it will make 0.11 unusable on Windows with Qt. |
I can reproduce this problem on windows 7 64-bit. However it is not a problem in the qtconsole It does not behave like this with the tk-backend /Jörgen |
@epatters, this looks pretty nasty. Do you have any inkling as to what could be going on? I had the impression you'd been testing with Windows a while ago, so I imagined you'd have seen this already. It definitely is not a problem in Linux, so somehow it must be something with Qt on Windows. I wonder if it's a Qt 4.8 problem, I think when we did the original work we were testing (I also did some light Windows testing at the time) with Qt 4.6 or 4.7... |
@epatters, btw, I just realized my previous message makes it sound like I'm blaming you, which is not the case :) Just looking for your input/wisdom... |
I've been using PySide on Windows, which means that I can't use matplotlib's Qt backend. In other words, I haven't tried this out lately. When I have access to my Windows box tomorrow, I will switch back to PyQt4 and see if I can debug the problem. Off the top of my head, though, the behavior described above also occurs when running a PDB session under vanilla Python if http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/python_shell.html Perhaps something is not playing nice with PyQt4's input hook... |
fperez skrev 2011-06-23 00:25:
Unfortunately I'm leaving for a short midsummer holiday and will be back /Jörgen |
On Thu, Jun 23, 2011 at 1:30 AM, jstenar
Thanks for the feedback though, this is already useful. Have a good wekend! f |
Feel free to contact me with instructions if you don't have Windows XP/7 PC. I have both with IPython 0.11dev Cheers |
Well, I have no idea how I closed this issue as I only commented huh |
The "Comment and Close" button is dangerously close to the "Comment" button. Not a great usability decision there... |
That's true. I use dotjs (Userscripts/greasemonkey would work too) to float it to the left and fade it a little, so I don't click it accidentally: function leftClose(){
// float 'Comment & Close' button on the left, to prevent accidental clicking
// also fade text to grey to make it stand out less
// query from from userscripts.org/scripts/105325
var andClose = document.querySelector('button[name="comment_and_close"]');
if (andClose){
// float it on the left
andClose.style.float='left';
// fade text
andClose.style.color="#aaa";
// or you can just remove the button altogether:
// andClose.parentNode.removeChild(andClose);
}
}
leftClose(); |
Nice one! Thanks. |
I noticed same behaviour with visvis. In this example: In [1]: import visvis as vv In [2]: app = vv.use() In [3]: f = vv.clf() In [4]: a = vv.cla() after input [3] IPython console slows down multiple times. Obviously regardless matplotlibrc backend settings |
Just noticed that visvis default backend is set to Qt4, and when set to other no slowdowns |
I confirmed this problem in my Windows 7 VM. I should add that I also experience this on my OS X machine, and though the delay is much less noticeable, I do not think I am imagining it. Notice this comment from the PyQt4 docs that I linked above: "The installation of an input hook can cause problems for certain applications (particularly those that implement a similar feature using different means)." I have no idea how to go about making these input hooks play nicely together. |
Actually, further testing shows that the delay is just as bad on OS X as Windows. As it stands now, the interaction between pyreadline and PyQt4's input hook makes the terminal IPython effectively useless when using PyQt4 (this includes the Qt pylab backend). |
Is there anything we can do about this before 0.11? Do we need to put a warning in the docs (or in the code)? |
That's pretty rough, though at least Windows is the only place that pyreadline is normally used. I don't see any issues when using real readline on OSX. |
Hmm. If I run |
On Fri, 1 Jul 2011 12:46:33 -0700 takluyver wrote:
Maybe just fallback on Tk or WX (if user has WX installed), as there |
Weird, I can't cause any problems at all. What's your Python, matplotlib, Qt, etc. situation? |
My configuration is: Python - 2.7.1 |
OK, this is even weirder than I thought. Only sometimes do I experience the 2-3 second delays. Sometimes it appears to work fine. I am thoroughly baffled. |
The only major difference I have is I'm using system Python 2.6, but I wouldn't expect that to make a difference. I don 't particularly want to go through the bother of building pyqt for 2.7, but maybe I have to. I've tried both matplotlib 1.0.1 and git master with no change. |
@epatters, just for my understanding: you're seeing the slowdown happening with normal readline, right? Pyreadline is win32-only, if I remember correctly... |
I have a readline module: In [4]: import readline In [5]: readline Out[5]: module 'IPython.utils.rlineimpl' from '/Users/epatters/Local/IPython/IPython/utils/rlineimpl.pyc' I do not have pyreadline installed. |
That will be reported no matter what readline you have. You need to check @fperez, yes pyreadline is win32 only, but I could swear that I have installed it accidentally on OSX ages ago when I didn't know what name to easy_install. |
I'd like to reopen this issue (but I do not have permission to do so) because I have trouble with gui qt in a very recent clone (65ac74e; yesterday evening). I noticed slugginesh behavior on the ipython shell on two Mac OS X 10.6 Systems and did some experiments. I used the following unscientific benchmark: I copied and quickly pasted a long text (4500 chars, all one line) in two shells - both ran ipython default profile but in one of them I ran a %gui command before pasting. First experiment was with %gui qt and I noticed that the other ipython shell always finished ~.5 seconds before the gui ipython - even if i pasted in the gui shell first. I then repeated the experiment using %gui osx and the gui shell was as quick as the non gui shell. The slugginess really affects working especially when walking through the history: I very often press a twice because the reaction comes notably late to the shell. I noticed that replacing timer.start(50) in lib/inputhookqt4.py:91 with timer.start(1) fixed the problem for me - but upped CPU usage from <1% to > 30%. Also, I really doubt that I would notice a reaction time of 50ms though - I rather think that there is more delay than just those 50ms. Maybe some with more qt experience could help out. I find this code really hard to get - starting and quitting the app periodically doesn't seem like a canonical way of doing things and imho could have implementation detail dependent side-effects on some OSes. Another fix that works for me like a charm without breaking any functionality (tested using --profile=pylab in this case) is to completely kill the whole block starting in line 88: if not stdin_ready(): Below are the versions of one of the boxes (I do not have the other computer around atm): ipython github 65ac74e |
@SirVer, I've just reopened it. Thanks for all the detailed info, we should be able to make some progress with this... |
I just tested 8af05fa, but as I expected this kills the interactivity on Windows as the hook is not called when the process is idle on that platform (well, I must admit I have no idea what happens on a Mac and can't investigate either as I don't have access to one). |
... but the interactivity is indeed preserved on Linux! This is due to If I disable the readline extension, then the behavior seen is the same as on Windows (the change kills the interactivity with Qt). Also, with only that change a CTRL+C is now simply ignored, not sure why at this point. |
I have to add that my 'patch' will indeed reduce the respeonsiveness of (i.e.) matplotlib plot windows - so it is not golden after all but still significantly better than having a lagging shell. I will try out every suggestion on mac os x that is provided - I feel like I cannot provide many suggestions due to lack of knowledge about readline and qt |
I don't have really much to offer, other than to thank you guys for pounding on this. It has proven to be a very, very stubborn and hard to fix bug and has most everyone stumped. So even partial progress on it would be very welcome. |
So to summarize that part of the problem:
I think the solution is simply to do what the original PyQt |
@SirVer - can you reproduce the problematic behavior with current (1.1.0) matplotlib, or better yet, without matplotlib at all, just using |
Note that I've reproduce the problem as well with just But there's worse: while testing this on Windows with Also, note that this "freeze" only concerns the console input, Qt windows remain responsive. |
For what it's worth, an EPD customer has seen similar problems on Windows XP with the WXAgg backend to matplotlib. Changing the inputhook constants do not seem to make any noticeable difference. I have not been able to replicate the wx slowness myself on Windows 7 (I can replicate the Qt slowness, though). |
sorry for the late feedback, I was travelling and didn't bother doing my email. Yes, I can also see the problem just with using --gui qt. |
Here is a VERY simple newbie solution for someone brand new to python/iPython that may work for some of you newbies like me: Here's my version info:
I just created a new profile using the startup option '' and that seemed to do the trick. Utterly newb solution, but it worked for me and may work for you. For you seasoned devs, here's some info that may help: Before I found the hidden nanolink at Enthought, I struggled with the install for quite a while. After attempting to install manually a variety of ways, I think I had a very confused python install. I'm guessing that I had something in there that called a problematic input hook that was causing the problem. I wasn't able to find anything, but I honestly didn't look that hard yet. Here are just a few of the misguided things I did while trying to install:
So then I finally created a new profile and it fixed the super slowness. Hope that helps someone, somewhere. Cheers. |
So does that mean that, on a Mac, simply creating a profile solved the |
I'm sorry to do this, but I'm downgrading this to 'high' priority from 'blocker', simply because we can't realistically block the entire release on an issue we have no clue how to fix. It's a real bummer, and I hope we'll be able to track what's going on at some point, but absent any progress, we can't stall a release on this. And in fact, we were violating the 'blocker' marker already since we'd bumped this from 0.11 to 0.12 to 0.13, so if anything I'm just being upfront about what we've already done. |
I would like to report that i have been facing this problem for a long time in my gnu/linux too. Surprised to see it has been reported only in Windows. In short following are the specifications: Description of problem: |
I and my office mate both see this bug in linux too. So here's our experiences, in case it helps isolate it: I'm using XUbuntu 12.04 (Xfce), ipython 0.12.1 and my office mate also on Linux Mint with ipython 13.1-rc2. It doesn't occur immediately, but after some time with use of plotting etc. |
I've found that our problem is exactly that in matplotlib/matplotlib#1530 relating to writing .local/share/recently-used.xbel after opening the GTK (maybe also Qt) save figure dialog once (but not necessarily saving anything). I'll wander over there now. |
I have the same experience as @oliford on Ubuntu 12.04, iPython 0.14.dev, GTKAgg. |
One man's testimonial: I resolved this issue by installing the dev version of matplotlib. Perhaps this commit in this issue cited by @oliford did the trick. |
Based on @danielballan's feedback, I would be inclined to close. |
closing based on the conversation around matplotlib/matplotlib#1530. |
Fix ipython#481 using custom qt4 input hook. Various other cleanups to inputhook libraries.
If matplotlib backend in 'matplotlibrc' is set to Qt4Agg, terminal console mode slows down on multiple levels: there is pause on every letter entered; if I paste some code I have to wait approx 1sec for every 2-3 characters!; and overall it seems so unnaturally slow. This does not happen however in IPython qtconsole, and I don't remember similar behavior when I used 10.2 on Windows 7. This also does not happen if matplotlib backend is set to WXAgg for example.
Noticed on:
Windows XP SP3 32 bit
Python 2.6.6 (official from python.org)
PyQt4 4.8.4
matplotlib 1.0.1
IPython 0.11.dev
The text was updated successfully, but these errors were encountered: