Skip to content

Pickling imshow fails (?due to _imcache) #3614

Closed

Description

@mfitzp

Pickling imshow objects (I'm using them used for heatmaps) fails with the following error in IPython after %matplotlib inline magic has been used. If inline figures are not set they work as expected.

UnpickleableError: Cannot pickle <type 'Image'> objects

Using matplotlib.tests.test_pickle.recursive_pickle fails reporting the following (similar to #1719):

Failed to pickle attribute "gridline" in (list/tuple item #0 in (attribute "majorTicks" in (attribute "xaxis" in (list/tuple item #1 in (list/tuple item #1 in (list/tuple item #0 in (attribute "_elements" in (attribute "_axstack" in (top level object))))))))).  Type: <class 'matplotlib.lines.Line2D'>

However, using matplotlib.tests.test_pickle.depth_getter its possible to identify the object that is the cause of the initial error. It's at:

140628613187224 (8, <Image object at 0x7fe6a688c698>, u'attribute "_imcache" in (list/tuple item #0 in (attribute "images" in (list/tuple item #1 in (list/tuple item #1 in (list/tuple item #0 in (attribute "_elements" in (attribute "_axstack" in (top level object))))))))')

It looks as though this is a cache of the rendered image. Can these be ignored when pickling?

Activity

  1. added this to the milestone on Oct 3, 2014
  2. tacaswell commented on Oct 3, 2014

    @tacaswell
    Member

    I think partial duplicate of #3392

  3. added a commit that references this issue on Oct 9, 2014
    ba6e42a
  4. modified the milestones: v1.4.1, on Oct 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions