matplotlib / matplotlib/ipympl

RuntimeError: libpng signaled error

Open
#127 16 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
1.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

Sometimes I am getting this error with the trunk version. Not sure what a MWE would be. Has anyone encountered this?
Thanks, Chaffra
```
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/ipympl/backend_nbagg.py in _handle_message(self, object, content, buffers)
178 self.manager.resize(w, h)
179 else:
--> 180 self.manager.handle_json(content)
181
182 def send_json(self, content):

/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_webagg_core.py in handle_json(self, content)
437
438 def handle_json(self, content):
--> 439 self.canvas.handle_event(content)
440
441 def refresh_all(self):

/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_webagg_core.py in handle_event(self, event)
238 handler = getattr(self, 'handle_{0}'.format(e_type),
239 self.handle_unknown_event)
--> 240 return handler(event)
241
242 def handle_unknown_event(self, event):

/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_webagg_core.py in handle_draw(self, event)
254
255 def handle_draw(self, event):
--> 256 self.draw()
257
258 def _handle_mouse(self, event):

/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_webagg_core.py in draw(self)
151 super().draw()
152 finally:
--> 153 self.manager.refresh_all() # Swap the frames.
154
155 def draw_idle(self):

/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_webagg_core.py in refresh_all(self)
441 def refresh_all(self):
442 if self.web_sockets:
--> 443 diff = self.canvas.get_diff_image()
444 if diff is not None:
445 for s in self.web_sockets:

/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_webagg_core.py in get_diff_image(self)
199 buff = _png.write_png(
200 output.view(dtype=np.uint8).reshape(output.shape + (4,)),
--> 201 None, compression=6, filter=_png.PNG_FILTER_NONE)
202
203 # Swap the renderer frames

RuntimeError: libpng signaled error
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ipympl's backend_nbagg.py and the matplotlib backend_webagg_core.py path through handle_draw(), refresh_all(), and get_diff_image(), especially the _png.write_png call shown in the traceback. Reproduce the failure across the reported Python, ipympl, matplotlib, and libpng versions, then define a minimal example and regression coverage that demonstrates the error no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.