Joseph Toth created BEAM-7622:
---------------------------------

             Summary: Cannot import InteractiveRunner as IPython.display is no 
longer a valid symbol.
                 Key: BEAM-7622
                 URL: https://issues.apache.org/jira/browse/BEAM-7622
             Project: Beam
          Issue Type: Bug
          Components: sdk-py-core
            Reporter: Joseph Toth


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'




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to