Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-13968

afw display plugin import failures are hard to debug

    XMLWordPrintable

    Details

      Description

      Gabriele Comoretto [X] had a problem with a test failure in display_matplotlib. The error he got was:

      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
      ../../../../Linux64/afw/14.0-54-g2e4184dee/python/lsst/afw/display/interface.py:692: in setDefaultBackend
          Display.setDefaultBackend(backend)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
       
      backend = 'matplotlib'
       
          @staticmethod
          def setDefaultBackend(backend):
              try:
                  _makeDisplayImpl(None, backend)
              except Exception as e:
                  raise RuntimeError(
      >               "Unable to set backend to %s: \"%s\"" % (backend, e))
      E           RuntimeError: Unable to set backend to matplotlib: "module 'matplotlib' has no attribute 'DisplayImpl'"
       
      ../../../../Linux64/afw/14.0-54-g2e4184dee/python/lsst/afw/display/interface.py:252: RuntimeError
      

      The problem turned out to be that he did not have libGL.so installed so matplotlib itself could not be imported. I am wondering if the problem is that the backend detection logic in _makeDisplayImpl is trying to do a naive import of backend, and that is working (because matplotlib does exist). The first attempt of lsst.display.matplotlib is failing and matplotlib is next on the list.

      I think this line in afw.display is the problem:

      if not _disp or not hasattr(_disp.DisplayImpl, "_show"):
      

      We might want to put a check for DisplayImpl existing as part of the original detection loop. If we do that we still would lose the original ImportError message though.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rhl Robert Lupton
              Reporter:
              tjenness Tim Jenness
              Watchers:
              Gabriele Comoretto [X] (Inactive), Heather Kelly, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Jenkins

                  No builds found.