Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-7622

Cannot import InteractiveRunner as IPython.display is no longer a valid symbol.

Details

    • Bug
    • Status: Open
    • P3
    • Resolution: Unresolved
    • None
    • None
    • sdk-py-core
    • None

    Description

      This was when attempting to use apache_beam's interactive runner in a local ipython interpreter.

      Cannot import InteractiveRunner as IPython.display is no longer a valid symbol.
      Added AttributeError to catch this case.

      Changing line 45 in apache_beam/runners/interactive/display/display_manager.py seems to fix it:
      except (ImportError, NameError, AttributeError):

      The code path that breaks is when using ipython from a command line. (not a notebook)

      To reproduce you can start an interpreter and import the interactive runner:

      /google/data/ro/projects/g3python/g3python --deps //third_party/py/apache_beam
      from apache_beam.runners.interactive import interactive_runner

      The error:

      /google/src/cloud/joetoth/abe/google3 23s
      ❯ /google/data/ro/projects/g3python/g3python --deps //third_party/py/apache_beam

      [g3python: Building...]
      Python 2.7.15 (default, redacted, redacted)
      Type "copyright", "credits" or "license" for more information.

      IPython 2.0.0 – An enhanced Interactive Python.
      ? -> Introduction and overview of IPython's features.
      %quickref -> Quick reference.
      help -> Python's own help system.
      object? -> Details about 'object', use 'object??' for extra details.
      [TerminalIPythonApp] WARNING | File not found: '/usr/local/google/home/joetoth/bin/python/startup.py'
      In [1]: import apache_beam as beam
      In [2]: from apache_beam.runners.interactive import interactive_runner

      ---------------------------------------------------------------------------
      AttributeError Traceback (most recent call last)
      <ipython-input-2-2ff56761aedc> in <module>()
      ----> 1 from apache_beam.runners.interactive import interactive_runner

      /usr/local/google/_blaze_joetoth/8a340ca11685334674f82c3618f1e5b3/execroot/google3/blaze-out/k8-fastbuild/bin/experimental/g3p_ba38f6d06246dd255a8eb7dc1cc9fa3485da71d0/wrapper.runfiles/google3/third_party/py/apache_beam/runners/interactive/interactive_runner.py in <module>()
      32 from apache_beam.runners.interactive import cache_manager as cache
      33 from apache_beam.runners.interactive import pipeline_analyzer
      ---> 34 from apache_beam.runners.interactive.display import display_manager
      35 from apache_beam.runners.interactive.display import pipeline_graph_renderer
      36

      /usr/local/google/_blaze_joetoth/8a340ca11685334674f82c3618f1e5b3/execroot/google3/blaze-out/k8-fastbuild/bin/experimental/g3p_ba38f6d06246dd255a8eb7dc1cc9fa3485da71d0/wrapper.runfiles/google3/third_party/py/apache_beam/runners/interactive/display/display_manager.py in <module>()
      34 import IPython # pylint: disable=import-error
      35 # _display_progress defines how outputs are printed on the frontend.
      ---> 36 _display_progress = IPython.display.display
      37
      38 def _formatter(string, pp, cycle): # pylint: disable=unused-argument

      AttributeError: 'module' object has no attribute 'display'

      Attachments

        Activity

          People

            Unassigned Unassigned
            weazelb0y Joseph Toth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: