jupyter / qtconsole

Jupyter Qt Console
https://qtconsole.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
413 stars 198 forks source link

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. #103

Open ZGainsforth opened 8 years ago

ZGainsforth commented 8 years ago

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.

ccordoba12 commented 8 years ago

@jdmarch, does Canopy still uses PySide?

jdmarch commented 8 years ago

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

ZGainsforth commented 8 years ago

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

jdmarch commented 8 years ago

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.

ZGainsforth commented 8 years ago

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 notifications@github.com 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.

jdmarch commented 8 years ago

And if you specify pyside?

ZGainsforth commented 8 years ago

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 notifications@github.com 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.

takluyver commented 8 years ago

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?

ZGainsforth commented 8 years ago

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.

jdmarch commented 8 years ago

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

ZGainsforth commented 8 years ago

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.

jdmarch commented 8 years ago

QtCreator

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

ZGainsforth commented 8 years ago

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.

ccordoba12 commented 8 years ago

You could try to run

jupyter qtconsole

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

jdmarch commented 8 years ago

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.

ZGainsforth commented 8 years ago

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': []}
ccordoba12 commented 8 years ago

I see some configuration options are loaded from

/Users/Zack/.jupyter/jupyter_qtconsole_config.py

Could comment those options and try again?

ZGainsforth commented 8 years ago

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

jdmarch commented 8 years ago

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

ZGainsforth commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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

jdmarch commented 8 years ago

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 commented 8 years ago

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

ZGainsforth commented 8 years ago

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

takluyver commented 8 years ago

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.

ccordoba12 commented 8 years ago

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

ZGainsforth commented 8 years ago

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.

takluyver commented 8 years ago

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.

dashesy commented 8 years ago

I think this is very related to issue #76

ZGainsforth commented 8 years ago

Just installed Qtconsole 4.2 through canopy and the problem persists.

ZGainsforth commented 8 years ago

I just noticed I still have an .ipython directory and the config files we edited before were under .jupyter. I edited .ipython/profile_default/ipython_config.py and commented out the line:

c.InteractiveShellApp.pylab = 'osx'

And the problem disappeared. So apparently it is still pulling configuration from the .ipython directory?

takluyver commented 8 years ago

IPython is still a thing - it provides the Jupyter kernel for Python. So things like pylab are still configured in the .ipython directory. Jupyter is the language agnostic machinery for the messaging protocol, frontends and notebooks.

ZGainsforth commented 8 years ago

I see. Well, as far as I'm concerned this solves it for me. Though I suppose it is still a bug since one should be able to use the .ipython profile configuration file and choose defaults like pylab='osx' if those are intended to be used.

Do we want to leave this open then?

takluyver commented 8 years ago

I think it's still a bug that the osx backend makes that happen. I personally have no idea how to fix it, but other people might.

ccordoba12 commented 8 years ago

I think Matplotlib guys are thinking to remove the OSX backend in the future.

Pinging @tacaswell about it.

tacaswell commented 8 years ago

We need to write an email to the mailing list, but unless someone volunteers it will go unmaintained.

minrk commented 8 years ago

I wish I had the qualifications to do that. I find it to be the only acceptable GUI backend on OS X. But I frankly don't do much GUI plotting with matplotlib anymore.

dashesy commented 8 years ago

When input is stuck can you do these 2 tests:

  1. Keep pressing Backspace to delete previous character for a while, then press Return.
  2. Keep pressing 'g' character for a while then press Return.

If any of the two gives a new line then this is because the cursor position is out of sync. I have seen input getting stuck also on Windows, and having pylab load automatically worsens the situation.

tacaswell commented 8 years ago

@minrk QtAgg does not work for you?

jdmarch commented 8 years ago

@ZGainsforth: (Seems like a side issue, but just to close the loop, QtConsole 4.2 and other contemporaneous jupyter packages) are now in the Enthought / Canopy repository for use at the command line, and, I expect, will be integrated in the Canopy 1.7.0 GUI, when released later this month.)

minrk commented 8 years ago

@tacaswell I don't want to sidetrack this issue, but macosx has always looked and behaved better than qtagg for me. Last I used it, qtagg figures didn't render in high-dpi.

ccordoba12 commented 8 years ago

That's right Min, qtagg doesn't support high-dpi screens, but that's fixed by using qt5agg (which will be added to Anaconda in a couple of months).

El 10/03/16 a las 17:24, Min RK escribió:

@tacaswell https://github.com/tacaswell I don't want to sidetrack this issue, but macosx has always looked and behaved better than qtagg for me. Last I used it, qtagg figures didn't render in high-dpi.

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