qtconsole icon indicating copy to clipboard operation
qtconsole copied to clipboard

After 5-10 seconds, I have to press shift-enter to execute lines (instead of enter) and all lines take 5-10 seconds to execute.

Open ZGainsforth opened this issue 9 years ago • 43 comments

When I load qtconsole I can work normally for about 5-10 seconds. After that time, something occurs where enter attempts to continue the last line (as if I had been typing a for loop or similar). I can force execution using shift-enter. However, the console will hold for about 5-10 seconds before it actually executes the line. This occurs for every line -- and thus qtconsole becomes unusable and i'm force to use ipython from the command line. This is only new since the Jupyter qtconsole, the old IPython qtconsole worked fine.

Jupyter QtConsole 4.1.1 Python 2.7.10 | 64-bit | (default, Oct 21 2015, 09:09:19) IPython 4.0.1 OS X 10.11.3

Installed via Canopy.

This is perhaps related to #90 and #94, but I'm not using pandas, nor do I see QTextCursor messages in the debug output.

ZGainsforth avatar Feb 23 '16 00:02 ZGainsforth

@jdmarch, does Canopy still uses PySide?

ccordoba12 avatar Feb 23 '16 00:02 ccordoba12

@ccordoba12 yes, for now the Canopy GUI (hence its QtConsole frontend) still uses PySide, with IPython 2.4. However it sounds as if @ZGainsforth is working from Terminal, where either PyQt4 or PySide is available.

jdmarch avatar Feb 23 '16 03:02 jdmarch

I don't think I've changed any settings from the default. How do I check which is in use?

ZGainsforth avatar Feb 23 '16 03:02 ZGainsforth

If you don't have the pyqt package installed (check enpkg -s pyqt), then you are using pyside. If you do, I don't know offhand which is the default, but you can force either one by setting environment variable QT_API to pyside or pyqt.

jdmarch avatar Feb 23 '16 04:02 jdmarch

From bash I entered:

export QT_API=“pyqt”

Then I ran jupyter qtconsole and the problem continues unchanged.

On Feb 22, 2016, at 8:21 PM, Jonathan March [email protected] wrote:

If you don't have the pyqt package installed (check enpkg -s pyqt), then you are using pyside. If you do, I don't know offhand which is the default, but you can force either one by setting environment variable QT_API to pyside or pyqt.

— Reply to this email directly or view it on GitHub https://github.com/jupyter/qtconsole/issues/103#issuecomment-187518514.

ZGainsforth avatar Feb 23 '16 04:02 ZGainsforth

And if you specify pyside?

jdmarch avatar Feb 23 '16 04:02 jdmarch

Yeah, just tried it and also same result. So that’s probably not the cause.

On Feb 22, 2016, at 8:36 PM, Jonathan March [email protected] wrote:

And if you specify pyside?

— Reply to this email directly or view it on GitHub https://github.com/jupyter/qtconsole/issues/103#issuecomment-187523654.

ZGainsforth avatar Feb 23 '16 05:02 ZGainsforth

Try updating both IPython and the Qt console (qtconsole 4.2 was just released) to see if that makes any difference.

The Qt console now asks the kernel when you press enter whether it should execute the code or prompt for another line - an is_complete request. This was necessary because making that decision depends on the programming language, and previously the Qt console hard-coded logic about Python. However, if the kernel fails to reply promptly for some reason, the frontend doesn't know what to do, so it will keep adding lines until you force it with shift-enter.

Does this happen regardless of what you're running, or are you doing something specific when it happens?

takluyver avatar Feb 23 '16 11:02 takluyver

After pip install -U jupyter ipython qtconsole, the problem persists.

OS X 10.11.3 Jupyter QtConsole 4.2.0 Python 2.7.10 | 64-bit | (default, Oct 21 2015, 09:09:19) IPython 4.1.1 -- An enhanced Interactive Python.

ZGainsforth avatar Feb 23 '16 16:02 ZGainsforth

It's not a good idea to mix installation methods for a single package (in this case Enthought eggs and pip install), so I have no idea what mix of component versions you may have now.

Ordinarily I would suggest that you delete your Canopy User Python environment (pointed to by sys.prefix), rebuild it by restarting Canopy, then do enpkg --forceall ipython. Given that this only happened after you updated Jupyter, this might resolve the problem in itself. (But it won't yet include the update to qtconsole 4.2, expected shortly in our repository). You'll also need to reinstall any 3rd party packages that you had already installed.

(Background in case the install name ipython appears to you to be incorrect -- the ipython egg is actually a pseudo-package that just brings in jupyter and all the jupyter dependencies, including the actual current ipython package, which lives in the ipython4 egg. :( This dance was put in place so that existing users could update ipython and end up with jupyter.)

jdmarch avatar Feb 23 '16 16:02 jdmarch

OK. I reinstalled from scratch, back to versions:

Jupyter QtConsole 4.1.1 Python 2.7.10 | 64-bit | (default, Oct 21 2015, 09:09:19) IPython 4.0.1 -- An enhanced Interactive Python.

and behavior is still constant.

Given the earlier discussion between pyqt/pyside, I wonder if it is relevant that I have Qt Creator installed on the system? I haven't had trouble with Qt apps, but I thought I'd mention it.

ZGainsforth avatar Feb 23 '16 17:02 ZGainsforth

QtCreator

If there are references to it in your environment variables, try removing those before starting QtConsole.

jdmarch avatar Feb 23 '16 17:02 jdmarch

I don't see any references to it the printenv readout. Is there somewhere else I should look? It runs as an app, so it isn't invoked through the terminal.

ZGainsforth avatar Feb 23 '16 17:02 ZGainsforth

You could try to run

jupyter qtconsole

from a terminal and see if that generates some further info on it.

ccordoba12 avatar Feb 23 '16 20:02 ccordoba12

I think that's what he's doing -- the issue only applies to qtconsole in terminal, since in qtconsole in the Canopy GUI it uses ipython 2.4.

jdmarch avatar Feb 23 '16 21:02 jdmarch

That's correct. I am running it from the terminal. Is there another way?

Running just jupyter qtconsole yields a QPixmap::scaled: Pixmap is a null pixmap message.

Running jupyter qtconsole --debug yields:

[JupyterQtConsoleApp] Config changed:
[JupyterQtConsoleApp] {'JupyterQtConsoleApp': {'log_level': 10}}
[JupyterQtConsoleApp] Searching [u'/Users/Zack', '/Users/Zack/.jupyter', '/Users/Zack/Library/Enthought/Canopy_64bit/User/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[JupyterQtConsoleApp] Looking for jupyter_config in /etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /usr/local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /Users/Zack/Library/Enthought/Canopy_64bit/User/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /Users/Zack/.jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /Users/Zack
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /usr/local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /Users/Zack/Library/Enthought/Canopy_64bit/User/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /Users/Zack/.jupyter
[JupyterQtConsoleApp] Loaded config file: /Users/Zack/.jupyter/jupyter_qtconsole_config.py
[JupyterQtConsoleApp] Config changed:
[JupyterQtConsoleApp] {'ZMQInteractiveShell': {'colors': 'Linux'}, 'IPKernelApp': {'exec_lines': ['from __future__ import division'], 'gui': 'qt4'}, 'JupyterWidget': {'editor': 'edit '}, 'JupyterQtConsoleApp': {'log_level': 10}}
[JupyterQtConsoleApp] Config changed:
[JupyterQtConsoleApp] {'ZMQInteractiveShell': {'colors': 'Linux'}, 'IPKernelApp': {'exec_lines': ['from __future__ import division'], 'gui': 'qt4'}, 'JupyterWidget': {'editor': 'edit '}, 'JupyterQtConsoleApp': {'log_level': 10}}
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /Users/Zack
[JupyterQtConsoleApp] Config changed:
[JupyterQtConsoleApp] {'ZMQInteractiveShell': {'colors': 'Linux'}, 'IPKernelApp': {'exec_lines': ['from __future__ import division'], 'gui': 'qt4'}, 'JupyterWidget': {'editor': 'edit '}, 'JupyterQtConsoleApp': {'log_level': 10}}
[JupyterQtConsoleApp] Connection File not found: /Users/Zack/Library/Jupyter/runtime/kernel-56716.json
[JupyterQtConsoleApp] Native kernel (python2) available from /Users/Zack/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/ipykernel/resources
[JupyterQtConsoleApp] Starting kernel: ['/Users/Zack/Library/Enthought/Canopy_64bit/User/bin/python', '-m', 'ipykernel', '-f', u'/Users/Zack/Library/Jupyter/runtime/kernel-56716.json']
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:57849
[JupyterQtConsoleApp] connecting shell channel to tcp://127.0.0.1:57846
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:57846
[JupyterQtConsoleApp] connecting iopub channel to tcp://127.0.0.1:57847
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:57847
[JupyterQtConsoleApp] connecting stdin channel to tcp://127.0.0.1:57848
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:57848
[JupyterQtConsoleApp] connecting heartbeat channel to tcp://127.0.0.1:57850
QPixmap::scaled: Pixmap is a null pixmap
[JupyterQtConsoleApp] Received history reply with 1000 entries
[JupyterQtConsoleApp] connecting shell channel to tcp://127.0.0.1:57846
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:57846
[JupyterQtConsoleApp] execute_input: {u'execution_count': 1, u'code': u'x = 5\n'}
[JupyterQtConsoleApp] execute: {u'status': u'ok', u'execution_count': 1, u'user_expressions': {}, u'payload': []}

ZGainsforth avatar Feb 23 '16 21:02 ZGainsforth

I see some configuration options are loaded from

/Users/Zack/.jupyter/jupyter_qtconsole_config.py

Could comment those options and try again?

ccordoba12 avatar Feb 23 '16 21:02 ccordoba12

@jdmarch I see. You are correct. In the canopy editor:

[1] Import IPython [2] IPython.version_info

yields

Out[2]: (2, 4, 1, '')

And I am not experiencing the freezing issue. So there is a difference between these two. Also I haven't noticed freezing in the ipython console within PyCharm.

ZGainsforth avatar Feb 23 '16 21:02 ZGainsforth

difference between these two.

Yes, see https://support.enthought.com/hc/en-us/articles/204469910-IPython-Installed-version-in-the-Package-Manager-is-not-being-used-in-the-Canopy-GUI

Could you comment out those options and try again?

+1

jdmarch avatar Feb 23 '16 21:02 jdmarch

I renamed the file so Jupyter doesn't see it on load. The problem persists, but the new debug output is:

[JupyterQtConsoleApp] Config changed:
[JupyterQtConsoleApp] {'JupyterQtConsoleApp': {'log_level': 10}}
[JupyterQtConsoleApp] Searching [u'/Users/Zack/.jupyter', '/Users/Zack/.jupyter', '/Users/Zack/Library/Enthought/Canopy_64bit/User/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[JupyterQtConsoleApp] Looking for jupyter_config in /etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /usr/local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /Users/Zack/Library/Enthought/Canopy_64bit/User/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /Users/Zack/.jupyter
[JupyterQtConsoleApp] Looking for jupyter_config in /Users/Zack/.jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /usr/local/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /Users/Zack/Library/Enthought/Canopy_64bit/User/etc/jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /Users/Zack/.jupyter
[JupyterQtConsoleApp] Looking for jupyter_qtconsole_config in /Users/Zack/.jupyter
[JupyterQtConsoleApp] Config changed:
[JupyterQtConsoleApp] {'JupyterQtConsoleApp': {'log_level': 10}}
[JupyterQtConsoleApp] Connection File not found: /Users/Zack/Library/Jupyter/runtime/kernel-56834.json
[JupyterQtConsoleApp] Native kernel (python2) available from /Users/Zack/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/ipykernel/resources
[JupyterQtConsoleApp] Starting kernel: ['/Users/Zack/Library/Enthought/Canopy_64bit/User/bin/python', '-m', 'ipykernel', '-f', u'/Users/Zack/Library/Jupyter/runtime/kernel-56834.json']
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:58466
[JupyterQtConsoleApp] connecting shell channel to tcp://127.0.0.1:58463
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:58463
[JupyterQtConsoleApp] connecting iopub channel to tcp://127.0.0.1:58464
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:58464
[JupyterQtConsoleApp] connecting stdin channel to tcp://127.0.0.1:58465
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:58465
[JupyterQtConsoleApp] connecting heartbeat channel to tcp://127.0.0.1:58467
QPixmap::scaled: Pixmap is a null pixmap
[JupyterQtConsoleApp] Received history reply with 1000 entries
[JupyterQtConsoleApp] connecting shell channel to tcp://127.0.0.1:58463
[JupyterQtConsoleApp] Connecting to: tcp://127.0.0.1:58463
[JupyterQtConsoleApp] execute_input: {u'execution_count': 1, u'code': u'x = 5\n'}
[JupyterQtConsoleApp] execute: {u'status': u'ok', u'execution_count': 1, u'user_expressions': {}, u'payload': []}

ZGainsforth avatar Feb 23 '16 21:02 ZGainsforth

@jdmarch Thanks for the info. A quick workaround until this is fixed seems be to use the canopy ipython window instead of instantiating Jupyter from the command line. Progress! :-)

ZGainsforth avatar Feb 23 '16 21:02 ZGainsforth

@ccordoba12 @jdmarch @takluyver Thanks for helping out with this guys.

ZGainsforth avatar Feb 23 '16 21:02 ZGainsforth

Good, let's wait and see what happens when Qtconsole 4.2 is updated in the Canopy package repository (when it is available, you should update all of jupyter for consistency.)

Meanwhile, running qtconsole from within the Canopy editor gives you the advantage of being able to run directly from the editor, and being able to restart the kernel, among other things. You won't be missing much of the new stuff in jupyter, since most of that pertains to the notebook and to multi-language support.

jdmarch avatar Feb 23 '16 21:02 jdmarch

@ZGainsforth I didn't see an answer to @takluyver's question?:

Does this happen regardless of what you're running, or are you doing something specific when it happens?

jdmarch avatar Feb 24 '16 19:02 jdmarch

@jdmarch @takluyver It happens regardless. I don't even have to input any commands. I simply have to wait a few seconds first.

ZGainsforth avatar Feb 24 '16 19:02 ZGainsforth

We've had some hanging/slowness issues with OS X before, but I think that was in terminal IPython, not in kernel/frontend things. But I also vaguely remember reports of new issues with the latest version of OS X, which I didn't pay much attention to.

takluyver avatar Feb 24 '16 21:02 takluyver

For what is worth, no one has reported this problem in Spyder.

ccordoba12 avatar Feb 24 '16 21:02 ccordoba12

OK, I have more info now. I tried running jupyter console instead of qtconsole. The same error occurs, but now I get a useful error message:

WARNING: The kernel did not respond to an is_complete_request. Settinguse_kernel_is_completeto False.

And on the next command the hanging begins.

ZGainsforth avatar Feb 25 '16 00:02 ZGainsforth

That's more or less what I'd expect, but from what you said about delays in execution as well, I think there's something just slowing down the kernel's responses for some reason.

takluyver avatar Feb 25 '16 12:02 takluyver

I think this is very related to issue #76

dashesy avatar Feb 29 '16 01:02 dashesy