Skip to content

ipython in terminal freezes on OS X El Capitan #9128

Closed

Description

@jtravs

I installed ipython 4.0.1 from macports on OS X El Capitan. The interactive ipython terminal regularly freezes for a while in a way that is reminiscent of what I remember from a few years ago, that I thought was fixed with #6325. It eventually recovers, usually if I focus on another window for a while.

Any ideas? Any more info I can provide to help?

I have matplotlib loaded with the MacOSX backend.

Version info:

In [3]: print(IPython.sys_info())
{'commit_hash': u'03b6385',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython',
 'ipython_version': '4.0.1',
 'os_name': 'posix',
 'platform': 'Darwin-15.2.0-x86_64-i386-64bit',
 'sys_executable': '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python',
 'sys_platform': 'darwin',
 'sys_version': '2.7.11 (default, Dec 31 2015, 13:28:45) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]'}

Activity

  1. jtravs commented on Jan 14, 2016

    @jtravs
    Author

    This seems (but I'm not totally sure) to only occur when I use the left/right cursor keys to edit a line.

  2. Carreau commented on Jan 16, 2016

    @Carreau
    Member

    Hum... the left/right things is purely handled by readline. I'm not sure there is much we can do.

  3. jtravs commented on Jan 16, 2016

    @jtravs
    Author

    I understand, but it is weird that it didn't occur previously.

    I tested a few more things: it only occurs when I press and hold left or right cursor (not when I repeatedly hit it), and I can free it by doing Ctrl-e or Ctrl-a etc or repeatedly clicking in and out of the terminal (though this latter way is variably successful).

  4. Carreau commented on Jan 18, 2016

    @Carreau
    Member

    hum... could it be a repetition thing on OS X? or the emoji-pop-up-dialog ?
    Terminal.app or iTerm ?

  5. mseppa commented on Jan 26, 2016

    @mseppa

    I have the same problem after upgrading to El Capitan, both in Terminal.app and in xterm. If I run ipython without --pylab (no OSX backend), the python command line freezes every now and then, but Ctrl+C causes keyboard interrupt and it recovers. With --pylab and matplotlib OSX backend enabled, Ctrl+C does nothing, only killing the process works (or I haven't had the patience to wait long enough).

    For me it doesn't require any arrow keys, just normal writing (typically fast) does the trick.

    So, for me it seems that there's a problem with the ipython command line (readline?) and it would somehow clash with some other event loop if OSX backend is active ... just guessing ...

  6. rrbarbosa commented on Feb 25, 2016

    @rrbarbosa

    I might have the same problem. If I press and hold any key (arrows or letters) the input freezes. Although if I hit CTRL+C the input unfreezes, I and can continue to type. The problem only happens if matplotlib is loaded (invoke with $> ipython --matplotlib or %matplotlib after loading).

    The problem seems related to the Keyboard -> Key Repeat setting in the System Preferences. I only experience the keyboard freeze using the two fastest settings. By setting to the third fastest, the problem goes way (see figure).

    key repeat

    I am running:
    Python 3.5.1
    IPython 4.0.1
    Matplotlib 1.5.1
    MacOS 10.11.3

  7. mseppa commented on Feb 25, 2016

    @mseppa

    Changing the repeat setting didn't help for me.

    But meanwhile I have noticed that even with --pylab when the command line freezes, hitting Ctrl-C followed by Enter works. So, now I don't need to kill the whole ipython session anymore and can actually work somehow (although it is still really annoying).

  8. leewalsh commented on Mar 8, 2016

    @leewalsh

    I've been having the same issue for a couple weeks now. I am always able to unlock it by hitting <CTRL-C> then <enter>. Whatever had been displayed before is in the history, so I can get back to where I was with <up>, but my session is littered with:

    In [56]: xy =
    
    KeyboardInterrupt
    
    In [56]: xy = vor.points
    
    In [57]: from scipy.spa
    scipy.spacing  scipy.sparse   scipy.spatial
    
    In [57]: from scipy.spatial import
    
    KeyboardInterrupt
    
    In [57]: from scipy.spatial import Co
    
    KeyboardInterrupt
    
    In [57]: from scipy.spatial import ConvexHull
    

    So far, this is all I can gather:

    1. Problem occurs if I run ipython --pylab or if I run ipython then later run %matplotlib, but so far I think not otherwise.
    2. When it does occur, I can always free the interface and get the prompt back with <CTRL-C><enter>, but nothing else has worked. I tried other suggestions from this issue page, but <CTRL-A> and <CTRL-E> do not work. Waiting (for a few minutes) and clicking in and out of the terminal do not work.
    3. It happens without using arrow keys, just alphanumeric keys are sufficient. However, it seems to only happen when I'm typing the start of something defined. That is, if I jam keys randomly, it is fine, but if I type np it can freeze. This is not so certain, and hard to test since the freezing is inconsistent. It can happen when hitting <Tab> as well, which is especially annoying, since I first think <Tab> is doing nothing because I've misspelled something so no completion exists, but it turns out it's frozen, so I have to hit <CTRL-C><enter><up>, then <Tab> works.
    4. My keyboard repeat rate and delay are both set to the fastest setting. However, holding any keys down or typing randomly really fast do not induce the problem. I also have the problem happen at the settings shown in @rrbarbosa 's image.

    Here's all the information that I can think of to provide:

    OS X El Capitan 10.11.3
    iTerm2 Build 2.9.20160206
    IPython 4.0.3
    python 2.7.11
    matplotlib 1.5.1 (backend 'MacOSX')
    
    IPython.sys_info()
    {'commit_hash': u'8ff8693',
     'commit_source': 'installation',
     'default_encoding': 'UTF-8',
     'ipython_path': '/usr/local/lib/python2.7/site-packages/IPython',
     'ipython_version': '4.0.3',
     'os_name': 'posix',
     'platform': 'Darwin-15.3.0-x86_64-i386-64bit',
     'sys_executable': '/usr/local/opt/python/bin/python2.7',
     'sys_platform': 'darwin',
     'sys_version': '2.7.11 (default, Dec  8 2015, 17:52:46) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)]'}
    
    os.environ
    {'DISPLAY': '/private/tmp/com.apple.launchd.wh7e6piUqu/org.macosforge.xquartz:0',
     'TERM_PROGRAM': 'iTerm.app',
     'LANG': 'en_US.UTF-8',
     'TERM': 'xterm-256color',
     'XPC_FLAGS': '0x0',
     'XPC_SERVICE_NAME': '0',
     'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.2ITyyqMHxp/Listeners',
     'SHELL': '/usr/local/bin/fish',
     '__CF_USER_TEXT_ENCODING': '0x1F7:0x0:0x0'}
    
  9. dannguyen commented on Mar 19, 2016

    @dannguyen

    Just wanted to add my input as a OS X 10.11...I thought it was just me. I've been using Anaconda 2.4.0 Python 3.x for more than a year without ever seeing this problem. This week was the first time I started getting back into matplotlib, and every time I startup ipython, I run into it. Like @leewalsh, I'm only able to get out with Ctrl-C.

    I'm running ipython without any flags. The hiccups happen as soon as I run the magic command, %matplotlib...the freezing will just hit as I'm in the middle of typing out a line of code.

    $ sw_vers
    ProductName:    Mac OS X
    ProductVersion: 10.11.3
    BuildVersion:   15D21
    >>> sys.version
    # 3.5.1 |Anaconda 2.4.0 (x86_64)| (default, Dec  7 2015, 11:24:55) 
    # [GCC 4.2.1 (Apple Inc. build 5577)]
    
    
    >>> platform.platform()
    'Darwin-15.3.0-x86_64-i386-64bit'
    
    >>> os.uname()
    # posix.uname_result(sysname='Darwin', nodename='DN.Net', release='15.3.0', 
    # version='Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; 
    # root:xnu-3248.30.4~1/RELEASE_X86_64', machine='x86_64')
  10. leewalsh commented on Mar 24, 2016

    @leewalsh

    I can add another data point. On my laptop running Yosemite I have never encountered this problem. Here are the config for that:

    OS X Yosemite 10.10.5
    iTerm2 Build 2.9.20160206
    IPython 4.1.2
    python 2.7.11
    matplotlib 1.5.1 (backend 'MacOSX')
    
    IPython.sys_info()
    {'commit_hash': u'b573435',
     'commit_source': 'installation',
     'default_encoding': 'UTF-8',
     'ipython_path': '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython',
     'ipython_version': '4.1.2',
     'os_name': 'posix',
     'platform': 'Darwin-14.5.0-x86_64-i386-64bit',
     'sys_executable': '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python',
     'sys_platform': 'darwin',
     'sys_version': '2.7.11 (default, Mar  4 2016, 21:52:10) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]'}
    
    os.environ
    {'DISPLAY': '/private/tmp/com.apple.launchd.tLeRVzzJhh/org.macosforge.xquartz:0',
     'TERM_PROGRAM': 'iTerm.app',
     'LANG': 'en_US.UTF-8',
     'TERM': 'xterm-256color',
     'XPC_FLAGS': '0x0',
     'XPC_SERVICE_NAME': '0',
     'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.6adRrWYHww/Listeners',
     'SHELL': '/opt/local/bin/fish',
     '__CF_USER_TEXT_ENCODING': '0x1F5:0x0:0x0'}
    
  11. leewalsh commented on Mar 24, 2016

    @leewalsh

    @Carreau, lots of information has been provided since you tagged this as needs-info. I understand if nobody has had time to look into this, but can you clarify whether we still need more info? If so, what kind of info would be helpful? I am happy to dig further but I don't know where to look. Or maybe do you think it's a matplotlib problem, not ipython?

  12. Carreau commented on Mar 24, 2016

    @Carreau
    Member

    I can remove the need-info, but yes, here we really need to figure out why it does that.
    It might be a matplotlib event loop integration issue, but I'm not sure why.

    Has @tacaswell or @minrk seen that and have an idea ? I'm unfamiliar with the event loop code, so the answer might be obvious to one of them, but not for me.

  13. tacaswell commented on Mar 24, 2016

    @tacaswell
    Contributor

    The thing @leewalsh reports with strange inputs may be related to a bug in readline. Try hitting ctrl-g to see if that helps?

  14. 3 remaining items

  15. stefan-pdx commented on Apr 28, 2016

    @stefan-pdx

    I have the same problem in El Capitan. I found by:

    • running ctrl-Z when IPython is unresponsive
    • followed by fg to bring the process back to the foreground
    • running ctrl-C followed by Enter to generate a KeyboardInterrupt exception

    is the fastest way to getting back to the interactive prompt. However, IPython becomes unresponsive after a few minutes.

  16. tacaswell commented on Apr 28, 2016

    @tacaswell
    Contributor

    what matplotlib backends is everyone using? This is starting to sound like issues with PyOS_InputHook

  17. leewalsh commented on Apr 28, 2016

    @leewalsh

    Using matplotlib backend: MacOSX

  18. tacaswell commented on Apr 28, 2016

    @tacaswell
    Contributor

    Can you reproduce this with qtagg?

  19. rhdtownsend commented on Apr 28, 2016

    @rhdtownsend

    Yep, me too…

    On Apr 28, 2016, at 5:55 PM, Lee Walsh notifications@github.com wrote:

    Using matplotlib backend: MacOSX

    —
    You are receiving this because you commented.
    Reply to this email directly or view it on GitHub

  20. mseppa commented on May 2, 2016

    @mseppa

    I've been running ipython with Qt4Agg for a while now and there have been no freezes. So, for me it seems to be MacOSX specific problem.

  21. carhartl commented on May 2, 2016

    @carhartl

    I've been seeing that with using matplotlib backend Qt4Agg (running inside a docker container on OSX).

  22. leewalsh commented on Jul 23, 2016

    @leewalsh

    For what it's worth, this issue seems to have disappeared with the magnificent and glorioius IPython 5.0. I vote to close.

  23. dannguyen commented on Jul 23, 2016

    @dannguyen

    @leewalsh I won't have time in the next week to properly confirm this but given how abruptly this issue popped up for a specific group of users, I won't at all be surprised if it is obsoleted in 5.0. Thanks for checking it out!

  24. takluyver commented on Jul 23, 2016

    @takluyver
    Member

    Closing - we can reopen it if it turns out it wasn't completely fixed.

  25. added this to the 5.0 milestone on Aug 10, 2016
  26. iskandr commented on May 29, 2017

    @iskandr

    I'm having this problem after upgrading to IPython 6.0 on Yosemite. Since readline got upgraded I'm guessing the problem is there.

  27. takluyver commented on May 30, 2017

    @takluyver
    Member

    As we moved away from readline, I'd guess that you're seeing a similar but different problem.

  28. iskandr commented on May 30, 2017

    @iskandr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions