Skip to content

Calling plt.show hangs indefinitely #2

Open
@ferdinandyb

Description

@ferdinandyb

Here's the traceback after keyboard interrupt (using I'm using python 3.11.1 with ipython 8.8.0). I waited minutes, but nothing happened.

[ins] In [5]: plt.show()
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
Cell In[5], line 1
----> 1 plt.show()

File ~/.pyenv/versions/3.11.1/lib/python3.11/site-packages/matplotlib/pyplot.py:421, in show(*args, **kwargs)
    377 """
    378 Display all open figures.
    379
   (...)
    418 explicitly there.
    419 """
    420 _warn_if_gui_out_of_main_thread()
--> 421 return _get_backend_mod().show(*args, **kwargs)

File ~/.pyenv/versions/3.11.1/lib/python3.11/site-packages/matplotlib-backend-notcurses/__init__.py:78, in _BackendNotcursesAgg.show(cls, *args, **kwargs)
     76 @classmethod
     77 def show(cls, *args, **kwargs):
---> 78     _Backend.show(*args, **kwargs)
     79     Gcf.destroy_all()

File ~/.pyenv/versions/3.11.1/lib/python3.11/site-packages/matplotlib/backend_bases.py:3541, in _Backend.show(cls, block)
   3539 for manager in managers:
   3540     try:
-> 3541         manager.show()  # Emits a warning for non-interactive backend.
   3542     except NonGuiException as exc:
   3543         _api.warn_external(str(exc))

File ~/.pyenv/versions/3.11.1/lib/python3.11/site-packages/matplotlib-backend-notcurses/__init__.py:29, in FigureManagerNotcurses.show(self)
     23 margins = '0'
     25 if os.environ.get('MPLBACKEND_NOTCURSES_SIZING', 'automatic') != 'manual':
     26
     27     # gather terminal dimensions
     28     # FIXME should use a less hacky way for getting width/height in pixels
---> 29     info = run(['notcurses-info'], text=True, capture_output=True).stdout.rstrip()
     30     dims = info.splitlines()[1].split(' ')
     31     rows, height, width = map(int, [dims[0].split('[K')[-1], *dims[6].split('x')])

File ~/.pyenv/versions/3.11.1/lib/python3.11/subprocess.py:550, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    548 with Popen(*popenargs, **kwargs) as process:
    549     try:
--> 550         stdout, stderr = process.communicate(input, timeout=timeout)
    551     except TimeoutExpired as exc:
    552         process.kill()

File ~/.pyenv/versions/3.11.1/lib/python3.11/subprocess.py:1207, in Popen.communicate(self, input, timeout)
   1204     endtime = None
   1206 try:
-> 1207     stdout, stderr = self._communicate(input, endtime, timeout)
   1208 except KeyboardInterrupt:
   1209     # https://bugs.python.org/issue25942
   1210     # See the detailed comment in .wait().
   1211     if timeout is not None:

File ~/.pyenv/versions/3.11.1/lib/python3.11/subprocess.py:2059, in Popen._communicate(self, input, endtime, orig_timeout)
   2052     self._check_timeout(endtime, orig_timeout,
   2053                         stdout, stderr,
   2054                         skip_check_and_raise=True)
   2055     raise RuntimeError(  # Impossible :)
   2056         '_check_timeout(..., skip_check_and_raise=True) '
   2057         'failed to raise TimeoutExpired.')
-> 2059 ready = selector.select(timeout)
   2060 self._check_timeout(endtime, orig_timeout, stdout, stderr)
   2062 # XXX Rewrite these to use non-blocking I/O on the file
   2063 # objects; they are no longer using C stdio!

File ~/.pyenv/versions/3.11.1/lib/python3.11/selectors.py:415, in _PollLikeSelector.select(self, timeout)
    413 ready = []
    414 try:
--> 415     fd_event_list = self._selector.poll(timeout)
    416 except InterruptedError:
    417     return ready

KeyboardInterrupt:
> /home/fbence/.pyenv/versions/3.11.1/lib/python3.11/selectors.py(415)select()
    413         ready = []
    414         try:
--> 415             fd_event_list = self._selector.poll(timeout)
    416         except InterruptedError:
    417             return ready

ipdb>

Notcurses-info seems to work:

  ~                                                                                                                                                                  9m 18s contour  !8/196
❯ notcurses-info
notcurses 3.0.6 on Contour 0.3.13-master-c50b38ec (Linux 5.15.0-79-generic)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions