apache / apache/beam

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

Open
#19,563 0 comments 0 reactions 0 assignees View on GitHub
bug core P3 python
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

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)
in ()
\--\--\> 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 ()
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 ()
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'

Imported from Jira [BEAM-7622](https://issues.apache.org/jira/browse/BEAM-7622). Original Jira may contain additional context.
Reported by: weazelb0y.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.